I have never really done anyhting in php at all, so this would be my first attempt (and hopefully last) to make a php script. Bascially I make a simple data call and then I need to send an email based on the data I recieve. I take a value uid from the querystring and return records from the db, plug them into variables and send an e-mail. Really simple.
Will someone please take a look at my code and tell me if they see anything wrong? I would test it, but it is kind a pain to access the server and upload.
<?php
$host = "localhost";
$loginname = "user";
$password = "password";
$data = "db";
@mysql_connect($host, $loginname, $password)
$result = mysql_db_query($data,"Select UserName, Password, FirstName, LastName, EmailAddress, PaypalAcct, MaxNumUsers, ServerName,
ServerIP, PortNumber from WebUsers w, Ports p, Servers s Where p.portid=w.portid and p.serverid=s.serverid and UserID=".$_GET["uid"]);
while($row = mysql_fetch_array($result))
{
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "To: ".$row['EmailAddress']."\r\n";
$headers .= "From: <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e --> \r\n";
$headers .= "Cc: <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e --> \r\n";
$subject = "Ventrilo Server Setup";
$text = "Thank you for signing up for Ventrilo service with FusionVoice!<br><br>Account Details:<br><br>Username:
".$row['UserName']."<br>Password: ".$row['Password']."<br>First Name: ".$row['FirstName']."<br>Last Name:
".$row['LastName']."<br>Email Address: ".$row['EmailAddress'].<br>PayPal Account: ".$row['PaypalAcct']."<br><br>Server
Details:<br><br>Server Name: ".$row['ServerName']."<br>ServerIP".$row['ServerIP']."<br>Port Number: ".$row['PortNumber']."<br>Max
Number Users: ".$row['MaxNumUsers']."<br><br>Control Panel Login:<br><a
href='http://".$row['ServerName']."/cp/'>http://".$row['ServerName']."/cp/</a>";
mail($addy,$subject,$text,$headers);
}
?>I put it out there and got it working. Thanks for looking!
Will someone please take a look at my code and tell me if they see anything wrong? I would test it, but it is kind a pain to access the server and upload.
<?php
$host = "localhost";
$loginname = "user";
$password = "password";
$data = "db";
@mysql_connect($host, $loginname, $password)
$result = mysql_db_query($data,"Select UserName, Password, FirstName, LastName, EmailAddress, PaypalAcct, MaxNumUsers, ServerName,
ServerIP, PortNumber from WebUsers w, Ports p, Servers s Where p.portid=w.portid and p.serverid=s.serverid and UserID=".$_GET["uid"]);
while($row = mysql_fetch_array($result))
{
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "To: ".$row['EmailAddress']."\r\n";
$headers .= "From: <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e --> \r\n";
$headers .= "Cc: <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e --> \r\n";
$subject = "Ventrilo Server Setup";
$text = "Thank you for signing up for Ventrilo service with FusionVoice!<br><br>Account Details:<br><br>Username:
".$row['UserName']."<br>Password: ".$row['Password']."<br>First Name: ".$row['FirstName']."<br>Last Name:
".$row['LastName']."<br>Email Address: ".$row['EmailAddress'].<br>PayPal Account: ".$row['PaypalAcct']."<br><br>Server
Details:<br><br>Server Name: ".$row['ServerName']."<br>ServerIP".$row['ServerIP']."<br>Port Number: ".$row['PortNumber']."<br>Max
Number Users: ".$row['MaxNumUsers']."<br><br>Control Panel Login:<br><a
href='http://".$row['ServerName']."/cp/'>http://".$row['ServerName']."/cp/</a>";
mail($addy,$subject,$text,$headers);
}
?>I put it out there and got it working. Thanks for looking!