I dont advise the use of javascript.. I suggest using the php header function..
Code:
header("Location: http://google.com");
Try this:
Code:
<?
$user = $_GET['user'];
session_start();
if(!isset($_SESSION['user'])){
header("Location: http://thenewprogrammer.x10hosting.com");
}
$dbhost = "localhost";
$dbname = "*****";
$dbuser = "*****";
$dbpass = "*****";
mysql_connect($dbhost, $dbuser, $dbpass) or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die("Could not select the database: ".mysql_error());
$username = mysql_real_escape_string($user);
$query = "SELECT * FROM login WHERE username ='".$username."'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
?>
<html>
<head>
User Profile
</head>
<body>
<?php echo($username); ?>
<br />
<?php print_r($row); ?>
</body>
</html>
I'm not sure if it will work.. I usually do trial and error.. I stripped characters to prevent SQL Injection btw.. heh