Jump to content

Register member


Mr_J

Recommended Posts

Ok,

a lot of code...

When I try to register a new user, I get: Not found: your email in our database Cannot send Confirmation link to your e-mail address, please try again.

I have 8 files for the login etc.: login.php, chkLogin.php, LoginSucses.php, Logout.php, confirm.php, config.php, register.php and register_me.php

this is register.php:

<html>
<head>
</head>
<body>
<table width="350" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><form name="register" method="post" action="register_me.php">
<table width="100%" border="0" cellspacing="4" cellpadding="0">
<tr>
<td colspan="3"><strong>Sign up</strong></td>
</tr>
<tr>
<td width="76">Name</td>
<td width="3">:</td>
<td width="305"><input name="name" type="text" id="name" size="30"></td>
</tr>
<tr>
<td>E-mail</td>
<td>:</td>
<td><input name="email" type="text" id="email" size="30"></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input name="password" type="password" id="password" size="30"></td>
</tr>

<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Submit">  
<input type="reset" name="Reset" value="Reset"></td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>

 

then, register_me.php to process form...

<?
include('config.php');   //this is my sql usr and pw, db etc.

$tbl_namer=cpdUsr;

$confirm_code=md5(uniqid(rand()));  //unique code to confirm user mail

// values sent from form
$email=$_POST['email'];
$myusername=$_POST['username'];
$mypassword=$_POST['password'];

// Insert data into database
$sql="INSERT INTO $tbl_name(confirm_code, username, password)VALUES('$confirm_code', '$myusername', '$mypassword')";
$result=mysql_query($sql);

// if suceesfully inserted data into database, send confirmation link to email
if($result){

// ---------------- SEND MAIL FORM ----------------

// send e-mail to ...
$to=$myusername;  [b]//I think this value must be $username??[/b]

//subject
$subject="Your CPD Registration Conformation";

// From
$header="from: [email protected]";

// Your message
$message="Your Comfirmation link \r\n";
$message.="Click on this link to activate your account \r\n";
$message.="http://www.example.com/confirm.php?passkey=$confirm_code";

// send email
$sentmail = mail($to,$subject,$message,$header);

}

// if not found
else {
echo "Not found: your email in our database";
}

// if your email successfully sent
if($sentmail){
echo "Your Confirmation link Has Been Sent To Your Email Address.";
}
else {
echo "Cannot send Confirmation link to your e-mail address, please try again.";
}

?>

 

Can anybody see what I`m missing...

Cheers

MrJ

Link to comment
https://forums.phpfreaks.com/topic/204732-register-member/
Share on other sites

and see if there are any errors with that line.

 

I do!!

You have an error in your SQL syntax; check the manual that corresponds to your

MySQL server version for the right syntax to use near '(confirm_code, username, password)VALUES('f11de245ee64fa21413f3db262b7438d', '',' at line 1

 

Does this mean that my db setup is wrong or confirm_code is in the wrong row?

Link to comment
https://forums.phpfreaks.com/topic/204732-register-member/#findComment-1071857
Share on other sites

I saw also this spelling error. Shouldn't be

$tbl_namer=cpdUsr;

, because in

// Insert data into database
$sql="INSERT INTO $tbl_name(confirm_code, username, password)VALUES('$confirm_code', '$myusername', '$mypassword')";
$result=mysql_query($sql);

you use

 $tbl_name

Link to comment
https://forums.phpfreaks.com/topic/204732-register-member/#findComment-1071875
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.