Jump to content

REGISTER.PHP


morbidangel

Recommended Posts

Can someone please help me figure out why users can not register to my database.

 

<!doctype html public "-//W3C//DTD HTML 3.2//EN">

<html>

 

<head>

<meta http-equiv="Content-Type" content="text/html;CHARSET=iso-8859-1">

<title>bloodthugz, where you decide everyones fate.</title>

</head>

 

<body text="#FFFFFF" bgcolor="#000000" link="#808080" alink="#808080" vlink="#808080" marginheight="0" marginwidth="0" topmargin=0 leftmargin=0>

 

<form action="register.php?case=1" method="POST" enctype="application/x-www-form-urlencoded">

<p>

<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">

<tr>

<td width="254" valign="BOTTOM" bgcolor="white"><img src="registration.gif" width="250" height="600" align="BOTTOM" border="0"></td>

<td width="100%" valign="MIDDLE">

<center>

<p>

<table border="0" width="75%">

<tr>

<td width="50%"><img src="head.registration.gif" width="130" height="22" align="BOTTOM" border="0"></td>

<td width="50%" valign="TOP"> </td>

</tr>

<tr>

<td width="50%"> </td>

<td width="50%"> </td>

</tr>

<tr>

<td valign="TOP" colspan="2"><b><font size="2" face="Verdana, Arial, Helvetica">welcome to realthugz</font></b><font size="2" face="Verdana, Arial, Helvetica">

this is a turn-based strategy game for those that want to beat the crap out of each other, control the streets,

collect protection money, dominate a city or country, create a cartel to strengthen yourself and much more!<br>

<br>

this game is great fun for all, and can be very easy to becoming very complicated, but you make it as fun as you

want it to be!<br>

<br>

</font><b><font size="2" face="Verdana, Arial, Helvetica">In order to play this game you must fill out the form

below!<? if ($userchk == 1) { echo "<br><br>The username " . $username . " has already been taken, please try another."; } ?></font></b></td>

</tr>

<tr>

<td width="50%"> </td>

<td width="50%"> </td>

</tr>

<tr>

<td width="50%">

<p align="RIGHT"><font size="1" face="Verdana, Arial, Helvetica"><? if ($userchk == 1) { echo "*"; } ?>username:</font>

</td>

<td width="50%"><input type="TEXT" name="username" size="12" style="Font-Family : Verdana, Arial, Helvetica ; Font-Size : 8pt" value="<? echo stripslashes($username)?>"></td>

</tr>

<tr>

<td width="50%">

<p align="RIGHT"><font size="1" face="Verdana, Arial, Helvetica"><? if ($userchk == 1) { echo "*"; } ?>password:</font>

</td>

<td width="50%"><input type="TEXT" name="password" size="12" style="Font-Family : Verdana, Arial, Helvetica ; Font-Size : 8pt" value="<? echo stripslashes($password)?>"></td>

</tr>

 

<tr>

<td width="50%">

<p align="RIGHT"><font size="1" face="Verdana, Arial, Helvetica">city to start from:</font>

</td>

<td width="50%">

<select name="city" style="Font-Family : Verdana, Arial, Helvetica ; Font-Size : 8pt">

<?

if ($city) {

$sqla2b = "SELECT state from og_state where id=$city";

@mysql_connect($dbhost,  $dbuser,  $dbpass);

@mysql_select_db($dbname) or die("Error opening database");

 

$resulta2b = @mysql_query($sqla2b);

$myrowa2b = @mysql_fetch_array($resulta2b);

?>

<option value="<? echo stripslashes($city)?>"><?echo $myrowa2b[state] ?></option>

<?

}

$sqla2 = "SELECT * from og_state";

@mysql_connect($dbhost,  $dbuser,  $dbpass);

 

@mysql_select_db($dbname) or die("Error opening database");

 

$resulta2 = @mysql_query($sqla2);

$myrowa2 = @mysql_fetch_array($resulta2);

 

do {

?>

<option value="<? echo $myrowa2[id] ?>"><? echo $myrowa2[state] ?></option>

<?

} while ($myrowa2 = @mysql_fetch_array($resulta2));

?>

</select></td>

</tr>

<tr>

<td width="50%">

<p align="RIGHT"><font size="1" face="Verdana, Arial, Helvetica">name:</font>

</td>

<td width="50%"><input type="TEXT" name="name" size="12" style="Font-Family : Verdana, Arial, Helvetica ; Font-Size : 8pt" value="<? echo stripslashes($name)?>"></td>

</tr>

<tr>

<td width="50%">

<p align="RIGHT"><font size="1" face="Verdana, Arial, Helvetica">age:</font>

</td>

<td width="50%"><input type="TEXT" name="age" size="12" style="Font-Family : Verdana, Arial, Helvetica ; Font-Size : 8pt" value="<? echo stripslashes($age)?>"></td>

