GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Php Basic Code (https://gfy.com/showthread.php?t=1120919)

ls101 09-11-2013 08:52 PM

Php Basic Code
 
Code:

<?php

#host = "localhost";
#user = "root";
#pass = "pass";
#db = "test";

mysql_connect(#host, #user, #pass);
mysql_select_db(#db);

if (isset($_POST['username'])) {
        $username = $_POST['username'];
        $password = $_POST['password'];
        $sql = "SELECT " FROM users WHERE username='".#user."' AND password='".#pass."' LIMIT 1";
        #res = mysql_query($sql);
if (mysql_num_rows(#res) == 1) {
        echo "You have successfully logged in";
        exit();
} else {
        echo"Invalid Log In information. Please return to the previous page.";
        exit();
}
?>


What is wrong with this code? Can't figure it out!

KillerK 09-11-2013 08:54 PM

you are missing }

before the 2nd if

Vapid - BANNED FOR LIFE 09-11-2013 08:57 PM

Sql injection has gotten very advanced...

freecartoonporn 09-11-2013 09:25 PM

Quote:

Originally Posted by ls101 (Post 19796297)
Code:

<?php

#host = "localhost";
#user = "root";
#pass = "pass";
#db = "test";

mysql_connect(#host, #user, #pass);
mysql_select_db(#db);

if (isset($_POST['username'])) {
        $username = $_POST['username'];
        $password = $_POST['password'];
        $sql = "SELECT " FROM users WHERE username='".#user."' AND password='".#pass."' LIMIT 1";
        #res = mysql_query($sql);
if (mysql_num_rows(#res) == 1) {
        echo "You have successfully logged in";
        exit();
} else {
        echo"Invalid Log In information. Please return to the previous page.";
        exit();
}
?>


What is wrong with this code? Can't figure it out!

shitloads of corrections/improvements can be made....

ref: http://www.w3schools.com/php/func_my...ape_string.asp

Paul&John 09-12-2013 12:17 AM

why is there #user instead of $user ?

freecartoonporn 09-12-2013 12:20 AM

Quote:

Originally Posted by Paul&John (Post 19796456)
why is there #user instead of $user ?

i thought its new way of declaring vars in latest php ....
duh.. me

Paul&John 09-12-2013 01:44 AM

Quote:

Originally Posted by freecartoonporn (Post 19796460)
i thought its new way of declaring vars in latest php ....
duh.. me

it is? :)


All times are GMT -7. The time now is 05:23 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123