Redirect doesn't working IE and Crome


#1

Hi Guys, can anyone tell me why login only seems to work in Firefox? Please see my login file below.

[php]

<?php //session_start(); INCLUDE_ONCE('connect.php'); ?> Tip Top Music

Tip Top Music

		</ul>
	</nav>

Login Page

<?php

if(!empty($_SESSION[‘LoggIN’])&& !empty($_SESSION[‘Username’]))
{
?>

<?php } elseif(!empty($_POST['username']) && !empty($_POST['password'])) { $username = mysqli_real_escape_string($connection,trim($_POST['username'])); $password = sha1(mysqli_real_escape_string($connection,trim($_POST['password']))); //$password = hash('ripemd128',"$salt1$password$salt2"); //setting up the select query $verifyingLogin = mysqli_query($connection,"SELECT * FROM members WHERE Username = '".$username."' AND Pass_word = '".$password."'"); if(mysqli_num_rows($verifyingLogin) == 1) { $row = mysqli_fetch_array($verifyingLogin); $email = $row['email']; //$_SESSION['MembersID'] = $MembersID; $_SESSION['Username'] = $username; $_SESSION['email'] = $email; $_SESSION['LoggIN'] = 1; echo "

You are successful!

"; echo "

You are being rediected to your members area.

"; echo ""; } else { echo "

We have encountered an error

"; echo "

Sorry! We could not find your account. Please Click here to try again.

"; } } else { ?>
	<p>Welcome You can either logging below, or <a href="registration.php">Please click here to register</a>.</p>
	<form method="POST" action="login.php" name="loginform" id="loginform" autocomplete='on'>
	<table style="padding:50px">
		<tr>
			<td>Username:</td>
			<td> <input type="text" name="username" id="username" required='required'> </td>
		</tr>
		<tr>
		<td>Password:</td>
		<td><input type="password" name="password" id="password" required='required'></td> <br />
		</tr>
		<tr>
		<td><input type="submit" name="login" id="login" value="Login" /></td>
		</tr>
	</table>
	</form>
	<?php
	}
	
	?>

© 2016

Click here to read the assignment report | Click here for the features list

[/php]


#2

I was able to find a solution by using the header function, like [php] header(‘location:name_of_page.php’ )[/php]
i was using [php] …[/php] but this has been deprecated in php and doesn’t work in all browser


#3

OP, Please refer to the responses on your cross-post here http://www.dreamincode.net/forums/topic/407969-member-login-area/