koulaid Posted December 2, 2006 Share Posted December 2, 2006 hey everyone i'm kind of new at this so bare with mw. im trying to script a login page. in my mysql database i have 2 fields "name and password". I have 2 names with two passwords that i inserted into the table. but when i am at the login form and try to login i can only get one name with its password and login but the other doesnt work. for ex. [u]name[/u] - [u]password[/u]john - doejoe - schmoei login with the name john and the password is doe, but then i cant login with joe. im not sure what is wrong or what else i need.heres the url for the script : [url=http://www.2kcodes.com/local/test.txt]http://www.2kcodes.com/local/test.txt[/url] Link to comment https://forums.phpfreaks.com/topic/29255-php-mysql-help/ Share on other sites More sharing options...
marcus Posted December 2, 2006 Share Posted December 2, 2006 [code]function FormCheck() { $data = mysql_query("SELECT * FROM test WHERE name =$_POST['name']"); $password = $_POST['password']; $password_encrypt = md5($password); $info = mysql_fetch_array( $data ); if (empty($_POST['name'])) { echo '<center><font color="red">Please enter your name.<br></font></center>'; } if (empty ($_POST['password'])) { echo '<center><font color="red">Please enter you password.<br></font></center>'; } if (isset($_POST['name'] && $_POST['password'] && $_POST['name'] != $info['name'] || $password_encrypt != $info['password']) { echo "<center><font color='red'>Sorry your information doesn't match the one that is stored on the database.<br><br></font></center>"; }else { session_start(); $_SESSION['name'] = $info['name']; header ('Location: home.php'); } }[/code]try that Link to comment https://forums.phpfreaks.com/topic/29255-php-mysql-help/#findComment-134093 Share on other sites More sharing options...
koulaid Posted December 2, 2006 Author Share Posted December 2, 2006 [quote author=mgallforever link=topic=117144.msg477675#msg477675 date=1165094342][code]function FormCheck() { $data = mysql_query("SELECT * FROM test WHERE name =$_POST['name']"); $password = $_POST['password']; $password_encrypt = md5($password); $info = mysql_fetch_array( $data ); if (empty($_POST['name'])) { echo '<center><font color="red">Please enter your name.<br></font></center>'; } if (empty ($_POST['password'])) { echo '<center><font color="red">Please enter you password.<br></font></center>'; } if (isset($_POST['name'] && $_POST['password'] && $_POST['name'] != $info['name'] || $password_encrypt != $info['password']) { echo "<center><font color='red'>Sorry your information doesn't match the one that is stored on the database.<br><br></font></center>"; }else { session_start(); $_SESSION['name'] = $info['name']; header ('Location: home.php'); } }[/code]try that[/quote]theres a parse error where you added in the $data : Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/koulaid2/public_html/local/login.php on line 9 Link to comment https://forums.phpfreaks.com/topic/29255-php-mysql-help/#findComment-134102 Share on other sites More sharing options...
hazratjee Posted December 2, 2006 Share Posted December 2, 2006 i have created a web page using MS front page andihave uploaded a folder named MIDI containing 600 midi filesis there any method that all the names of midi files in folder MIDI automatically appears on my web page i dont want to write names of files in source of html page than create hyper link i have to submit nearly 2000 files i.e. (ring tones ,softwares,themes) i am using services of freewebtown.com may web page will me freewebtown.com/xyz Link to comment https://forums.phpfreaks.com/topic/29255-php-mysql-help/#findComment-134105 Share on other sites More sharing options...
koulaid Posted December 2, 2006 Author Share Posted December 2, 2006 [quote author=hazratjee link=topic=117144.msg477688#msg477688 date=1165096059]i have created a web page using MS front page andihave uploaded a folder named MIDI containing 600 midi filesis there any method that all the names of midi files in folder MIDI automatically appears on my web page i dont want to write names of files in source of html page than create hyper link i have to submit nearly 2000 files i.e. (ring tones ,softwares,themes) i am using services of freewebtown.com may web page will me freewebtown.com/xyz [/quote]y are u in my thread? make ur own and to answer your question. theres no way ok. Link to comment https://forums.phpfreaks.com/topic/29255-php-mysql-help/#findComment-134109 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.