• Scheduled Server Maintenance | Friday 6 November

    Our hardware provider has scheduled RAM maintenance to address the recent server instability. Work is expected by 17:00 Central European time.

    Brief downtime or interruptions may occur while the faulty memory modules are replaced. We apologise for the recent disruption and appreciate your patience.


    Special thanks to our sponsor, HyperFilter!

    We keep our community safe. They keep our servers safe. Running your own game servers? Keep them protected with HyperFilter.

PHP - All users email list

Joined
Feb 18, 2009
Messages
486
Reaction score
38
This php web page will show all of your users registered accounts email addresses in the format:

Code:
email1, email2, email3, email, email5

This can be really useful if you wanted to create a email list to email every player registered on your server with important information etc...

You can download it here:

Code:
http://randomthingsihost.co.uk/download/email_script.rar

Remember please press the thanks button if this was helpful, or just if you feel like it =]

Ciao for nao :peace:

EDIT: Cheers alfredao for the neater code, changed that part of the page :)
 
Last edited:
I didn't test, but don't work.

$result = mssql_query("SELECT * FROM Account Email");

Account Email?

Account being the table name, and Email being the section in the column in the table, the database name is already defined :P

Though I like the script you put on my other thread, so ima upload one using that too, it's a little more neat :)

Code:
randomthingsihost.co.uk/download/email_script.rar

Btw if you could test my attempt because it worked for me so it should for others :P I bet you it does! =] (Unless you have a diff table name for email)

*facepalm*
i'm pretty sure you're suppose to edit it and place in the name of the email field in there...

I thought the email field was called Email, it is for me! What is yours called?
 
Last edited:
But

Code:
$result = mssql_query("SELECT * FROM Account Email");

Would be selecting from a column named Account Email o_O....
Correct me if im wrong.
 
Well that does work due to the formatting that is available, it takes the first thing after from as the table name , and if there is a space the column, though I do prefer your way it seems more logical :)
 
PHP:
$mssql_user = "username";
$mssql_password = "password";
$mssql_host = "HOST";
$mssql_db = "GunzDB";

if(!@mssql_connect($mssql_host,$mssql_user,$mssql_password)){
echo "Cannot connect the Server";
die();
}
if(!@mssql_select_db($mssql_db)){
echo "Cannot connect to the Database";
die();
}


$headers = "MIME-Version: 1.0\r\n"; 
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; 
$headers .= "From: DomainName <[email protected]>\r\n"; 
$headers .= "X-Priority: 1\r\n"; 
$headers .= "X-MSmail-Priority: High\r\n";
$subject = "Test";
$text = "Hi."; // HTML Allowed.

$query = mssql_query("SELECT * FROM Account WHERE Email != NULL");
$emails = "";
while($row = mssql_fetch_array($query)){
$emails .= $row['Email'];
$emails .= ", ";
}
$mail_sent = @mail($emails, $subject, $text, $headers );

if($mail_sent == true){
echo "Mail has been sent";
} elseif($mail_sent == false){
echo "Error occured.";
} else {
echo "This error wouldn't even show up.";
}

Email Pl0x.

For the main part of collecting the emails :

PHP:
$query = mssql_query("SELECT * FROM Account WHERE Email != NULL");
$emails = "";
while($row = mssql_fetch_array($query)){
$emails .= $row['Email'];
$emails .= ", ";
}
echo $emails;

Just mind, if u allow duplicate Emails to register with.. to check them ><. If some guy registered 5 accounts with the same email, he would get 5x the email ><..
 
Last edited:
nice but eh what is the point at it who add without he will be added guys from his own server just time wasting of spam newbs
 
Just mind, if u allow duplicate Emails to register with.. to check them ><. If some guy registered 5 accounts with the same email, he would get 5x the email ><..

Which is why you could just use the DISTINCT keyword.

Anyways:

Code:
$ask = mssql_query("SELECT Email FROM Account ORDER BY AID ASC");

Any reason why you have an ORDER BY clause?
 
Which is why you could just use the DISTINCT keyword.[/code]

Or restrict Emails from duplication in the beginning u start ur server.
Or use a while() and a double select query, but thats just odd. blows ur mind out if u are going to think about it.


@ Nova.

People like to script their ways, just copy/pasted mine. But got a whole function for the emailing, which i would like to keep private >< so i just copy/pasted working parts for it.


@ Topic. Make sure you actually triple checked ur stuff.
@ My Code, It's up to you whichever you use it or not.
 
Back