sudduth66 Posted May 26, 2011 Share Posted May 26, 2011 I have a login screen that only partly works if i put in the password and click submit it gives me a 500 internal server error. but if i put in the wrong password it gives me the wrong password screen. i am new to this and lost as to why it doesn't work any help would be appreciated. i am running on vista with iis7 and mysql. also this is some code i found online and changed it around to fit the new php 5.3.6 so not sure what i did or if i need to change more. Thank you in advance [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/237527-login-screen-help/ Share on other sites More sharing options...
fugix Posted May 26, 2011 Share Posted May 26, 2011 i would change your login success page to this // Check if session is not registered , redirect back to main page. // Put this code in first line of web page. <?php session_start(); if(!empty($myusername) && !empty($mypassword)){ $_SESSION['myusername'] =$myusername; $_SESSION['mypassword'] =$mypassword; } if(!isset($_SESSION['myusername']) || !isset($_SESSION['mypassword'])){ header("location:main_login.php"); } ?> <html> <body> Login Successful </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/237527-login-screen-help/#findComment-1220575 Share on other sites More sharing options...
sudduth66 Posted May 26, 2011 Author Share Posted May 26, 2011 Thank you but that still does not work. Quote Link to comment https://forums.phpfreaks.com/topic/237527-login-screen-help/#findComment-1220579 Share on other sites More sharing options...
fugix Posted May 26, 2011 Share Posted May 26, 2011 have you tried debugging your script..echoing you sessions to make sure they are set, checking your queries etc.. Quote Link to comment https://forums.phpfreaks.com/topic/237527-login-screen-help/#findComment-1220587 Share on other sites More sharing options...
sudduth66 Posted May 26, 2011 Author Share Posted May 26, 2011 Thank You for your time and suggestions i think i got it figured out it is a database connection problem. i found a script to connect to mysql that asks for db name, host, user, password and it does the same thing so i believe it is a connection problem. I hope. lol Quote Link to comment https://forums.phpfreaks.com/topic/237527-login-screen-help/#findComment-1220606 Share on other sites More sharing options...
fugix Posted May 26, 2011 Share Posted May 26, 2011 okay, if you need further help just let us know. Quote Link to comment https://forums.phpfreaks.com/topic/237527-login-screen-help/#findComment-1220608 Share on other sites More sharing options...
sudduth66 Posted May 26, 2011 Author Share Posted May 26, 2011 ok i got the connection fixed but still no luck. i ran debug on the code in phpdesigner and get an error on line 10. mysql_connect("$host", "$username", "$password")or die("cannot connect"); fatal error call to undefined function mysql_connect() I am lost again thanks in advance again. Quote Link to comment https://forums.phpfreaks.com/topic/237527-login-screen-help/#findComment-1220651 Share on other sites More sharing options...
fugix Posted May 26, 2011 Share Posted May 26, 2011 read this please Quote Link to comment https://forums.phpfreaks.com/topic/237527-login-screen-help/#findComment-1220659 Share on other sites More sharing options...
sudduth66 Posted May 26, 2011 Author Share Posted May 26, 2011 that is all correct i can connect to the database using a test script i have were it asks for host,user,db,and pword. i believe now it has to do with my ob_start that is not working i am reading on the internet now about how to turn it on in the ini file but have had no luck and am still a little confused. Thank u for all your help i am real new to this and don't want to be a pain. Quote Link to comment https://forums.phpfreaks.com/topic/237527-login-screen-help/#findComment-1220666 Share on other sites More sharing options...
sudduth66 Posted May 26, 2011 Author Share Posted May 26, 2011 Thank you fugix for all your help the line of code u gave me was the fix. I just didn't have my php.ini set up correct once it was fixed it all worked. i had way to much running in the extensions i guess i started over with a new copy and only opened the mysql extension and it all works now with your code add in. Again thank you so much. Quote Link to comment https://forums.phpfreaks.com/topic/237527-login-screen-help/#findComment-1220733 Share on other sites More sharing options...
fugix Posted May 26, 2011 Share Posted May 26, 2011 Thank you fugix for all your help the line of code u gave me was the fix. I just didn't have my php.ini set up correct once it was fixed it all worked. i had way to much running in the extensions i guess i started over with a new copy and only opened the mysql extension and it all works now with your code add in. Again thank you so much. no problem at all, glad i could help Quote Link to comment https://forums.phpfreaks.com/topic/237527-login-screen-help/#findComment-1220737 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.