</tr>

<tr>

<td width="50%">

<p align="RIGHT"><font size="1" face="Verdana, Arial, Helvetica">gender:</font>

</td>

<td width="50%"><input type="TEXT" name="gender" size="12" style="Font-Family : Verdana, Arial, Helvetica ; Font-Size : 8pt" value="<? echo stripslashes($gender)?>"></td>

</tr>

<tr>

<td width="50%">

<p align="RIGHT"><font size="1" face="Verdana, Arial, Helvetica">hometown:</font>

</td>

<td width="50%"><input type="TEXT" name="hometown" size="12" style="Font-Family : Verdana, Arial, Helvetica ; Font-Size : 8pt" value="<? echo stripslashes($hometown)?>"></td>

</tr>

<tr>

<td width="50%">

<p align="RIGHT"><font size="1" face="Verdana, Arial, Helvetica">email:</font>

</td>

<td width="50%"><input type="TEXT" name="email" size="12" style="Font-Family : Verdana, Arial, Helvetica ; Font-Size : 8pt" value="<? echo stripslashes($email)?>"></td>

</tr>

<tr>

<td width="50%"> </td>

<td width="50%"><input type="IMAGE" src="button.register.gif" width="83" height="23" align="BOTTOM" border="0"></td>

</tr>

</table></center>

</td>

</tr>

</table>

</form>

 

</body>

</html>

Link to comment
Share on other sites

added 'code' tags for readablility

<!doctype html public "-//W3C//DTD HTML 3.2//EN">
<html>

<head>
   <meta http-equiv="Content-Type" content="text/html;CHARSET=iso-8859-1">
   <title>bloodthugz, where you decide everyones fate.</title>
</head>

<body text="#FFFFFF" bgcolor="#000000" link="#808080" alink="#808080" vlink="#808080" marginheight="0" marginwidth="0" topmargin=0 leftmargin=0>

