Jump to content


Photo

Help with My Own Script! ( Help ASap!)


  • Please log in to reply
9 replies to this topic

#1 Deanznet

Deanznet
  • Members
  • PipPipPip
  • Advanced Member
  • 220 posts

Posted 18 September 2006 - 07:51 PM

I need some help Maybe you can help cause i have no knowlege of php, I got about 3 or 4 Problems, Here We go!

My Problem is, #1 When Some one registers i want it to be able to Require their email, #2 When people Register For some Reason THey never Get them Email with their passwords #3 The login Page Never lets anyone login.

Here my MYsql


CREATE TABLE users (
	uid int(11) NOT NULL auto_increment,
	username varchar(50) default NULL,
	password varchar(50) default NULL,
	first_name varchar(20) NOT NULL default '',
	last_name varchar(35) NOT NULL default '',
	street varchar(100) NOT NULL default '',
	city varchar(40) NOT NULL default '',
	state varchar(5) NOT NULL default '',
	zip varchar(10) NOT NULL default '',
	country varchar(40) NOT NULL default '',
	email varchar(100) NOT NULL default '',
	telephone varchar(12) NOT NULL default '',
	last_paid varchar(50) NOT NULL default '',
	signup_date varchar(50) NOT NULL default '',
	status int(11) NOT NULL default '1',
	PRIMARY KEY  (uid)
) TYPE=MyISAM;
CREATE TABLE pending (
	id int(255) unsigned NOT NULL auto_increment,
	username varchar(15) NOT NULL default '',
	since varchar(50) NOT NULL default '',
	PRIMARY KEY  (id)
) TYPE=MyISAM;
CREATE TABLE images (
	id int(11) NOT NULL auto_increment,
	filename text NOT NULL,
	ipaddress text NOT NULL,
	date int(11) NOT NULL default '0',
	status tinyint(4) NOT NULL default '1',
	pkey varchar(25) NOT NULL default '',
	user int(11) NOT NULL DEFAULT '0',
	PRIMARY KEY  (id)
) TYPE=MyISAM AUTO_INCREMENT=30 ;
CREATE TABLE gallery(
	id int(11) NOT NULL auto_increment,
	name text NOT NULL,
	user int(11) NOT NULL default '0',
	PRIMARY KEY  (id)
) TYPE=MyISAM;

CREATE TABLE gitem(
	id int(11) NOT NULL auto_increment,
	gid int(11) NOT NULL default '0',
	image int(11) NOT NULL default '0',
	PRIMARY KEY  (id)
) TYPE=MyISAM;

This is the registration page

<?
	include("include/common.php");
	include("include/header.php");
