Jump to content
MakeWebGames

Registration Does Not Work, please help.


Recommended Posts

Posted

After I got a new layout my register seemed to stop working. You can fill everything out and even click submit. When you click submit half the layout shows up, but you are not signed up.

For obvious reasons I won't post the layout part, but here is the php part.

 

<?

$IP = ($_SERVER['HTTP_X_FORWARDED_FOR'])
?  $_SERVER['HTTP_X_FORWARDED_FOR']
:  $_SERVER['REMOTE_ADDR'];
if(file_exists('ipbans/'.$IP))
{
die("[b]<font color=red size=+1>Your IP has been banned, there is no way around this.</font>[/b]</body></html>");
}
if($_POST['username'])
{
if($set['regcap_on'])
{
 if(!$_SESSION['captcha'] or $_SESSION['captcha'] != $_POST['captcha'])
 {
unset($_SESSION['captcha']);
die("Captcha Test Failed

>[url='register.php']Back[/url]");
 }
 unset($_SESSION['captcha']);
}
if(!valid_email($_POST['email']))
{
die("Sorry, the email is invalid.

>[url='register.php']Back[/url]");
}
if(strlen($_POST['username']) < 4)
{
die("Sorry, the username is too short.

>[url='register.php']Back[/url]");
}
$sm=100;
if($_POST['promo'] == "Your Promo Code Here")
{
$sm+=100;
}
$username=$_POST['username'];
$username=str_replace(array("<", ">"), array("<", ">"), $username);
$q=$db->query("SELECT * FROM users WHERE username='{$username}' OR login_name='{$username}'");
$q2=$db->query("SELECT * FROM users WHERE email='{$_POST['email']}'");
if($db->num_rows($q))
{
print "Username already in use. Choose another.

>[url='register.php']Back[/url]";
}
else if($db->num_rows($q2))
{
print "E-Mail already in use. Choose another.

>[url='register.php']Back[/url]";
}
else if($_POST['password'] != $_POST['cpassword'])
{
print "The passwords did not match, go back and try again.

>[url='register.php']Back[/url]";
}
else
{
$_POST['ref'] = abs((int) $_POST['ref']);
$IP = ($_SERVER['HTTP_X_FORWARDED_FOR'])
?  $_SERVER['HTTP_X_FORWARDED_FOR']
:  $_SERVER['REMOTE_ADDR'];
$q=$db->query("SELECT * FROM users WHERE lastip='$IP' AND userid={$_POST['ref']}");
if($db->num_rows($q))
{
die("No creating referral multies. Bad dog.

>[url='register.php']Back[/url]");
}
if($_POST['ref']) {
$q=$db->query("SELECT * FROM users WHERE userid={$_POST['ref']}");
$r=$db->fetch_row($q);
}
$db->query("INSERT INTO users (username, login_name, userpass, level, money, crystals, donatordays, user_level, energy, maxenergy, will, maxwill, brave, maxbrave, hp, maxhp, location, gender, signedup, email, bankmoney, lastip, lastip_signup) VALUES( '{$username}', '{$username}', md5('{$_POST['password']}'), 1, $sm, 0, 0, 1, 12, 12, 100, 100, 5, 5, 100, 100, 1, '{$_POST['gender']}', unix_timestamp(), '{$_POST['email']}', -1, '$IP', '$IP')");
$i=$db->insert_id();
$db->query("INSERT INTO userstats VALUES($i, 10, 10, 10, 10, 10)");

if($_POST['ref']) {
require "global_func.php";
$db->query("UPDATE users SET crystals=crystals+2 WHERE userid={$_POST['ref']}");
event_add($_POST['ref'],"For refering $username to the game, you have earnt 2 valuable crystals!",$c);
$db->query("INSERT INTO referals VALUES('', {$_POST['ref']}, $i, unix_timestamp(),'{$r['lastip']}','$IP')");
}
print "You have signed up, enjoy the game.

> [url='login.php']Login[/url]";
}
}
else
{
if($set['regcap_on'])
{  $chars="123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!?\\/%^";
 $len=strlen($chars);
 $_SESSION['captcha']="";
 for($i=0;$i<6;$i++)
 $_SESSION['captcha'].=$chars[rand(0, $len - 1)];
}

print "<h3>{$set['game_name']} Registration</h3>";
print "<form action=register.php method=post>
<table width='75%' class='table' cellspacing='1'>
<tr>
<td width='30%'><font color="white">Username</font></td>
<td width='40%'><input type=text name=username onkeyup='CheckUsername(this.value);'></td>
<td width='30%'><div id='usernameresult'></div></td>
</tr>
<tr>
<td><font color="white">Password</font></td>
<td><input type=password id='pw1' name=password onkeyup='CheckPasswords(this.value);PasswordMatch();'></td>
<td><div id='passwordresult'></div></td>
</tr>
<tr>
<td><font color="white">Confirm Password</font></td><td><input type=password name=cpassword id='pw2' onkeyup='PasswordMatch();'></td>
<td><div id='cpasswordresult'></div></td>
</tr>
<tr>
<td><font color="white">Email</font></td><td><input type=text name=email onkeyup='CheckEmail(this.value);'></td>
<td><div id='emailresult'></div></td>
</tr>
<tr>
<td><font color="white">Gender</font></td>
<td colspan='2'><select name='gender' type='dropdown'>
<option value='Male'>Male
<option value='Female'>Female</select></td>
</tr>
<tr>
<td><font color="white">Promo Code</font></td><td colspan=2><input type=text name=promo></td>
</tr>

<input type=hidden name=ref value='";
if($_GET['REF']) { print $_GET['REF']; }
print "' />";
if($set['regcap_on'])
{
print "<tr>
<td colspan=3>[img=captcha_verify.php?bgcolor=C3C3C3]

<input type='text' name='captcha' /></td>
</tr>";
}
print "
<tr>
<td colspan=3 align=center><input type=submit value=Submit></td>
</tr>
</table>
</form>

> [url='login.php']Go Back[/url]";
}  ?>

 

Thank you for any help.

Posted

Look at line 100

You are using "white" within print " "; (you've also done this a few times in the lines that follow)

So this is going to create a php error which i thinks is whats stopping the registration from working (may be other stuff as well but start with fixing this). You needed to escape the " within the print " "; (e.g. change: "white" to \"white\" OR use single quotes and change it to 'white')

Let me know if that helps, only read through it and there wasn't much details about the error but think this should fix it ;)

Posted

More help on this is always welcome. Things that could help me for example are:

- a link to the page (so I can test it out myself)

- a line where the code goes wrong if you know that

- any other error message or info we should know about

I could help you with this, but then I want you to pm me the link to this file on your site so I can take a quick look instead of the source as this does not provide the info I would like.

  • 4 weeks later...
Posted

it is probably the right click script u have installed that disables people from right clicking to see ur source codes it is recomended that people dont use them as it just screws things up

try uninstalling the script :thumbup:

wether u have the script in or not we can still see ur source codes

Posted

167 is..

167 - $q=$db->query("SELECT * FROM users WHERE username='{$username}' OR login_name='{$username}'");

 

That is 39 in this code bit I havane posted.

 

Thx.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...