Jump to content

Unexpexted "\" on line 2


tomfmason

Recommended Posts

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.
[code]<?php
header('Location: http://www.owpt.biz/account.php?'.SID');
?>[/code]

I use the following login script
[code]<?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.";
}
?>[/code]

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.
Link to comment
https://forums.phpfreaks.com/topic/13744-unexpexted-on-line-2/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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