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
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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