Forum Moderators: coopster

Message Too Old, No Replies

Unknown registration problem

         

dkin

7:39 am on Jun 23, 2005 (gmt 0)

10+ Year Member



For some reason I keep getting errors with my registration form and I do not know why. I have not changed anything.

This is the form.


<form action="process.php" method="POST">
<table align="left" border="1" 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>

This is the function that handles it in process.php


function procRegister(){
global $session, $form;
/* Convert username to all lowercase (by option) */
if(ALL_LOWERCASE){
$_POST['user'] = strtolower($_POST['user']);
}
/* Registration attempt */
$retval = $session->register($_POST['user'], $_POST['pass'], $_POST['email']);

/* Registration Successful */
if($retval == 0){
$_SESSION['reguname'] = $_POST['user'];
$_SESSION['regsuccess'] = true;
header("Location: register.php");
}
/* Error found with form */
else if($retval == 1){
$_SESSION['value_array'] = $_POST;
$_SESSION['error_array'] = $form->getErrorArray();
header("Location: ".$session->referrer);
}
/* Registration attempt failed */
else if($retval == 2){
$_SESSION['reguname'] = $_POST['user'];
$_SESSION['regsuccess'] = false;
header("Location: ".$session->referrer);
}
}

And this registration failed error is what is being returned


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, "
."you may now <a href=\"index.php\">log in</a>.</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.</p>";
}
unset($_SESSION['regsuccess']);
unset($_SESSION['reguname']);
}

mcibor

10:20 pm on Jun 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What is the problem? The code looks fine at the first sight. Does the $session->register() give correct value?

The problem may lie somewhere else.
Write what exactly is happening and someone here may be able to help
Best regards
Michal Cibor

dkin

4:26 am on Jun 24, 2005 (gmt 0)

10+ Year Member



I am getting this error, I dont know why though I didnt touch anything.

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.</p>";

dkin

12:18 am on Jun 25, 2005 (gmt 0)

10+ Year Member



anyone?

vincevincevince

12:20 am on Jun 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try using session_start();

Maybe your old host automatically started sessions and this one doesn't (which is standard).

mcibor

2:27 pm on Jun 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Post the code for function register() in class session. It gives the aforeshown error.

Michal