Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1
    Join Date
    Apr 2006
    Posts
    1,463

    Latest Awards:

    Tokens
    0

    Default UserSystem Problem

    Ok on the login im getting this link:
    http://habbishfm.com/user/User/login.php

    Code:
    Parse error:  syntax error, unexpected ':' in /home/habbish/public_html/user/User/login.php on line 8
    
    and my DB Config
    Code:
    <?php
    mysql_connect("localhost", "habbish_user", "*****") or die(mysql_error()); // connects to the mysql db or outputs an error
    mysql_select_db("habbish_user") or die(mysql_error()); // selects the database from the choosen serve or outputs an error
    ?>
    Apparently andy says its your cpanel pass for the habbish_user part but it isisn't right and why am I getting that error


    ALSO here is the login.php
    Code:
    <?php
    require_once "dbconfig.php"; // include the database information
    $sql = mysql_query("SELECT * FROM users WHERE username='".addslashes($_POST['username'])."'") or die("username was in correct. MySQL said".mysql_error()); // this checks to see if the username exists
    $result = mysql_fetch_array($sql); // puts the database information into an array
    
    if($result[’password’] == sha1($_POST[’password’])) { // if the passwords match
    session_start(); // start the session
    header(”Cache-control: private”);
    $_SESSION[”sessioname”] = $_POST[’username’];
    header(”location: protected.php”);
    }else{
    echo “Incorrect login details please try again.”;
    }
    
    ?>
    Last edited by Rockstar; 03-11-2007 at 09:43 PM.

  2. #2
    Join Date
    Feb 2006
    Location
    Sunderland
    Posts
    5,027

    Latest Awards:

    Tokens
    1,306

    Default

    I've told you, the error has nothing to do with the databse. It's a simple error in the login.php file.


  3. #3
    Join Date
    Apr 2006
    Posts
    1,463

    Latest Awards:

    Tokens
    0

    Default

    Quote Originally Posted by Andy™ View Post
    I've told you, the error has nothing to do with the databse. It's a simple error in the login.php file.
    Yeh , your probelly right but Im waiting to see if anyone says anything.

  4. #4
    Join Date
    Jul 2005
    Location
    Belgium
    Posts
    2,492

    Latest Awards:

    Tokens
    147

    Default

    If I only look at the error, the problem is in this line:

    PHP Code:
    header("Cache-control: private"); 
    so the ":" is a problem...

    try:

    PHP Code:
    header('Cache-control: private'); 
    and if that doesn't work try:

    PHP Code:
    @header("Cache-control: private"); 
    otherwise, have a look here:
    http://be.php.net/header
    Last edited by [Oli]; 03-11-2007 at 09:57 PM.

  5. #5
    Join Date
    Apr 2006
    Posts
    1,463

    Latest Awards:

    Tokens
    0

    Default

    Quote Originally Posted by [oli] View Post
    If I only look at the error, the problem is in this line:

    PHP Code:
    header(”Cache-controlprivate”); 
    so the ":" is a problem...

    try:

    PHP Code:
    header('Cache-control: private'); 
    and if that doesn't work try:

    PHP Code:
    @header(”Cache-controlprivate”); 
    otherwise, have a look here:
    http://be.php.net/header
    Nop none of them work

  6. #6
    Join Date
    Jul 2005
    Location
    Belgium
    Posts
    2,492

    Latest Awards:

    Tokens
    147

    Default

    Quote Originally Posted by :Kosmickitten View Post
    Nop none of them work

    I'm also a newbie in this but is there a difference between these two ?:

    ” & "

    they display different in color things when you put under php tags

  7. #7
    Join Date
    Apr 2006
    Posts
    1,463

    Latest Awards:

    Tokens
    0

    Default

    Quote Originally Posted by [oli] View Post
    I'm also a newbie in this but is there a difference between these two ?:

    ” & "

    they display different in color things when you put under php tags
    Mm got it working
    Code:
    <?
    require_once "dbconfig.php";
    $sql = mysql_query("SELECT * FROM users WHERE username='".addslashes($_POST['username'])."'") or die("Username not found! MySQL said".mysql_error());
    $result = mysql_fetch_array($sql);
    
    if($result[’password’] == sha1($_POST[’password’])) { 
    session_start(); 
    header('Cache-control: private');  
    $_SESSION[”sessioname”] = $_POST[’username’];
    header('location: protected.php');
    }else{
    echo 'Incorrect login details, please try again.';
    }
    
    ?>
    But when I create a account it says created now login I log in and It says wrong user
    http://habbishfm.com/user/User/register.php

  8. #8
    Join Date
    Jul 2005
    Location
    Belgium
    Posts
    2,492

    Latest Awards:

    Tokens
    147

    Default

    Quote Originally Posted by :Kosmickitten View Post
    Mm got it working
    Code:
    <?
    require_once "dbconfig.php";
    $sql = mysql_query("SELECT * FROM users WHERE username='".addslashes($_POST['username'])."'") or die("Username not found! MySQL said".mysql_error());
    $result = mysql_fetch_array($sql);
    
    if($result[’password’] == sha1($_POST[’password’])) { 
    session_start(); 
    header('Cache-control: private');  
    $_SESSION[”sessioname”] = $_POST[’username’];
    header('location: protected.php');
    }else{
    echo 'Incorrect login details, please try again.';
    }
    
    ?>
    But when I create a account it says created now login I log in and It says wrong user
    http://habbishfm.com/user/User/register.php
    Yeah so it was with 's instead of ”s.

    And about the register, post the code please, i'll look at it

  9. #9
    Join Date
    Apr 2006
    Posts
    1,463

    Latest Awards:

    Tokens
    0

    Default

    Quote Originally Posted by [oli] View Post
    Yeah so it was with 's instead of ”s.

    And about the register, post the code please, i'll look at it
    I had a Look seen nothing.
    Code:
     <form method="post" action="register.php">
    <label>Username</label><br/><input name="username"/><br/>
    <label>Password</label><br/><input name="password" type="password"/><br/>
    <input type="submit" name="join" value="register"/>
    </form>

  10. #10
    Join Date
    Jul 2005
    Location
    Belgium
    Posts
    2,492

    Latest Awards:

    Tokens
    147

    Default

    Quote Originally Posted by :Kosmickitten View Post
    I had a Look seen nothing.
    Code:
     <form method="post" action="register.php">
    <label>Username</label><br/><input name="username"/><br/>
    <label>Password</label><br/><input name="password" type="password"/><br/>
    <input type="submit" name="join" value="register"/>
    </form>

    wait :S is that the only bit of code inside register.php ?

    Wheres the whole php part that sends the username & password into a database.

    obviously it would say wrong username/password if the username & password don't get storred...

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •