Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 08-18-2004, 03:31 PM   #1 (permalink)
rdove
Masked Moderator
 
rdove's Avatar
 
Join Date: May 2002
Location: Indianapolis, IN
Posts: 260
rdove is on a distinguished road
Emailing and DB call

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.

Code:
<?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: mail@mail.com \r\n";
$headers .= "Cc: mail@mail.com \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);

}

?>
__________________
~Ryan

rdove is offline   Reply With Quote
Old 08-18-2004, 03:39 PM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,486
sde is on a distinguished road
looks good .. but i'm no replacement for the php debugger =)
__________________
Mike
sde is offline   Reply With Quote
Old 08-18-2004, 03:42 PM   #3 (permalink)
rdove
Masked Moderator
 
rdove's Avatar
 
Join Date: May 2002
Location: Indianapolis, IN
Posts: 260
rdove is on a distinguished road
Thanks Mike, really I was looking for someone to tell me that I didn't mess something up majorly
__________________
~Ryan

rdove is offline   Reply With Quote
Old 08-18-2004, 03:56 PM   #4 (permalink)
rdove
Masked Moderator
 
rdove's Avatar
 
Join Date: May 2002
Location: Indianapolis, IN
Posts: 260
rdove is on a distinguished road
Am getting:

Parse error: parse error, unexpected T_VARIABLE in /home/fusionvo/public_html/senduseremail.php on line 10


Which is:

Code:
$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"]);
I haven't a clue what that error means
__________________
~Ryan

rdove is offline   Reply With Quote
Old 08-18-2004, 04:31 PM   #5 (permalink)
rdove
Masked Moderator
 
rdove's Avatar
 
Join Date: May 2002
Location: Indianapolis, IN
Posts: 260
rdove is on a distinguished road
I got it figure out was missing a ';', damn php and its ;'s
__________________
~Ryan

rdove is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 09:03 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting