Jump to content

[SOLVED] Browser hangs when php script is loaded


wikedawsum

Recommended Posts

Hello all. New to the forums and new to PHP as well. I have set up a registration form for users to register for a member's only website. When the user fills out their information and hits submit, it is set up to run my register_new.php file. The problem I'm having is that when the submit button is clicked, the register_new.php file starts to load, but causes the browser to hang and ends up Not Responding. I am following examples from the PHP and MySQL Web Development book by Luke Welling.. trying to learn how to do this properly. I have understood everything up until now, but cannot for the life of me figure out why this one page causes the browser to hang. Wondering if anyone can provide an explanation, or a step in the right direction.

The register_new.php file looks like this:

[code]<?php

require_once('tokens_fns.php');

$fname=$_POST['fname'];
$lname=$_POST['lname'];
$cname=$_POST['cname'];
$email=$_POST['email'];
$username=$_POST['username'];
$passwd=$_POST['passwd'];
$passwd2=$_POST['passwd2'];

session_start();

try
{
  if (!filled_out($_POST))
    {
      throw new Exception('You have not filled the form out correctly '
.'- please go back and try again.');
    }
  if (!valid_email($email))
    {
      throw new Exception('That is not a valid email address. Please go back'
.' and try again.');
    }
  if ($passwd != $passwd2)
    {
      throw new Exception('The passwords you entered do not match.'
.'Please go back and try again.');
    }
  if (strlen($username)>16)
    {
      throw new Exception('Your username must be no longer than 16 characters.'
  . 'Please go back and try again.');
    }

  register($fname, $lname, $cname, $email, $username, $passwd);
  $_SESSION['valid_user'] = $username;

  do_html_header('Registration Successful');
  echo 'Your registration was successful. You may now login.';
  do_html_url('members.php', 'Go to the member website');
  do_html_footer();
}

catch (Exception $e)
{
  do_html_header('Problem:');
  echo $e->getMessage();
  do_html_footer();
  exit;
}

?>[/code]

I'm not sure if it is actually this file that is causing the problem, or if the problem lies somewhere else. I can provide more information if needed. Hopefully I've explained the problem well enough. If needed, you may access the registration form here: http://test.aacapartsandsupplies.com/members/register.php.

Any help is appreciated. Thank you.
If you have 'tokens_fns.php' placed in the right place, everything looks fine to me, i believe is the session which is causing the problem, but I am not sure, because I also had a problem like this in my previous login page, so try removing the session and see if the page loads better, then you will be definite with the problem.
Ted

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.