Jump to content

Recommended Posts

I made a register and login page and scripts and tested them and it works great in firefox(after help here;-). I then tested the pages in Internet Explorer and after clicking the submit button on the register page IE just outputs a blank white page. In the address bar it seems to be the php page with the form submitting php script- which is supposed to use header redirect to the next page..the login page and no data from the registration form is sent to the database. I don't understand why.

Link to comment
https://forums.phpfreaks.com/topic/179870-works-firefox-white-page-ie/
Share on other sites

Ok sorry...I was hoping it would be something simple and common and easily fixable.

 

My registration script:

<?php
// Connect to Database 
$con = mysql_connect("localhost","username","password");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

//If form is submitted this runs
if (isset ($_POST['register'])) {

//Check for empty form fields
if (!$_POST['fname'] || !$_POST['sname'] || !$_POST['email'] || !$_POST['loginname'] ||
!$_POST['loginpwd'] || !$_POST['loginpwd2']) {
die('You did not complete all of the required fields');
}

//Check checkbox here
if (!isset ($_POST['check'])) 
{
die('You did not agree to our terms');
}

//Check if login name taken 
mysql_select_db("db_name", $con);
$potential = mysql_real_escape_string($_POST['loginname']);
$result = mysql_num_rows(mysql_query("SELECT * FROM members WHERE loginname = '$potential'"));

if ($result > 0 ) {
die ('Your desired username '.$potential.' is already taken - please choose another.');
}


//Check if email already registered
mysql_select_db("db_name", $con);
$email = mysql_real_escape_string($_POST['email']);
$emailexist = mysql_num_rows(mysql_query("SELECT * FROM members WHERE email='$email'"));
if ($emailexist > 0) {
die ('That email address is already registered.');
}

//Check passwords match
$pwd1 = mysql_real_escape_string($_POST['loginpwd']);
$pwd2 = mysql_real_escape_string($_POST['loginpwd2']);
if ( $pwd1 != $pwd2 ) {
die ('Your passwords do not match.');
}

//Check password is alphanumeric
$alphanumeric = mysql_real_escape_string($_POST['loginpwd']);
if (!ctype_alnum($alphanumeric)){
die('Your password must only contain letters and numbers');
}

//Check password length
$password = mysql_real_escape_string($_POST['loginpwd']);
if (strlen($password) < 5 || strlen($password) >10)
{die('Your password must be between 5 and 10 characters in length');}

// Protect against mysql injection
$_POST['loginname'] = mysql_real_escape_string($_POST['loginname']);
$_POST['fname'] = mysql_real_escape_string($_POST['fname']);
$_POST['sname'] = mysql_real_escape_string($_POST['sname']);
$_POST['email'] = mysql_real_escape_string($_POST['email']);




//Encrypt passwords and insert to database
$_POST['loginpwd'] = md5(mysql_real_escape_string($_POST['loginpwd']));
mysql_query("INSERT INTO members (fname, sname, email, loginname, loginpwd) VALUES ('$_POST[fname]', '$_POST[sname]', '$_POST[email]', '$_POST[loginname]', '$_POST[loginpwd]')");

//redirect
header('Location: http://192.168.0.8/registered.php');

//close database
}

mysql_close($con);
?>

 

As I say it works in firefox and takes me to registered.php. In IE it just outputs a white page and nothing goes to the database.

I'm fairly sure though definitely not 100% because I am relatively new to php. The reason is because my registration page has a require function that pulls up a php file containing the form which then uses another php file (the one above) which performs the form actions. The form loads okay onto the page and I have looked at the php file containing it and it looks ok to me.

 

<form action="registerscript.php" method="post">
<br />
First Name :<br />
<input type="text" class="tb" name="fname" maxlength="30"   /><br /><br />
Last Name  :<br />
<input type="text" class="tb" name="sname"  maxlength="30"  /><br /><br />
Contact Email :<br /> 
<input type="text" class="tb" name="email"  maxlength="60" /><br /><br />
Desired Username :<br />
<input type="text" class="tb"  name="loginname" maxlength="30" /><br /><br />
Password :<br />
<font size="1">(5-10 alphanumeric characters)</font><br />
<input  type="password" class="tb" name="loginpwd" maxlength="10"/><br /><br/>
Verify Password :<br /> 
<input type="password" class="tb" name="loginpwd2" maxlength="10" /><br /><br />
I agree to the terms <input type="checkbox" class="cb" name="check" value="agree"  /><br />
<a href="terms.php" alt="Terms" target="_blank">Terms</a><br/><br />
<input type="image" src="images/register.png" name="register" value="Register" alt="Register Button" /><br /><br />
</form>

 

The webpages are at http://shadowthieves.110mb.com/register.php so you can see yourself what happens in each browser. The site is unfinished.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.