Page 1 of 1

Can't get it to send emails!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Posted: Mon Nov 24, 2003 2:09 am
by Mr. Tech
Hi!

I have a script I have edited so that it sends emails. It allowed me to send emails on another page of the script but this page just WONT work!!! I have tried every way I know to send the email!! Heres the code:

Code: Select all

<?php ob_start(); ?>
<?
session_start();
// Unset all of the session variables.
session_unset();
// Finally, destroy the session.
session_destroy();
/*
if ($_GET('signup')) {
error("SIGNUP");
   echo "Error Checking<br>";
   while(list($name, $value) = each($signup)) {
      echo "$name - $value<br>";
   }
}
*/

   require 'include.inc';

    if ($signup) {
   
   	if ($signup[repassword] != $signup[password]) {
   		$err_msg = "Your passwords do not match.";
error($err_msg);
   	}
   
   	if(!eregi("^[_\.0-9a-z-]+$",$signup[username])) {
   		$err_msg = "Invalid Username! Usernames can consist of letters and numbers only.";
error($err_msg);   	
}
   	if(!eregi("^[_\.0-9a-z-]+$",$signup[password])) {
   	   $err_msg = "Invalid Password!  Passwords can consist of letters and numbers only.";
   	}
      if(!$signup[password] || !$signup[username] || !$signup[email] || !$signup[username])
            $err_msg = "Oops! You forgot some important fields!";


      if (!$err_msg) {

// =================================================================
The Send Email Part
// =================================================================
@mail("webmaster@webmaster-resources101.com","hi","hessage","From: Surf2Ya <support@surf2ya.com>");

	$time = time();
	$usercheck = @mysql_query("INSERT INTO user values(
      	'NULL','$signup[fname]','$signup[lname]',
      	'$signup[username]','$signup[password]','$signup[email]', 1, ".$pointInc.", '$signup[referral]', '$time', 'n', 'y', '0', '0', '')") or die ("<b>Error:</b> ".mysql_error());
      	
      	  // done, you are entered correctly, Now Enter the points and URL info
            
       
       		$sql = "Select id from user where username='$signup[username]'";

		$result = mysql_query( $sql );
			if ( $result != false )
				{
			while ( $data = mysql_fetch_assoc( $result ) )
			{
				$point_set = $data['id'];
		
				}
			} else {
				echo mysql_error();
			}	
		// add rerral points
	
	if ($signup[referral])	{
	  $referralSql="UPDATE points SET points=points+ ".$refPoints . " WHERE userid=".$signup[referral];
	  $result = mysql_query( $referralSql );
					if ( $result != false )
						{
					} else {
						echo mysql_error();
						}
        }							
		
		
	// add URL	
	
	$sql="INSERT INTO url_table ( userid, website, active, datechanged) VALUES ($point_set,'".$signup[site_url]."','n', '".date("Ymd")."')";

	  $result = mysql_query( $sql );
					if ( $result != false )
						{
					} else {
						echo mysql_error();
					}
	// add points
       	$sql="INSERT INTO points (userid, username, points) VALUES ($point_set,' ',$signPoints)";
	  $result = mysql_query( $sql );
					if ( $result != false )
						{
					} else {
						echo mysql_error();
						}
        }
         echo mysql_errno().": ".mysql_error()."<br>";
	
        	 	include ("reg.php"); 
        	 	exit;
         }
etc.. ect.. etc..
?>
Anything in the code that is stuffing it up?

Posted: Mon Nov 24, 2003 10:25 am
by Steveo31

Code: Select all

// ================================================================= 
The Send Email Part 
// =================================================================
"The Send Email Part" text is not in comment form. Try:

Code: Select all

// ================================================================= 
//The Send Email Part 
// =================================================================
As for the rest of the code, I'm brand new to PHP.

Posted: Mon Nov 24, 2003 12:09 pm
by Saethyr
Wierd bro, worked fine on my server....did you try taking the @ off the front? I didn't have to but it might be worth a try.


Saethyr

Posted: Mon Nov 24, 2003 12:35 pm
by microthick
Do you know if you're actually getting into the SEND EMAIL portion of the script?

You could try changing this line:
if (!$err_msg) {

to:
if ($err_msg == "") {
or
if (empty($err_msg)) {

Posted: Mon Nov 24, 2003 4:17 pm
by Mr. Tech
Steveo31, that was something I added when posting the message :D

I was talking to the guy who owns the site and he says other scripts with email functions are also not working at the moment... So it must be the web host...

microthick, yes it is getting into the send email part. That's what so weird...

Thanks for your help!