DeveloperCube - PHP Script not working
Rate your favorite (and least favorite) sodas at SodaRatings.com
Username:    Password:
Remember Me?    
PHP Script not working

 
Post new topic   Reply to topic    DeveloperCube Forum Index -> Scripts and Programming
 See a User Guidelines violation? Please contact us.
Author Message

Triumvirate

Joined: 24 Feb 2004
Posts: 169
Location: NY, USA

PostPosted: 5/29/2004, 3:18 am    Post subject: PHP Script not working Reply with quote

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

PostPosted: 6/7/2004, 11:34 am    Post subject: Reply with quote

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

PostPosted: 6/17/2004, 10:10 pm    Post subject: Reply with quote

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 Smile
Back to top
Display posts from previous:   
Post new topic   Reply to topic    DeveloperCube Forum Index -> Scripts and Programming All times are GMT
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Links: Programming Forum - Art Schools Online

Network: iFroggy Network Blog - iFroggy Hosting - SportsForums.net - KarateForums.com - YanksBlog.com - phpBBHacks.com - PhotoshopForums.com - Managing Online Forums - ManagingCommunities.com - CommunityAdmins.com - DrGregHouse.com - Bad Boy Blog - SodaRatings.com - Patrick O'Keefe

We Support phpBBHacks.com. Forum Icons by Daz. Privacy Policy. Powered by phpBB © phpBB Group. phpBB SEO.
Copyright © 2003-2009. DeveloperCube, iFroggy Network. All Rights Reserved.

Advertising   Contact   Links   Link To Us   Staff   User Guidelines