?>
<?
	$submit1 = $_POST['submit1'];
	$submit2 = $_POST['submit2'];
	$submit3 = $_POST['submit3'];
	if($submit1 == "1") {
		if($requirepaid) {
?>
			<h3>Signup for a New Account Step 1</h3><form method=post>
			<?=$table2?>
			<tr align=center>
				<td colspan=3>Select a Username. A password will be generated and emailed to you at the end of the signup process.<p></td>
			</tr>
<?			include("include/paidsignupform.php");	?>
			</table>
			</form> 
<?
		}
		if(!$requirepaid) {
?>
			<h3>Signup for a New Account Step 1</h3><form method=post>
			<?=$table2?>
			<tr align=center>
				<td colspan=2>Fill out the form below. A password will be generated and emailed to you.<p></td>
			</tr>
<?			include("include/nopaidsignupform.php");	?>
			</table></form>
<?
		}
	}else if($submit1 == "2") {
?>
		<h3>Signup for a New Account</h3>
		<?=$table2?>
		<tr align=center>
			<td colspan=2>Press your browser's 'Back' key and click 'I Agree' to our terms and conditions to continue the signup process.<p></td>
		</tr> 
<?
	}else if($submit2) {
		$susername = $_POST['susername'];
		if(!ereg("^[A-Za-z0-9_]{1,16}$",$susername)) {
			$serror="Invalid username! Use no more than 15 characters and only letters, numbers, and underscores.<br>"; 
		}
		$this->c=@mysql_query("select username from users where username='$susername'");
		$this->d=mysql_fetch_object($this->c);
		if(is_object($this->d)) { $serror="Username is already in use<br>"; }
		$this->c=@mysql_query("select username from pending where username='$susername'");
		$this->d=mysql_fetch_object($this->c);
		if(is_object($this->d)) { $serror="Username is already in use<br>"; }
		echo "<h3>Signup for a New Account Step 3</h3>";
		if (!$serror) {
			$nowtime = time();
			mysql_query("insert into Pending (username,since) values ('$susername','$nowtime')"); 
?>
			<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
			<?="$table2";?>
			<tr>
				<td align=center>
					Click the button below to signup for our <?=$paypal_sub?> subscription through PayPal. 
					The first 7 days are free, and you can cancel anytime before the 7 days are up 
					and be charged nothing.<p>
					<input type="hidden" name="cmd" value="_xclick-subscriptions">
					<input type="hidden" name="no_shipping" value="1">
					<input type="hidden" name="no_note" value="1">
					<input type="hidden" name="p3" value="1">
					<input type="hidden" name="t3" value="<?=$paypal_subcode?>">
					<input type="hidden" name="a1" value="0.00">
					<input type="hidden" name="src" value="1">
					<input type="hidden" name="sra" value="1">
					<input type="hidden" name="business" value="<?="$paypal_email";?>">
					<input type="hidden" name="item_name" value="<?="$paypal_item";?>">
					<input type="hidden" name="item_number" value="<?="$paypal_item_number";?>">
					<input type="hidden" name="a3" value="<?="$paypal_price";?>">
					<input type="hidden" name="notify_url" value="<?="$paypal_ipn";?>">
					<input type="hidden" name="cancel_return" value="<?="$paypal_cancel_return";?>">
					<input type="hidden" name="return" value="<?="$paypal_return";?>">
					<input type="hidden" name="os0" value="<?="$susername";?>">
					<input type="hidden" name="on0" value="Username">
					<input type="submit" value="Subscribe now">
				</td>
			</tr>
			</table></form>
<? 
		}
		if ($serror) {
?>
			<form method=post>
			<?=$table2?>
			<tr align=center>
				<td colspan=3><font color=red><?=$serror?></font><p></td>
			</tr>
<?			include("include/paidsignupform.php");	?>
			</table></form>
<?
		}
	}else if($submit3) {
		$susername = $_POST['susername'];	
		$spassword = $_POST['spassword'];
		$sfirst_name = $_POST['sfirst_name'];
		$slast_name = $_POST['slast_name'];
		$sstreet = $_POST['slast_namesstreet'];
		$scity = $_POST['scity'];
		$sstate = $_POST['sstate'];
		$szip = $_POST['szip'];
		$scountry = $_POST['scountry'];
		$semail = $_POST['semail'];
		$stelephone = $_POST['semailstelephone'];
		if(!ereg("^[A-Za-z0-9_]{1,16}$",$susername)) {
			$serror="Invalid username! Use no more than 15 characters and only letters, numbers, and underscores.<br>"; 
		}
		$this->c=@mysql_query("select username from users where username='$susername'");
		$this->d=mysql_fetch_object($this->c);
		if(is_object($this->d)) { $serror="Username is already in use<br>"; }
		$this->c=@mysql_query("select username from pending where username='$susername'");
		$this->d=mysql_fetch_object($this->c);
		if(is_object($this->d)) { $serror="Username is already in use<br>"; }
		if (!$serror) {
			mt_srand((double)microtime()*1000000^getmypid());
			$pass_length = mt_rand($this->min_pass_length,$this->max_pass_length);
			while(strlen($spassword)<$pass_length) {
				$spassword.=substr($this->chars,(mt_rand()%strlen($this->chars)),1); 
			}
			include("include/emails.php");
			$signupmessage=str_replace("<username>","$susername",$signupmessage);
			$signupmessage=str_replace("<password>","$spassword",$signupmessage);
			$signupmessage=str_replace("<first_name>","$sfirst_name",$signupmessage);
			$signupmessage=str_replace("<last_name>","$slast_name",$signupmessage);
			$signupmessage=str_replace("<login_url>","$login_url",$signupmessage);
			$subject = "$signupsubject";
			$message = "$signupmessage";
			mail($semail,$subject,$message,"From: $adminemail");
			$adminsignupmessage = str_replace("<username>","$susername",$adminsignupmessage);
			$adminsignupmessage = str_replace("<password>","$spassword",$adminsignupmessage);
			$adminsignupmessage = str_replace("<first_name>","$sfirst_name",$adminsignupmessage);
			$adminsignupmessage = str_replace("<last_name>","$slast_name",$adminsignupmessage);
			$adminsignupmessage = str_replace("<member_email>","$semail",$adminsignupmessage);
			$subject = "$adminsignupsubject";
			$message = "$adminsignupmessage";
			mail($adminemail,$subject,$message,"From: $adminemail"); 
			$nowdate = date("M d, Y");
			mysql_query("insert into users (uid, username, password, first_name, last_name, street, city, state, zip, country, email, telephone, last_paid, signup_date) values ('','$susername', '$spassword', '$sfirst_name', '$slast_name', '$sstreet', '$scity', '$sstate', '$szip', '$scountry', '$semail', '$stelephone', 'free', '$nowdate')");
			echo "<h3>Signup for a New Account Complete</h3>$table2
				<tr><td align=center>Thank you for signing up $susername. We have sent you a welcome email to <b>$semail</b> with your password.</table>"; 
		}
		if ($serror) {
?>
			<h3>Signup for a New Account Step 3</h3>
			<form method=post>
			<?=$table2?>
			<tr align=center>
				<td colspan=3><font color=red><?=$serror?></font><p></td>
			</tr>
<?			include("include/nopaidsignupform.php");	?>
			</table></form>
<?
		}
	}else {
?>
		<h3>Signup for a New Account Step 1</h3>
		<?=$table2?>
		<tr>
			<td align=center>
				Please read through our terms and conditions below and click 'I Agree' to continue with the signup process.<p>
				<font size=3><b>Terms and Conditions</b></font><p>
				<form method=post><textarea name=textfield cols=60 rows=15 wrap=virtual>
<?		include "include/terms.php";	?>
				</textarea><p><input type=radio name=submit1 value=1> I Agree<br><input type=radio name=submit1 value=2> I Disagree<p><input type=submit value='Next Step -->'></form>
			</td>
		</tr>
		</table>
<?
	}
	include("include/footer.php");
