Bit of a cheeky one, but I'm in a hurry to get this script up and running tonight 🙁
Anyway, I have the following code for user registration ( it is messy I know, but going to tidy it up later).
What I need to do is get an email validation script in there.
It needs to work by adding the user to a 'temp_user' table. Then a mail is sent out to for them to confirm back it's a valid email address but clicking the link.
Then it needs to delete from the 'temp_users' and add the details to the 'user' table.
I can probably work out the last part,(might need a bit of help there) but I have little understanding of the mail() function and where is should sit and how to create the link with the random info.
I've tried to find a newbie tutorial that explains it, but I've failed. I've searched the forums and can't find one in here either.
So can someone help me write it or point me in the direction of a good easy quick tutorial.
Thanks for help in advance
<?php
require ($_SERVER["DOCUMENT_ROOT"]."/pickup/config/rav_config_db.php");
$connection = mysql_connect($db_host, $db_user, $db_password) or die("fucked up try again");
mysql_select_db($db_name, $connection);
$username = $_POST[username];
$result = mysql_query("SELECT * FROM user where username = '$username'");
if (strlen($username) != 0)
if (mysql_num_rows($result) > 0 )
{
die ("user name already exists in database, or you may have left it blank please use the back button and try again");
}
$wonid = $_POST[wonid];
$result = mysql_query("SELECT * FROM user where wonid = '$wonid'");
if (strlen($wonid) != 0)
if (mysql_num_rows($result) > 0 )
{
die ("The WONID already exists in the database go purchase you own copy of Half life you haxor or read the instructions and enter one and try again using the back button");
}
$gname = $_POST[gname];
$result = mysql_query("SELECT * FROM user where gname = '$gname'");
if (strlen($gname) != 0)
if (mysql_num_rows($result) > 0 )
{
die ("That name is either in use or you have not entered one");
}
$email = $_POST[email];
$result = mysql_query("SELECT * FROM user where email = '$email'");
if (strlen($email) != 0)
if (mysql_num_rows($result) > 0 )
{
die ("That email address is either in use or you have not botherd to enter one, use the back button");
}
else
{
$password = $_POST[password];
$clan = $_POST[clan];
$query = "INSERT INTO user (username, wonid, password, gname, email, clan) Values ('$username', '$wonid', '$password', '$gname', '$email', '$clan')";
$result= mysql_query($query, $connection);
if($result)
{
echo "Your details have been added to our records, you can now /msg cspickup-bot AUTH user pass";
exit();
}
else
{
echo "There was a problem with our database. Please try again later.";
exit();
}
}
?>
<html>
<head><title>AoN Pickup Sign On</title></Head>
<body bgcolor="#333333">
</body>
</html>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%">
<tr>
<td width="100%">
<p align="center">
<img border="0" src="logo.gif" width="340" height="89"><br>
</td>
</tr>
<tr>
<td width="100%">
<html>
<body bgcolor="#333333">
<form action="<?php echo $_server[php_self]; ?> "Method="POST">
<center>
<TABLE border="0" style="border-collapse: collapse" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2">
<p align="center"> </td>
</tr>
<tr>
<td>
<font color="#B2B2AD"><b>Username:</b> </font>
</td>
<td>
<font color="#FFFFCC">
<input type="username" name="username" size="20"> </font>
</TR>
</tr>
<TR>
<td>
<font color="#B2B2AD">
<B>Password:</B> </font>
</td>
<td>
<font color="#FFFFCC">
<input type="password" name="password" size="20"> </font>
</TR>
<TR>
<td>
<font color="#B2B2AD"><b>CS Name:</b> </font>
</td>
<td>
<font color="#FFFFCC">
<input type="gname" name="gname" size="20"> </font>
</TR>
<TR>
<td>
<font color="#B2B2AD">
<B>Wonid:</B> </font>
</td>
<td>
<font color="#FFFFCC">
<input type="wonid" name="wonid" size="20"> </font>
</TR>
<TR>
<td>
<font color="#B2B2AD">
<B>Email:</B> </font>
</td>
<td>
<font color="#FFFFCC">
<input type="email" name="email" size="20"> </font>
</TR>
<TR>
<td>
<font color="#B2B2AD">
<B>Clan:</B> </font>
</td>
<td>
<font color="#FFFFCC">
<input type="clan" name="clan" size="20"> </font>
</TR>
<tr>
<td>
</td>
<td>
<font color="#FFFFCC">
<input type="submit" value="submit" name="submit">
<input type="reset" value="Reset" name="reset"> </font>
</td>
</tr>
</table>
</center>
<p align="center"><font color="#EFE87F"><b>Your wonid <u>MUST</u> be vaild
to play on server</b></font><font color="#FFFFCC"><br>
<BR>
</font>
</p>
</form>
</body>
</html>
<p> </td>
</tr>
</table>
<html>
<body bgcolor="#333333">
</body>
</html>