<form action="register.php?case=1" method="POST" enctype="application/x-www-form-urlencoded">
<p>
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
   <tr>
      <td width="254" valign="BOTTOM" bgcolor="white"><img src="registration.gif" width="250" height="600" align="BOTTOM" border="0"></td>
      <td width="100%" valign="MIDDLE">
         <center>
         <p>
         <table border="0" width="75%">
            <tr>
               <td width="50%"><img src="head.registration.gif" width="130" height="22" align="BOTTOM" border="0"></td>
               <td width="50%" valign="TOP"> </td>
            </tr>
            <tr>
               <td width="50%"> </td>
               <td width="50%"> </td>
            </tr>
            <tr>
               <td valign="TOP" colspan="2"><b><font size="2" face="Verdana, Arial, Helvetica">welcome to realthugz</font></b><font size="2" face="Verdana, Arial, Helvetica">
                   this is a turn-based strategy game for those that want to beat the crap out of each other, control the streets,
                  collect protection money, dominate a city or country, create a cartel to strengthen yourself and much more!<br>
                  <br>
                  this game is great fun for all, and can be very easy to becoming very complicated, but you make it as fun as you
                  want it to be!<br>
                  <br>
                  </font><b><font size="2" face="Verdana, Arial, Helvetica">In order to play this game you must fill out the form
                  below!<? if ($userchk == 1) { echo "<br><br>The username " . $username . " has already been taken, please try another."; } ?></font></b></td>
            </tr>
            <tr>
               <td width="50%"> </td>
               <td width="50%"> </td>
            </tr>
            <tr>
               <td width="50%">
                  <p align="RIGHT"><font size="1" face="Verdana, Arial, Helvetica"><? if ($userchk == 1) { echo "*"; } ?>username:</font>
               </td>
               <td width="50%"><input type="TEXT" name="username" size="12" style="Font-Family : Verdana, Arial, Helvetica ; Font-Size : 8pt" value="<? echo stripslashes($username)?>"></td>
            </tr>
            <tr>
               <td width="50%">
                  <p align="RIGHT"><font size="1" face="Verdana, Arial, Helvetica"><? if ($userchk == 1) { echo "*"; } ?>password:</font>
               </td>
               <td width="50%"><input type="TEXT" name="password" size="12" style="Font-Family : Verdana, Arial, Helvetica ; Font-Size : 8pt" value="<? echo stripslashes($password)?>"></td>
            </tr>

            <tr>
               <td width="50%">
                  <p align="RIGHT"><font size="1" face="Verdana, Arial, Helvetica">city to start from:</font>
               </td>
               <td width="50%">
               <select name="city" style="Font-Family : Verdana, Arial, Helvetica ; Font-Size : 8pt">
               <?
                     if ($city) {
                     $sqla2b = "SELECT state from og_state where id=$city";
                     @mysql_connect($dbhost,  $dbuser,  $dbpass);
                     @mysql_select_db($dbname) or die("Error opening database");

                     $resulta2b = @mysql_query($sqla2b);
                     $myrowa2b = @mysql_fetch_array($resulta2b);
               ?>
               <option value="<? echo stripslashes($city)?>"><?echo $myrowa2b[state] ?></option>
               <?
                     }
                     $sqla2 = "SELECT * from og_state";
                     @mysql_connect($dbhost,  $dbuser,  $dbpass);

                     @mysql_select_db($dbname) or die("Error opening database");

                     $resulta2 = @mysql_query($sqla2);
                     $myrowa2 = @mysql_fetch_array($resulta2);
                     
                     do {
                     ?>
                     <option value="<? echo $myrowa2[id] ?>"><? echo $myrowa2[state] ?></option>
                     <?
                     } while ($myrowa2 = @mysql_fetch_array($resulta2));
               ?>
               </select></td>
            </tr>
            <tr>
               <td width="50%">
                  <p align="RIGHT"><font size="1" face="Verdana, Arial, Helvetica">name:</font>
               </td>
               <td width="50%"><input type="TEXT" name="name" size="12" style="Font-Family : Verdana, Arial, Helvetica ; Font-Size : 8pt" value="<? echo stripslashes($name)?>"></td>
            </tr>
            <tr>
               <td width="50%">
                  <p align="RIGHT"><font size="1" face="Verdana, Arial, Helvetica">age:</font>
               </td>
               <td width="50%"><input type="TEXT" name="age" size="12" style="Font-Family : Verdana, Arial, Helvetica ; Font-Size : 8pt" value="<? echo stripslashes($age)?>"></td>
            </tr>
            <tr>
               <td width="50%">
                  <p align="RIGHT"><font size="1" face="Verdana, Arial, Helvetica">gender:</font>
               </td>
               <td width="50%"><input type="TEXT" name="gender" size="12" style="Font-Family : Verdana, Arial, Helvetica ; Font-Size : 8pt" value="<? echo stripslashes($gender)?>"></td>
            </tr>
            <tr>
               <td width="50%">
                  <p align="RIGHT"><font size="1" face="Verdana, Arial, Helvetica">hometown:</font>
               </td>
               <td width="50%"><input type="TEXT" name="hometown" size="12" style="Font-Family : Verdana, Arial, Helvetica ; Font-Size : 8pt" value="<? echo stripslashes($hometown)?>"></td>
            </tr>
            <tr>
               <td width="50%">
                  <p align="RIGHT"><font size="1" face="Verdana, Arial, Helvetica">email:</font>
               </td>
               <td width="50%"><input type="TEXT" name="email" size="12" style="Font-Family : Verdana, Arial, Helvetica ; Font-Size : 8pt" value="<? echo stripslashes($email)?>"></td>
            </tr>
            <tr>
               <td width="50%"> </td>
               <td width="50%"><input type="IMAGE" src="button.register.gif" width="83" height="23" align="BOTTOM" border="0"></td>
            </tr>
         </table></center>
      </td>
   </tr>
</table>
</form>

</body>
</html>

Link to comment
Share on other sites

are you getting any errors?

 

one thing im seeing

@mysql_connect($dbhost,  $dbuser,  $dbpass);

 

doesnt need the '@'

 

im not good with oop, but i believe @ is an OOP only thing, and the function mysql_connect is not OO

 

also change all instances of <? into <?php

some servers dont read short tags

 

Thanks forgot.  That is the inc.register.php do I need the just register.php?

what?

Link to comment
Share on other sites

Well here is the register.php file. Please help ive been trying to get this game up for some time now.

 

 

<?

