Jump to content

Deospeon

Members
  • Posts

    29
  • Joined

  • Last visited

Posts posted by Deospeon

  1.  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''test'' at line 1

     

    When test is a user.

     

    Login.php >

    <?php
    session_start();
    include "./global.php";
    ?>
    <html>
        <head>
            <title>Login - Fantasy Core Forums</title>
        </head>
        <style type="text/css">
            body{
                background-color:#373737;
                color:#FAFAFA;
                font-family:Tahoma, Geneva, sans-serif;
                font-size:10pt;
                margin-top:0px;
            }
            #holder{
                background-color:#000;
                width:71%;
                color:#A5A5A5;
                font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
                border:solid 1px #000;
                padding-bottom: 10px;
                padding-left: 10px;
                padding-right: 10px;
                padding-top: 10px;
                text-align:left;
            }    
            #userinfo{
                width:99%;
                font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
                font-size:10px;
                color:#333;
                background-color:#F6F6F6;
                border: 1px solid #333;
                text-align:left;
                padding: 3px;
                padding-right: 3px;
            }
    a {
        font-size: 10px;
        text-decoration: none;
    }
    a:link {
        text-decoration: none;
    }
    a:visited {
        text-decoration: none;
    }
    a:hover {
        text-decoration: none;
    }
    a:active {
        text-decoration: none;
    }
            
        </style>
        <body>
            <center>
            <?php include "./header.php" ?>     
            <div id="holder">
            <div id="userinfo">
    <?
    
    if($_SESSION['uid']){
        echo "Sorry, You are already logged in. Please <a href=\"logout.php\">Logout<\a> or go to the <a href=\"index.php\">Index</a>.\a";
    }else {
    
        if(!$_POST['submit']){
        echo "<table border=\"0\" cellspacing=\"3\" cellpadding=\"0\">\n";
        echo "<form method=\"post\" action=\"./login.php\">\n";
        echo "<tr><td><font color=\"#4A4A4A\"><b>Username:</b></font></tr></td><tr><td><input type=\"text\" name=\"username\"></td></tr>\n";
        echo "<tr><td><font color=\"#4A4A4A\"><b>Password:</b></font></tr></td><tr><td><input type=\"password\" name=\"password\"></tr></td>\n";
        echo "<tr><td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"submit\" value=\"Login\"></td><tr></form>\n";
        }else {
            $user = mss($_POST['username']);
            $pass = $_POST['password'];
            
                if($user && $pass){
                    $query = "SELECT id FROM `users` WHERE `username`'".$user."'";
                    $res = mysql_query($query) or die(mysql_error());
                    if(mysql_num_rows($res) > 0){
                        $query2 = "SELECT id FROM `users` WHERE `username`='".$user."' AND `password`='".md5($pass)."'";
                        $res2 = mysql_query($query2) or die(mysql_error());
                        if(mysql_num_rows($res2) > 0){
                            $row = mysql_fetch_assoc($res2);
                            $_SESSION['uid'] = $row['id'];
                                echo "You have successfully Logged in as ".$user;
                        }else {
                            echo "The Username or Password You have Entered is Incorrect.\n";
                        }
                    }else {
                        echo "The Username that You have entered does not exist.\n";
                    }
                }else {
                    echo "Please Fill in all fields correctly.\n";
                }
        }
    }
    ?>
    </div>
    </div>
    </center>
    </body>
    </html>

     

    and

    global.php >

    <?php
    $con = mysql_connect("localhost","username","password") or die(mysql_error());
    $db = mysql_select_db("database",$con);
    
    function mss($value){
        return mysql_real_escape_string(trim(strip_tags($value)));
    }
    
    ?>

     

    Please inspect this code, and tell me about any errors.

    P.S If There is anything more you'd like to know about, please tell me.

     

  2. I've done the login script now.

     

    It works fine. except for one big error now.

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''test'' at line 1

     

    Try to login with the username "Test" and password "Test"..

  3. http://fantasycore.heliohost.org/forums/

     

    D: I have a problem, my login system wont work.

    Login says : some invalid Mysql syntax blah blah.. look at the second post.

     

     

    Please download the source code and figure out my problem.

    http://fantasycore.heliohost.org/forums/source_forums.zip

     

    sql for table users:

    CREATE TABLE `users` (
      `id` int(11) NOT NULL auto_increment,
      `username` varchar(32) NOT NULL,
      `password` varchar(32) NOT NULL,
      `email` varchar(255) NOT NULL,
      `name` varchar(64) NOT NULL,
      `admin` int(11) NOT NULL default '0',
      `time` int(15) NOT NULL default '0',
      PRIMARY KEY  (`id`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;

    IM : deospeon@live.com or crediter_braz@yahoo.com

  4. Lol Thanks for the suggestions but:

     

    I'm 13, so I can't save up to $149.99 to buy a whole IPB Board.

     

    I have my own views on the others.

     

    PHPBB: Its good, but too many system/mysql errors

    MyBB: I personally hate the design.

    PunBB: I love it.. but.. I dont know why I dont want to use it.

     

    NextBB: Im kinda hating it, although I have'nt touched it.

     

    I'll try going with PunBB :)

×
×
  • Create New...