Jump to content

Login System Help Needed.


penguinluvinman

Recommended Posts

Me and a few friends are attempting to design a login system for an MMOTBG we hope to make in the future.  We are having some problems with the code.  All the pages come up and look fine, but when you enter the informaiton to sign up and click submit, the page goes blank.  Wehn you click back it goes to the registration error page.  I believe something is making it show the registration page, but redirect really fast before it is displayed, or something to that effect.  The code for the page that I believe to be the error page is below.  The page can be found at http://highwayunderground.com/penguin

Any help you can give would be greatly appreciated!

 

P.S.  I'm fairly new with PHP, so I comment pretty much every line so I know what it does and don't confuse myself (I'm a n00b).

 

<?

include("session.php");

?>

 

<html>

<title>Registration Page</title>

<body>

 

<?

/**

* The user is already logged in, not allowed to register.

*/

if($session->logged_in){

   echo "<h1>Registered</h1>";

   echo "<p>We're sorry but<b>$session->username</b>, is taken.</p>";

}

/**

* The user has submitted the registration form and the

* results have been processed.

*/

else if(isset($_SESSION['regsuccess'])){

   /* Registration was successful */

   if($_SESSION['regsuccess']){

      echo "<h1>Registered!</h1>";

      echo "<p>Thank you <b>".$_SESSION['reguname']."</b>, your information has been added to the database.</p>";

   }

   /* Registration failed */

   else{

      echo "<h1>Registration Failed</h1>";

      echo "<p>We're sorry, but an error has occurred and your registration for the username <b>".$_SESSION['reguname']."</b> could not be completed.<br>Please try again at a later time.<br><br><b>*If you are seeing this page for the second time click refresh.</b></p>";

   }

   unset($_SESSION['regsuccess']);

   unset($_SESSION['reguname']);

}

/**

* The user has not filled out the registration form yet.

* Below is the page with the sign-up form, the names

* of the input fields are important and should not

* be changed.

*/

else{

?>

 

<h1>Register</h1>

<?

if($form->num_errors > 0){

   echo "<td><font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font></td>";

}

?>

<form action="process.php" method="POST">

<table align="left" border="0" cellspacing="0" cellpadding="3">

<tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>

<tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>

<tr><td>Email:</td><td><input type="text" name="email" maxlength="50" value="<? echo $form->value("email"); ?>"></td><td><? echo $form->error("email"); ?></td></tr>

<tr><td colspan="2" align="right">

<input type="hidden" name="subjoin" value="1">

<input type="submit" value="Join!"></td></tr>

<tr><td colspan="2" align="left"><a href="index.php">Back to Main</a></td></tr>

</table>

</form>

 

<?

}

?>

 

</body>

</html>

 

Link to comment
https://forums.phpfreaks.com/topic/70281-login-system-help-needed/
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.