Jump to content


Photo

Unexpexted "\" on line 2


  • Please log in to reply
3 replies to this topic

#1 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 05 July 2006 - 03:33 PM

This is a very simple script. I have had all sorts of trouble with createing a login script but so far nothin has worked. Here is the simple script in question. This is the script that I get the error with.
<?php
header('Location: http://www.owpt.biz/account.php?'.SID');
?>

I use the following login script
<?php
session_start();

header("Cache-control: private");

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

include("db.php");

$sql_user_check = "SELECT username FROM users WHERE username='$user'";
$result_name_check = mysql_query($sql_user_check) or die(mysql_error());
$usersfound = mysql_num_rows($result_name_check) or die(mysql_error());


if($usersfound < 1){
	$error = "User ".$user." was not found in the database.";

		$user = $_POST['username'];
		$pass = md5($_POST['password']);
		$sql = "select * from users where `username` = '$user'";
		$result = mysql_query($sql);
		while ($text = mysql_fetch_array($result)) {
			$id = $text['id'];
			$password = $text['encrytpass'];
			$access = $text['access'];
		}
		if ($pass == $password) {
			$error = "Wrong Username / Password <a href=\"../index.php\">Back</a>";
	
	}else{
		$_SESSION['username'] = $user_info['username'];
	}
}

if(!$_SESSION['username']){
	if($error){
		echo $error;
		include("index.php");
	}else{
      include("header.php");
	  }
    }else{
		echo "<html><head><title>Welcomce Back</title></head>Welcome back ". $_SESSION['username'] .".<a href=index.php>Click here</a> to proceed."; 
	}
?>

I am wanting to pass the session id to account.php and at the same time hide the backend login process. I have tried several ways to acheive this.

I was also thinking, for security reasons I should maybe through in another session_start() in the header.php. Any suggestions would be great.

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#2 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 05 July 2006 - 03:42 PM

<?php
header('Location: http://www.owpt.biz/account.php?.SID');
?>

try

<?php
header('Location: http://www.owpt.biz/account.php?'.SID);
?>


you had a ' after SID

Regards
Liam
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge

#3 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 05 July 2006 - 03:49 PM

Thanks but now I get the standard header error. I think I will try a javascript do I need to pass the SID when I do this javascript?

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#4 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 05 July 2006 - 04:29 PM

You don't really need to pass the SID when your using sessions unless your specifically targetting users who disable cookies.

Also, there are better workarounds for header area's the resorting to javascript. read the sticky at the top of this forum.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users