<?
session_start();
$page="signup";
include"header.php";
include"mysql.php";
include"config.php";
print"
<h2>Creating an account</h2>
<p class=\"post-by\">on $sitename</p>
";
if($_SESSION['loggedin']==1)
{
print"<center>You are already signed up, and logged in.</center>";
}
else
{
if($_POST['username'])
{
if($_POST['promo'] == "Your Promo Code Here")
{
$sm+=100;
}
$referal=$_POST['ref'];
$username=$_POST['username'];
$email=$_POST['email'];
$paypal=$_POST['paypal'];$username=str_replace(array("<", ">"), array("<", ">"), $username);
$email=str_replace(array("<", ">"), array("<", ">"), $email);
$paypal=str_replace(array("<", ">"), array("<", ">"), $paypal);
$referal=str_replace(array("<", ">"), array("<", ">"), $referal);
$q=mysql_query("SELECT * FROM users WHERE username='{$username}'",$c);What does the above section do exactly?
if(mysql_num_rows($q))
{
die("<center>Username already in use.</br>Choose another.</center>");
}
if('{$username}' == '$referal')
{
die("<center>You cannot refer yourself.</center>");
}
else if($_POST['password'] != $_POST['cpassword'])
{
die("<center>Your passwords did not match.</br>Please go back and try again.</center>");
}
else
{
$_POST['ref'] = abs((int) $_POST['ref']);
$ip = ($_SERVER['HTTP_X_FORWARDED_FOR'])
? $_SERVER['HTTP_X_FORWARDED_FOR']
: $_SERVER['REMOTE_ADDR'];
$q=mysql_query("SELECT * FROM users WHERE userIP='$ip' OR signupIP='$ip'",$c);
if(mysql_num_rows($q))
{
die("<center>You are not allowed to create more than one account per IP address.</center></br>
<center> If you are using a proxy please disable it and try again.</center></br>
<center>We apologize for the inconvenience.</center>");
}
if(isset($_POST['ref']))
{
$q=mysql_query("SELECT * FROM users WHERE `username`='$referal'",$c);
$r=mysql_fetch_array($q);
$f=mysql_query("SELECT * FROM users WHERE `username`='$referal'",$c);$gangs=mysql_num_rows($f);
Does the above even serve a purpose? Reason I ask, is I can not find $gangs being used anywhere.
if(mysql_num_rows($q)==0)
{
$referal="";
}
if(mysql_num_rows($f)!=0)
{
$tref=mysql_query("SELECT * FROM users WHERE `username`='$referal'",$c);
$theref=mysql_fetch_array($tref);
mysql_query("UPDATE users SET referrals=referrals+1, current_balance=current_balance+$refbonus, total_earned=total_earned+.50 WHERE id='{$theref['id']}'",$c);
}
} $time=time();
$emailcheck=md5(rand(100000,999999));
$password=md5($_POST['password']);
mysql_query("INSERT INTO users VALUES ('','{$username}','$password','0','{$email}','$emailcheck','','{$paypal}','','$ip','$ip','$time','$signupbonus','$signupbonus','0','0','$referal','');",$c) or die(mysql_error());I know the above section is for inserting the data into the USERS table. I am trying to get $referal to also be inserted into the REFERRERS table, which has the following field; username.
$i=mysql_insert_id($c);
What does the above do? I can not find $i being used anywhere.
mail( $email, "Account Registered on $sitename",
<remove email part to shorten post>
print"
<br><br><br><center>Your account has been successfully created.<br>Thank you for joining $sitename<br><br>
> <a href=\"index.php\">Back To $sitename</a></center>
";
}
}
else
{
print"
<center>
<form action=\"signup.php\" method=\"post\">
<i>Username</i><br><input type=\"text\" name=\"username\"><br>
<i>E-Mail</i><br><input type=\"text\" name=\"email\"><br>
<i>Password</i><br><input type=\"password\" name=\"password\"><br>
<i>Confirm Password</i><br><input type=\"password\" name=\"cpassword\"><br>
<i>Paypal Email</i><br><input type=\"text\" name=\"paypal\"><br>
<i>Referrer</i>: $ref<input type=\"hidden\" name=\"ref\" value=\"$ref\"><br><br>
<input type=\"submit\" class=\"button\" value=\"Sign Up\"></form><br />
</center>
";
}
}
include"side.php";
include"footer.php";
?>The purpose for entering the users.referrer to referrer.username is there will be a script that when a member completes a project, his/her referrer will be given a credit. I figure that I would need the referrer table, for this, or could is possible to do a users.referrer = users.username? I could be wrong on all this...
Thanks in advance for any help. If any additional info is needed, please let me know.
Attached File(s)
-
signup.php (4.47K)
Number of downloads: 0
This post has been edited by ziptrx: 09 July 2010 - 02:08 AM








Sign In »
Register Now!
Help

MultiQuote