Site Works Hosted, Errors When Moved Local

Discussion in 'PHP' started by timallard, Jun 8, 2009.

  1. #1
    Hey everyone,

    Im working on a PHP website/app.
    It works perfectly fine hosted with 1and1.

    I just set up a MAMP and WAMP server for development and testing.

    I have a login form...where i am getting a parsing error and not sure why.. It works fine hosted with 1 and 1...

    Any thing look out of the ordinary?




    <?php

    //GRABS DATABASE INFORMATION

    session_start();
    header("Cache-control: private");
    include 'config/config.php';


    if ($_SESSION['userName']){
    echo "<SCRIPT LANGUAGE='JavaScript'>window.location='dashboard.php';</script>";
    exit();

    }

    if (!$_SESSION['userName'] || !$_SESSION['email']){

    $userName = $_POST['userName']; /// What the user put in the userName box.
    $password = $_POST['password']; /// What the user put in the password box.

    $userName = strip_tags($userName);
    $password = strip_tags($password);

    $ip = $REMOTE_ADDR; /// The users IP address
    $domain = $_SERVER['REMOTE_ADDR'];

    $userName=strtolower($userName); /// Put the userName in lower case letters.

    if((!$userName) || (!$password)){
    echo "Please Enter All Necessary Fields.<br />"; /// If the userName or password are empty then echo this.
    }else{


    ///check INFO
    $sql = mysql_query("SELECT * FROM users WHERE userName='$userName' AND password='$password'");
    $login_check = mysql_num_rows($sql);
    $ban = mysql_fetch_object($sql);


    $sql2 = mysql_query("SELECT * FROM users WHERE userName='$userName' AND password='$password'");
    $logged = mysql_fetch_array($sql2) or die(mysql_error());




    //sets the logged session
    $_SESSION['id'] = $logged['id'];
    $_SESSION['firstName'] = $logged['firstName'];
    $_SESSION['lastName'] = $logged['lastName'];
    $_SESSION['privelages'] = $logged['privelages'];






    ///other
    if ($login_check > '0'){




    ini_set(session.cookie_lifetime, "3600");
    session_register('userName');
    $_SESSION['userName'] = $userName;
    session_register('email');
    $_SESSION['email'] = $email;



    /// security measures
    $timestamp = time();
    $timeout = $timestamp-$timeoutseconds;
    $cool = gmdate('Y-m-d h:i:s');

    mysql_query("UPDATE users SET online='$timestamp' WHERE userName='$userName'");
    mysql_query("UPDATE users SET ip='$domain' WHERE userName='$userName'");


    ?>
    <meta http-equiv="Refresh" content=0;url="dashboard.php">
    <?

    } else {

    echo "<span align=\"center\">Please Make Sure You Have Entered To Right Password/User Name Combination.</span><br /><br />";
    include 'Sorry.php'; /// If their details are wrong echo the above and below that show login.php

    }}}
    ?>


    THANK YOU
     
    timallard, Jun 8, 2009 IP
  2. Social.Network

    Social.Network Member

    Messages:
    517
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    35
    #2
    Regarding the script, nothing out of the ordinary. Can you post the actual error message?
     
    Social.Network, Jun 8, 2009 IP
  3. timallard

    timallard Well-Known Member

    Messages:
    1,634
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    158
    #3
    Thank for looking :)

    NOTE: This is a brand new install of a WAMP server...do i need to turn on any extensions??

    Parse error: parse error in C:\wamp\www\lol\loggingin.php on line 206

    i wish it was in more detail ;)
     
    timallard, Jun 8, 2009 IP
  4. timallard

    timallard Well-Known Member

    Messages:
    1,634
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    158
    #4
    ok..i found it... i did <? echo "hi"; ?> instead of <?php... doh.
     
    timallard, Jun 8, 2009 IP