Little Problem

Discussion in 'PHP' started by SkullKing, Jul 28, 2009.

  1. #1
    <?php
    session_start();
    if (!isset($_SESSON['newuser']) || !isset($_POST['submit'])) {
    
    ?>
    
    <html>
        <body>
            <form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">
            Username: <input type="text" name="username"><br />
            Password: <input type="password" name="password" value="********"<br />
            <input type ="submit" name="submit" value="Submit!">
                </form>
        </body>
    </html>
    
    <?php
    }
    else {
        $mysqluser = "root";
        $mysqlpassword = "blablabla";
        $host = "localhost";
        $databasename = "lmfao";
        $connection = mysql_connect($host, $mysqluser, $mysqlpassword);
        if (!$connecttion) {
            die("Could not connect" . mysql_error());
    }
    else {
        mysql_select_db($databasename, $connection) or die('Could not connect' . mysql_error());
        $newuser = mysql_real_escape_string($_POST['username']);
        $newpass = mysql_real_escape_string($_POST['password']);
        $query = "SELECT * FROM login WHERE username='$newuser' AND password='$newpass'";
        $done = mysql_query($query);
        $count = mysql_num_rows($done);
        if ($count == 1) {
            session_register(newuser);
            echo "Login Success!";
        }
        else {
            echo "You Failed to login";
        }
    ?>
    PHP:
    Anybody got insight into whats wrong with the code? Im getting this error:
    Parse error: parse error in C:\Program Files\EasyPHP 3.0\www\design\login.php on line 41 but to my knowledge that line is fine. :p
     
    Last edited: Jul 28, 2009
    SkullKing, Jul 28, 2009 IP
  2. greatlogix

    greatlogix Active Member

    Messages:
    664
    Likes Received:
    13
    Best Answers:
    1
    Trophy Points:
    85
    #2
    replace line 41 with }}

    I hope this will solve your problem.
     
    greatlogix, Jul 28, 2009 IP
  3. krishmk

    krishmk Well-Known Member

    Messages:
    1,376
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    185
    #3
    You have forgotten to close 2 curly braces opened at the following line numbers:

    a) Line #19
    b) Line #28
     
    krishmk, Jul 28, 2009 IP
  4. SkullKing

    SkullKing Guest

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Got it working now, thanks guys for you help both have been +repd. :)
     
    SkullKing, Jul 28, 2009 IP