?>

This is the Login Page

<?
	include("include/common.php");

	if( $_POST['username'] && $_POST['password'] ){
		$failed = 1;
		$username = $_POST['username'];
		$password = $_POST['password'];
		$query = "SELECT * FROM users WHERE username='$username' AND password='$password'";
#		echo $query;
		$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
		if ( ($result) && (mysql_num_rows($result) > 0) ){
			$row = mysql_fetch_object($result);
			$adlogin = $row->username;
			$myname = $row->username;
			$adpassword = $row->password;
			$myuid = $row->uid;
#			echo $adlogin." ----".$adpassword."<br>";
			if ( ($username != $adlogin) || ($password != $adpassword) ){
				$failed = 1;
			}else{
				$failed = 0;
				$loggedin = 1;
				session_register("loggedin");
				session_register("myuid");
				session_register("myname");
			}
		}else{
			$failed = 1;
		}
	}
	if($loggedin){
		ob_start();
		header("Location: account.php");
	}
	include("include/header.php");
?>
<p><font face=arial size=3>
<form action="login.php" method="POST">
<input type="hidden" name="action" value="login"><font face="arial" size="2"><b>Username</b><br>
<input type=text name=username size=30 tabindex="1" maxlength="12"><i>[type in your username]</i></font><br>
<font face="arial" size="2"><br>
<b>Password</b><br>
<input type=password name=password size=30 tabindex="2" maxlength="12"><i>[type in your password]</i></font><br>
<br>
<font face="arial" size="2"><input type="submit" name="" value="Login" tabindex="4" style="background-color:#e5e5e5; color:#000000; font-family:Verdana,Arial; font-weight: bold; font-size: 11px; border-left: 1 solid #a0a0a0; border-top: 1 solid #a0a0a0; border-right: 1 solid #000000; border-bottom: 1 solid #000000; padding: 2 2 2 2; outline: #a0a0a0 solid 2px;">
<br><br>
</font>
<table border="0" cellpadding="0" cellspacing="0" width="178">
<tr height="19">
	<td height="19" valign="top">
		<font face="arial" size="2"><b><a href="mailto:<?=$adminemail?>?subject=<?=$sitename?>/Password"><b>Forgot Your Password?</b></a></b></font>
	</td>