require ('inc.settings.php');

 

        if ($uid == "") {

            $uid = md5(uniqid(rand()));

        }

        $name = addslashes($name);

        $age = addslashes($age);

        $gender = addslashes($gender);

        $hometown = addslashes($hometown);

        $email = addslashes($email);

        $username = addslashes($username);

        $pid = md5(uniqid(rand()));

        $password = addslashes($password);

        $city = addslashes($city);

        $created = date('Y-m-d');

 

        $sqla = "SELECT count(*) from og_userinfo where username='$username'";

        @mysql_connect($dbhost,  $dbuser,  $dbpass);

        @mysql_select_db($dbname) or die("Error opening database");

 

        $resulta = @mysql_query($sqla);

        $myrowa = @mysql_fetch_array($resulta);

       

        if (($myrowa[0] == 0) && ($case == 1)) {

 

        $turns = 500;

        $money = 50000;

        $prostitutes = 4;

        $condoms = 20000;

        $crackrocks = 10000;

        $smack = 10000;

        $thugs = 10;

        $beer = 3000;

        $hondas = 5;

        $cadillacs = 0;

        $mercedes = 0;

        $bmws = 0;

        $glocks = 10;

        $tek9s = 0;

        $uzis = 0;

        $aks = 10;

        $kevlar = 100;

        $informants = 5;

        $dealers = 2;

        $pros_happiness = 1;

        $thugs_happiness = 1;

       

        $sql = "INSERT into og_userinfo (name, age, gender, hometown, email, username, password, state, turns, money, prostitutes, condoms, kevlar, crackrocks, smack, thugs, beer, hondas, cadillacs, mercedes, bmws, glocks, tek9s, uzis, aks, informants, dealers, pros_happiness, thugs_happiness, created, uid) values ('$name', '$age', '$gender', '$hometown', '$email', '$username', '$password', $city, $turns, $money, $prostitutes, $condoms, $kevlar, $crackrocks, $smack, $thugs, $beer, $hondas, $cadillacs, $mercedes, $bmws, $glocks, $tek9s, $uzis, $aks, $informants, $dealers, $pros_happiness, $thugs_happiness, '$created', '$uid')";

        @mysql_connect($dbhost,  $dbuser,  $dbpass);

        @mysql_select_db($dbname) or die("Error opening database");

 

        $result = @mysql_query($sql);

       

        $sqlid = "SELECT id from og_userinfo where username='$username'";

        @mysql_connect($dbhost,  $dbuser,  $dbpass);

        @mysql_select_db($dbname) or die("Error opening database");

 

        $resultid = @mysql_query($sqlid);

        $myrowid = @mysql_fetch_array($resultid);

 

        $userid = $myrowid[id];

        $sqlb = "INSERT INTO og_userstats (thugskilled, thugslost, thugsleft, dealersleft, informantsleft, prosstolen, proslost, proskilled, prosleft, hondasstolen, hondaslost, cadillacsstolen, cadillacslost, bmwsstolen, bmwslost, mercedesstolen, mercedeslost, userid, id) VALUES ('0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00',$userid,NULL)";

 

        @mysql_connect($dbhost,  $dbuser,  $dbpass);

        @mysql_select_db($dbname) or die("Error opening database");

 

        $resultb = @mysql_query($sqlb);

       

        $message = "Welcome " . $username . ", to bloodthugz.\r\n\r\nIn this game, you are the head thug and you can do whatever you want to get to the top!\r\n(or you can be gun fodder, your choice)...\r\n\r\nYour username is: " . $username . "\r\nYour password is: " . $password . "\r\n\r\nnHave fun!\r\n\r\nbloodthugz";

        $subject = "Welcome to the bloodthugz";

        $headers  = "MIME-Version: 1.0\r\n";

        $headers .= "Content-Type: text/plain; charset=iso-8859-1\r\n";

        $headers .= "From: bloodthugz\r\n";

        $recipient_email = $email;

        mail($recipient_email, $subject,$message,$headers);

 

        require('inc.registered.php');

 

        } else {

        $userchk = 1;

        require('inc.register.php');

        }

?>[/i]

Link to comment
Share on other sites

try changing

$sqla = "SELECT count(*) from og_userinfo where username='$username'";

to

$sqla = "SELECT count(*) from og_userinfo where username=$username";

 

single quotes shouldnt be neccesary and are probably making the variable interpret literally

$sqla = "SELECT count(*) from og_userinfo where username='$username'";

is the same as

$sqla = "SELECT count(*) from og_userinfo where username=$username";

 

where

$sqla = "SELECT count(*) from og_userinfo where username=$username";

is the same as

$sqla = "SELECT count(*) from og_userinfo where username=morbidangel";

 

try taking off the single quotes all over the place, in all your queries

 

// use code tags

Link to comment
Share on other sites

no,

 

my advice would be to get a book about php, possibly about game design within php, If you say you arent good in php but you want to get a php game going, and you are having trouble on the registration page, then think of all the problems you are going to have when you get into thinks like randomizing how much beer you consume in a sitting

 

your pages are in dissaray and really dont make a lot of sense... a good book could help you a lot, from what I see on these 2 code samples there is a long way to go until this registration system works. If you came here expecting a quick fix, its not going to happen with what we have been given

Link to comment
Share on other sites

no,

 

my advice would be to get a book about php, possibly about game design within php, If you say you arent good in php but you want to get a php game going, and you are having trouble on the registration page, then think of all the problems you are going to have when you get into thinks like randomizing how much beer you consume in a sitting

 

your pages are in dissaray and really dont make a lot of sense... a good book could help you a lot, from what I see on these 2 code samples there is a long way to go until this registration system works. If you came here expecting a quick fix, its not going to happen with what we have been given

 

But see I changed everything from single quotes and now I  get nothing but errors.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

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.