Jump to content

TylerRichardson

Members
  • Posts

    4
  • Joined

  • Last visited

TylerRichardson's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. ooohh thats clever, thanks. But also when i execute my login script it returns an error page saying that that specific line in my code is drawing a scripting error but it is still connecting to the database so i dont know why it wouldnt calculate that
  2. but if i have just a submit button it doesnt look right, it would make sense to have my buttons all in the same place for every dialog box i have (which is a lot). If you go to the site budgetme.org youll see when you submit any username and password it takes you to this weird error page which makes it seem like the submit button is working but the check user script isnt
  3. Holy crap CPD, im pretty sure youre post melted my brain. Im pretty new to php (and coding outside of html and css in general) and im using the skeleton of a script i found online which would be why its out of date. Im honestly not looking for security right now, this is just a personal project im working on to get better at coding so i hope you arnt too offended by my terrible lack of regard for good coding haha. I kind of understand what youre saying at the end, what i have right now is a jquery dialog box so if the login fails ill redirect to an identical page with the dialog box autoOpen = true with the error message at the top which will be a TON easier than learning how to do an error message at the top of the form. Also Denno020, i dont get how the login check is equal or inequal to anything. can someone explain to me what this snippet of code does? $sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' "); $login_check = mysql_num_rows($sql); also i am currently executing the login like this: <script> $(function() { $( "#login_form" ).dialog({ autoOpen: false, height: 300, width: 350, modal: true, buttons: { "Login": (function() { $("#login_info").submit(); }), Cancel: function() { $( this ).dialog( "close" ); } }, close: function() { allFields.val( "" ).removeClass( "ui-state-error" ); } }); $( "#login" ) .button() .click(function() { $( "#login_form" ).dialog( "open" ); }); }); </script> I have absolutly no idea if thatll work (On my html form i have an action set so im thinking that the submit function will do the same thing as html form submit would do)
  4. I have some login script code that i got from some tutorial and it works perfectly on another site of mine but i need to modify it to work with a new website: budgetme.org I can open the login form and submit it but the way the checkuser script is written it redirects to a login success and a login fail page respectivly. I want it to simple give a "wrong username" above the login form or redirct to the home page with the user logged in. Can someone please tell me how i can do this??? the jquerry im using for the login box is located on the website home page. Thanks so much!! Here is the check user script im using (modified to work with my system). <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Check User</title> </head> <body> <? /* Check User Script */ // Start Session include 'db.php'; // Conver to simple variables $username = $_POST['username']; $password = $_POST['password']; if((!$username) || (!$password)){ echo "Please enter your username and password. <br />"; exit(); } // Convert password to md5 hash $password = md5($password); // check if the user info validates the db $sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' "); $login_check = mysql_num_rows($sql); if($login_check > 0){ while($row = mysql_fetch_array($sql)){ foreach( $row AS $key => $val ){ $$key = stripslashes( $val ); } // Register some session variables! session_register('id'); $_SESSION['id'] = $id; session_register('username'); $_SESSION['username'] = $username; session_register('password'); $_SESSION['password'] = $password; session_register('sign_up'); $_SESSION['sign_up'] = $sign_up; session_register('email'); $_SESSION['email'] = $email; session_register('first'); $_SESSION['first'] = $first; session_register('last'); $_SESSION['last'] = $last; session_register('activation'); $_SESSION['activation'] = $activation; session_register('user_level'); $_SESSION['user_level'] = $user_level; session_register('total_amount'); $_SESSION['total_amount'] = $total_amount; session_register('budget_1_name'); $_SESSION['budget_1_name'] = $budget_1_name; session_register('budget_1_total'); $_SESSION['budget_1_total'] = $budget_1_total; session_register('budget_2_name'); $_SESSION['budget_2_name'] = $budget_2_name; session_register('budget_2_total'); $_SESSION['budget_2_total'] = $budget_2_total; session_register('budget_3_name'); $_SESSION['budget_3_name'] = $budget_3_name; session_register('budget_3_total'); $_SESSION['budget_3_total'] = $budget_3_total; session_register('budget_4_name'); $_SESSION['budget_4_name'] = $budget_4_name; session_register('budget_4_total'); $_SESSION['budget_4_total'] = $budget_4_total; session_register('budget_5_name'); $_SESSION['budget_5_name'] = $budget_5_name; session_register('budget_5_total'); $_SESSION['budget_5_total'] = $budget_5_total; mysql_query("UPDATE users SET last_login=now() WHERE userid='$userid'"); header( "Location: index.php" ); } } else { echo "The login information you entered does not match our system."; } ?> </body> </html> <? ob_flush(); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.