</tr>
<tr height="18">
	<td valign="bottom" height="18">
		<font face="arial" size="2"><b><a href="/join.php"><b>Register New Account!</b></a></b></font>
	</td>
</tr>
</table>
</form>
</font></p>
<?
	include("include/footer.php");
?>

Let me know please! i need some help!


#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 19 September 2006 - 07:24 PM

if(isset($_REQUEST['adduser']))
{
 	$showform = 0;
 	$passgood = 1;
	$err = "";
 	$ufname = trim(strip_tags($_POST['ufname']));
 	$ulname = trim(strip_tags($_POST['ulname']));
    $email = trim(strip_tags($_POST['email']));
    $user = trim(strip_tags($_POST['user']));
	$pass = trim(strip_tags($_POST['pass']));
	$pass2 = trim(strip_tags($_POST['pass2']));
    $secure = strtoupper(trim(strip_tags($_POST['secure'])));
    $match = $_SESSION['captcha']; // the code on the image

	if ($ufname == "") $err .= "Please provide your first name<br/>";
	if ($ulname == "") $err .= "Please provide your last name<br/>";
    if ($email == "") $err .= "Please provide your email address<br>";
    if ($email != "" && !eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) 
	    $err.= $email. " is not a valid email address.<br/>";
    if ($user == "") $err .= "Please provide a username<br/>";
    if ($pass == "") $err .= "Please provide a password<br/>";
    if ($pass2 == "") $err .= "Please confirm your password<br/>";
    if ($secure == "") $err .= "No security code entered<br/>";
    if (($secure != $match) && ($secure != "")) $err.= "Security code mismatch<br/>";

 	if(trim($pass) != trim($pass2))
 	{
		$err .= "Your password does not match the confirmation password!<br/>";
		$passgood = 0;
	}
	
	if ($err == "") 
	{
		$query = "SELECT uname FROM users WHERE uname = '" . $_REQUEST['user'] . "'";
		$result = $ehandle->update_query($query);
	    if($result && mysql_num_rows($result) == 0)
	    {
			
	    	$query = "INSERT INTO users (ufname, ulname, ulevel, ulog, uname, upass, uaction, utimeoffset, uemail, uenabled) VALUES ('$ufname', '$ulname', 1, 1, '$user', '$pass', '" . date("Y-m-d h:i:s A") . "', 0, '$email', 1)";
	    	$result = $ehandle->update_query($query);
	    	
	    	if($result)
                {
                  // blah blah

Then at the bottom where I have the form again:
if((isset($showform) && $showform == 1) || !isset($showform))
{
 	if(!isset($passgood))
 		$passgood = 1;
	if ($err != "") {
    	echo "<strong>Form Error(s)</strong><br/>";
	    echo "<font color='#cc3300'>". nl2br($err). "</font><br/>";
	}

?>

	<form action="index.php?req=signup" method="post">
	<input type="hidden" name="adduser" value="1">
	
	<table cellpadding="5" cellspacing="2">
	<tr>
		<td>First Name:</td>
          blah blah

Info: PHP Manual


#3 Deanznet

Deanznet
  • Members
  • PipPipPip
  • Advanced Member
  • 220 posts

Posted 19 September 2006 - 07:34 PM

<?
   include("include/common.php");
   include("include/header.php");
?>
<?
   $submit1 = $_POST['submit1'];
   $submit2 = $_POST['submit2'];
   $submit3 = $_POST['submit3'];
   if($submit1 == "1") {
      if($requirepaid) {
?>
         <h3>Signup for a New Account Step 1</h3><form method=post>
         <?=$table2?>
         <tr align=center>
            <td colspan=3>Select a Username. A password will be generated and emailed to you at the end of the signup process.<p></td>
         </tr>
<?         include("include/paidsignupform.php");   ?>
         </table>
         </form>
<?
      }
      if(!$requirepaid) {
?>
         <h3>Signup for a New Account Step 1</h3><form method=post>
         <?=$table2?>
         <tr align=center>
            <td colspan=2>Fill out the form below. A password will be generated and emailed to you.<p></td>
         </tr>
<?         include("include/nopaidsignupform.php");   ?>
         </table></form>
<?
      }
   }else if($submit1 == "2") {
?>
      <h3>Signup for a New Account</h3>
      <?=$table2?>
      <tr align=center>
         <td colspan=2>Press your browser's 'Back' key and click 'I Agree' to our terms and conditions to continue the signup process.<p></td>
      </tr>
<?
   }else if($submit2) {
      $susername = $_POST['susername'];
      if(!ereg("^[A-Za-z0-9_]{1,16}$",$susername)) {
         $serror="Invalid username! Use no more than 15 characters and only letters, numbers, and underscores.<br>";
      }
      $this->c=@mysql_query("select username from users where username='$susername'");
      $this->d=mysql_fetch_object($this->c);
      if(is_object($this->d)) { $serror="Username is already in use<br>"; }
      $this->c=@mysql_query("select username from pending where username='$susername'");
      $this->d=mysql_fetch_object($this->c);
      if(is_object($this->d)) { $serror="Username is already in use<br>"; }
      echo "<h3>Signup for a New Account Step 3</h3>";
      if (!$serror) {
         $nowtime = time();
         mysql_query("insert into Pending (username,since) values ('$susername','$nowtime')");
?>
         <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
         <?="$table2";?>
         <tr>
            <td align=center>
               Click the button below to signup for our <?=$paypal_sub?> subscription through PayPal.
               The first 7 days are free, and you can cancel anytime before the 7 days are up
               and be charged nothing.<p>
               <input type="hidden" name="cmd" value="_xclick-subscriptions">
               <input type="hidden" name="no_shipping" value="1">
               <input type="hidden" name="no_note" value="1">
               <input type="hidden" name="p3" value="1">
               <input type="hidden" name="t3" value="<?=$paypal_subcode?>">
               <input type="hidden" name="a1" value="0.00">
               <input type="hidden" name="src" value="1">
               <input type="hidden" name="sra" value="1">
               <input type="hidden" name="business" value="<?="$paypal_email";?>">
               <input type="hidden" name="item_name" value="<?="$paypal_item";?>">
               <input type="hidden" name="item_number" value="<?="$paypal_item_number";?>">
               <input type="hidden" name="a3" value="<?="$paypal_price";?>">
               <input type="hidden" name="notify_url" value="<?="$paypal_ipn";?>">
               <input type="hidden" name="cancel_return" value="<?="$paypal_cancel_return";?>">
               <input type="hidden" name="return" value="<?="$paypal_return";?>">
               <input type="hidden" name="os0" value="<?="$susername";?>">
               <input type="hidden" name="on0" value="Username">
               <input type="submit" value="Subscribe now">
            </td>
         </tr>
         </table></form>
<?
      }
      if ($serror) {
?>
         <form method=post>
         <?=$table2?>
         <tr align=center>
            <td colspan=3><font color=red><?=$serror?></font><p></td>
         </tr>
<?         include("include/paidsignupform.php");   ?>
         </table></form>
<?
      }
   }else if($submit3) {
      $susername = $_POST['susername'];   
      $spassword = $_POST['spassword'];
      $sfirst_name = $_POST['sfirst_name'];
      $slast_name = $_POST['slast_name'];
      $sstreet = $_POST['slast_namesstreet'];
      $scity = $_POST['scity'];
      $sstate = $_POST['sstate'];
      $szip = $_POST['szip'];
      $scountry = $_POST['scountry'];
      $semail = $_POST['semail'];
      $stelephone = $_POST['semailstelephone'];
      if(!ereg("^[A-Za-z0-9_]{1,16}$",$susername)) {
         $serror="Invalid username! Use no more than 15 characters and only letters, numbers, and underscores.<br>";
      }

    if ($semail == "") $err .= "Please provide your email address<br>";
    if ($semail != "" && !eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $semail)) 
	    $err.= $semail. " is not a valid email address.<br/>";

      $this->c=@mysql_query("select username from users where username='$susername'");
      $this->d=mysql_fetch_object($this->c);
      if(is_object($this->d)) { $serror="Username is already in use<br>"; }
      $this->c=@mysql_query("select username from pending where username='$susername'");
      $this->d=mysql_fetch_object($this->c);
      if(is_object($this->d)) { $serror="Username is already in use<br>"; }
      if (!$serror) {
         mt_srand((double)microtime()*1000000^getmypid());
         $pass_length = mt_rand($this->min_pass_length,$this->max_pass_length);
         while(strlen($spassword)<$pass_length) {
            $spassword.=substr($this->chars,(mt_rand()%strlen($this->chars)),1);
         }
         include("include/emails.php");
         $signupmessage=str_replace("<username>","$susername",$signupmessage);
         $signupmessage=str_replace("<password>","$spassword",$signupmessage);
         $signupmessage=str_replace("<first_name>","$sfirst_name",$signupmessage);
         $signupmessage=str_replace("<last_name>","$slast_name",$signupmessage);
         $signupmessage=str_replace("<login_url>","$login_url",$signupmessage);
         $subject = "$signupsubject";
         $message = "$signupmessage";
         mail($semail,$subject,$message,"From: $adminemail");
         $adminsignupmessage = str_replace("<username>","$susername",$adminsignupmessage);
         $adminsignupmessage = str_replace("<password>","$spassword",$adminsignupmessage);
         $adminsignupmessage = str_replace("<first_name>","$sfirst_name",$adminsignupmessage);
         $adminsignupmessage = str_replace("<last_name>","$slast_name",$adminsignupmessage);
         $adminsignupmessage = str_replace("<member_email>","$semail",$adminsignupmessage);
         $subject = "$adminsignupsubject";
         $message = "$adminsignupmessage";
         mail($adminemail,$subject,$message,"From: $adminemail");
         $nowdate = date("M d, Y");
         mysql_query("insert into users (uid, username, password, first_name, last_name, street, city, state, zip, country, email, telephone, last_paid, signup_date) values ('','$susername', '$spassword', '$sfirst_name', '$slast_name', '$sstreet', '$scity', '$sstate', '$szip', '$scountry', '$semail', '$stelephone', 'free', '$nowdate')");
         echo "<h3>Signup for a New Account Complete</h3>$table2
            <tr><td align=center>Thank you for signing up $susername. We have sent you a welcome email to <b>$semail</b> with your password.</table>";
      }
      if ($serror) {
?>
         <h3>Signup for a New Account Step 3</h3>
         <form method=post>
         <?=$table2?>
         <tr align=center>
            <td colspan=3><font color=red><?=$serror?></font><p></td>
         </tr>
<?         include("include/nopaidsignupform.php");   ?>
         </table></form>
<?
      }
   }else {
?>
      <h3>Signup for a New Account Step 1</h3>
      <?=$table2?>
      <tr>
         <td align=center>
            Please read through our terms and conditions below and click 'I Agree' to continue with the signup process.<p>
            <font size=3><b>Terms and Conditions</b></font><p>
            <form method=post><textarea name=textfield cols=60 rows=15 wrap=virtual>
<?      include "include/terms.php";   ?>
            </textarea><p><input type=radio name=submit1 value=1> I Agree<br><input type=radio name=submit1 value=2> I Disagree<p><input type=submit value='Next Step -->'></form>
         </td>
      </tr>
      </table>
<?
   }
   include("include/footer.php");
?>


#4 Deanznet

Deanznet
  • Members
  • PipPipPip
  • Advanced Member
  • 220 posts

Posted 19 September 2006 - 08:08 PM

Okay Most of the stuff here has been fixed thanks to ben,  i have a problem trying to get it to email passwords if a user forgets, this is what i got so far.

<?
 
         include("include/emails.php");
        
         mail($semail,$subject,$message,"From: $adminemail");
         $adminsignupmessage = str_replace("<username>","$susername",$adminsignupmessage);
         $adminsignupmessage = str_replace("<password>","$spassword",$adminsignupmessage);
        $adminsignupmessage = str_replace("<member_email>","$semail",$adminsignupmessage);
         $subject = "$adminsignupsubject";
         $message = "$adminsignupmessage";
         mail($adminemail,$subject,$message,"From: $adminemail");
         $nowdate = date("M d, Y");
         mysql_query("SELECT username, pass FROM users WHERE user_email = '" . $_REQUEST['submitted_email'] . "'";
		 
         echo "<h3>Your Password Has Been Sent./h3>$table2
            <tr><td align=center>We have sent you a welcome email to <b>$semail</b> with your password.</table>";
?>


#5 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 19 September 2006 - 08:12 PM

whoa whoa whoa... you're really lost.

You're sending out mail twice before you even verify the user's email address.  And what is all the "adminsingupmessage" crap?
         $subject = "Forgotten password";
         $result = mysql_query("SELECT username, pass FROM users WHERE user_email = '" . $_REQUEST['submitted_email'] . "'";
         if($result && mysql_num_rows($result) == 1)
         {
             $row = mysql_fetch_row($result);
             $message = "Your username: " . $row['username'] . "<br>"Your password: " . $row['pass'];
             mail($_REQUEST['submitted_email'],$subject,$message,"From: $adminemail");
         }

Try that

Info: PHP Manual


#6 Deanznet

Deanznet
  • Members
  • PipPipPip
  • Advanced Member
  • 220 posts

Posted 19 September 2006 - 08:28 PM

I get an error

<?

        include("include/emails.php");
        $subject = "Forgotten password";
        $result = mysql_query("SELECT username, pass FROM users WHERE user_email = '" . $_REQUEST['submitted_email'] . "'");
        if($result && mysql_num_rows($result) == 1)
        {
            $row = mysql_fetch_row($result);
            $message = "Your username: " . $row['$username'] . "<br>"Your password: " . $row['$password'];
            mail($_REQUEST['submitted_email'],$subject,$message,"From: $adminemail");
        }
       
         
?>

#7 Mutley

Mutley
  • Members
  • PipPipPip
  • Advanced Member
  • 765 posts

Posted 19 September 2006 - 09:10 PM

What error do you get?
~ Mutley.

#8 Deanznet

Deanznet
  • Members
  • PipPipPip
  • Advanced Member
  • 220 posts

Posted 19 September 2006 - 09:35 PM

I fixed the error, but it wont send an email,

This is the page where the user enters their email and hits submit,

<?
include("include/header.php");
?>
<p><font face=arial size=3>
</font><form action="emailp.php" method="POST">
<font size="3" face="arial"><br>
<br>
<b><font size="2">Email</font></b><br>
<input type=text name=email size=30 tabindex="2" maxlength="25">
<i>[type in your email you registered with]</i><br>
<br>
<input type="submit" name="" value="Get password" tabindex="4" style="background-color:#e5e5e5; color:#000000; font-family:Verdana,Arial; font-weight: bold; font-size: 11px; border-left: 1 solid #a0a0a0; border-top: 1 solid #a0a0a0; border-right: 1 solid #000000; border-bottom: 1 solid #000000; padding: 2 2 2 2; outline: #a0a0a0 solid 2px;">
<br><br>
</font>
</form>
</p>
<?
	include("include/footer.php");
?>

Here is the page it calls on

<?
 
         include("include/emails.php");
  include("include/common.php");
         $subject = "Forgotten password";
         $result = mysql_query("SELECT username, pass FROM users WHERE user_email = '" . $_REQUEST['submitted_email'] . "'");
         if($result && mysql_num_rows($result) == 1)
         {
             $row = mysql_fetch_row($result);
             $message = "Your username: " . $row['username'] . "<br>Your password: " . $row['pass'];
             mail($_REQUEST['submitted_email'],$subject,$message,"From: $adminemail");
         }
           
?>


#9 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 19 September 2006 - 10:25 PM

<?php
 
         include("include/emails.php");
  include("include/common.php");
         $subject = "Forgotten password";
		 $email = mysql_real_escape_string($_POST['email']);
		 $select = "SELECT username, password FROM users WHERE email = '$email';";
		 $result = mysql_query($select);
         if($row = mysql_fetch_array($result))	{
		 	$to = "{$email}";
			$subject = "Username and password";
			$message = "
			Username: {$row[username]}
			Password: {$row[password]} ";
			if (mail($to, $subject, $message,"From: $adminemail")) {
			echo "Your details have been sent to your email.";
			}else {
			echo "There was a problem sending the email";
			}
		}
           
?>

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#10 Deanznet

Deanznet
  • Members
  • PipPipPip
  • Advanced Member
  • 220 posts

Posted 19 September 2006 - 11:06 PM

Thanks alot businessman332211!

Still wont work, but we are pretty close. it wont email it,

Anyone else want to try?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users