not taken to second page

i enter any information into this form and I am not taken to the next page

is there something wrong with my php 5.2.17 windows server 2008 iis7 (fastcgi or cgi)  installation
<?php
//ob_start();
//require_once('inc/common.php');
 

if(isset($_POST['username'])) {
	$username = $_POST['username'];

		$username = $_POST['username'];
		$password = $_POST['password'];

		
		//if(validateLogin($username, $password)) {

			$_SESSION['name'] = 'name';
			$_SESSION['last'] = 'last';
			$_SESSION['login'] = 'login';
			$_SESSION['userid'] = 'userid';
			$_SESSION['olduserid'] = 'olduserid';
			$_SESSION['permissions'] = explode(",",'permissions');
			$_SESSION['loggedin'] = 1;
			$_SESSION['emailaccount'] = 'email';
			$_SESSION['extension'] = 'extension';
			
			$ipaddress = $_SERVER['REMOTE_ADDR'];		
      
			//$password = encrypt($password);
			
			
			$url = 'http://www.google.com';
            
            
            echo'
<script type="text/javascript">
<!--
window.location = "'.$url.'"
//-->
</script>   
';
            
            
            
            
			header('Location: '.$url);

		//}//end validatelogin 
}

else {
	echo '
	<html>
	<head>
		<title>Login</title>
	</head>
	<body class="login">




	<form name="loginform" id="loginform" action="login.php" method="post">
		<p>
			<label>Username:<br />
			<input type="text" name="username" id="user_login" class="input" value="" size="20" tabindex="10" /></label>
		</p>
		<p>
			<label>Password:<br />
			<input type="password" name="password" id="user_pass" class="input" value="" size="20" tabindex="20" /></label>
		</p>

		<p class="submit">
			<input type="submit" name="wp-submit" id="wp-submit" value="Login &raquo;" tabindex="100" />
		</p>';
		echo '
	</form>
		
	</body>
	</html>';	
}


function validateLogin($user,$pass) {
    return true;
}







?>

Open in new window

LVL 1
rgb192Asked:
Who is Participating?
 
Ray PaseurCommented:
You might want to try something like the design pattern illustrated in this article.  I am fairly sure it works.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_2391-PHP-login-logout-and-easy-access-control.html
0
 
VampireofdarknessCommented:
I haven't tested, but:

1. Line 36, add a ; to terminate the line.
2. Move header above any output (ie- the echo at line 33. See: http://php.net/manual/en/function.header.php
0
 
ansudhindraCommented:
instead of
window.location = "'.$url.'"

try
window.location.href = "'.$url.'";
0
 
rgb192Author Commented:
I added the javascript redirect, because I was getting 500 error.
I dont know what the error is
0
 
rgb192Author Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.