|
| Author |
Message |
Triumvirate
Joined: 24 Feb 2004
Posts: 169
Location: NY, USA
|
Posted: 5/29/2004, 3:18 am Post subject: PHP Script not working |
|
|
I have a file for a registration page but can't get it to work. Hoping someone could point out an error and how to fix it.
| Code: |
<?php
require_once("rpgms_fns.php");
do_html_header($header);
?>
<table class="main" align="center">
<tr>
<td width="15%">
<h2>RPGMS Registration</h2>
</td>
<td width="30%" align="left">
</tr>
<tr>
<td>
All Fields are required.
</td>
</tr>
<tr>
<td>
<form action="register_new.php" method="POST">
Username:</td><td> <input type="text" name="username"></td></tr>
<td>Password:</td><td> <input type="password" name="password"></td></tr>
<td>Confirm Password:</td><td> <input type="password" name="password2"></td></tr>
<td>E-Mail Address:</td><td> <input type="text" name="email"></td></tr>
<td><input type="submit" value="Submit Query"></td>
</form>
</tr>
</table>
<?php
$HTTP_POST_VARS[username];
$HTTP_POST_VARS[password];
$HTTP_POST_VARS[password2];
$HTTP_POST_VARS[email];
do_html_footer($footer);
?>
|
That's the register.php and the script that it's going to is:
| Code: |
<?php
require_once("rpgms_fns.php");
// start the session
session_start();
// check for filled in form
if (!filled_out($HTTP_POST_VARS))
{
do_html_header("Problem:");
echo "You have not filled the form out correctly - please go back"." and try again.";
do_html_footer($footer);
exit;
}
// email address not valid
if (!valid_email($email))
{
do_html_header("Problem:");
echo "That is not a valid email address. Please go back "." and try again.";
do_html_footer();
exit;
}
// passwords the same? or not?
if($password != $password2)
{
do_html_header("Problem:");
echo "The passwords you entered do not match - please go back"." and try again.";
do_html_footer($footer);
exit;
}
// now for password length
if (strlen($password)<6 || strlen($password)>16)
{
do_html_header("Problem:");
echo "Your password must be between 6 and 16 characters."."Please go back and try again.";
do_html_footer($footer);
exit;
}
// now attempt to register...finally
$reg_result = register($username, $email, $password);
if ($reg_result == "true")
{
//register session variable
$valid_user = $username;
session_register("valid_user");
// provide link to member directory
do_html_header("Registration successful");
echo "Your registration was successful. Go to the members page "." to see your character.";
do_HTML_URL("directory.php", "Go to Directory");
}
else
{
// otherwise provide link back, tell them to try again
do_html_header("Problem:");
echo $reg_result;
do_html_footer($footer);
exit;
}
// end page
do_html_footer($footer);
?> |
If you would like to see any other files you think the error could be in tell me, but I'm pretty sure it's there.
Thanks. _________________ GamingMMO.com |
|
| Back to top |
|
 |
Triumvirate
Joined: 24 Feb 2004
Posts: 169
Location: NY, USA
|
Posted: 6/7/2004, 11:34 am Post subject: |
|
|
Just thought of something I actually use the $HTTP_POST_VARS in the same file as I acquire them. I should probably be using them later, in the register_new file since it would make more sense there. I'll try it out and get back. _________________ GamingMMO.com |
|
| Back to top |
|
 |
Karin
Joined: 17 Jun 2004
Posts: 3
|
Posted: 6/17/2004, 10:10 pm Post subject: |
|
|
Not sure what version of PHP you're using but $HTTP_POST_VARS, though it'll probably still work is deprecated. You should use $_POST instead, will also save you a lot of typing  |
|
| Back to top |
|
 |
|