tomagucci Posted June 12, 2010 Share Posted June 12, 2010 Hi all, well I am trying to debug some php that I purchased and am running into a little bit of a snag. I am trying to figure out how sendrequest works but am having a very hard time. So here is the situation, there is a small login form, this is just to check the validity of the username/pw entered. So after the form is filled out onSubmit it runs a js function to check the entered fields. Here is the js function that is called. <script type="text/javascript"> function chk_minilogin(frm) { document.getElementById('err_miniusername').innerHTML = ""; document.getElementById('err_minipassword').innerHTML = ""; if(frm.username.value.search(/\S/)==-1) { document.getElementById('err_miniusername').innerHTML = "Please enter username"; frm.username.focus(); return false; } if(frm.password.value.search(/\S/)==-1) { document.getElementById('err_minipassword').innerHTML = "Please enter your password"; frm.password.focus(); return false; } frm.mode.value = 'check_login'; sendRequest('check_login.php','mode=check_login&username='+frm.username.value+'&password='+frm.password.value,'POST'); return false; } </script> So this is all pretty straight forward. I get really lost at the check_php.login which looks like this <?php include("includes/config.php"); if(isset($_REQUEST['mode'])&&($_REQUEST['mode']=='check_login')) { $chkmailRS = mysql_query("SELECT * FROM ".USER." WHERE username = '".$_REQUEST['username']."'"); if(mysql_num_rows($chkmailRS)>0) { $chkmailROW = mysql_fetch_array($chkmailRS); if($chkmailROW['guest']=='Y') { echo "Invalid Username/Password"; echo "^4"; } else { if($chkmailROW['password']==$_REQUEST['password']) { setcookie("cakeuserId" , $chkmailROW['userId'],time()+1800); setcookie("cakeusername" , $_REQUEST['username'],time()+1800); echo "^5"; } else { echo "Invalid Username/Password"; echo "^4"; } } } else { echo "Invalid Username/Password"; echo "^4"; } } ?> this is still pretty straight forward. Where I get lost is at the echo parts. I dont understand what echo "^5" is. What happens after the user logs in with the correct username is that it takes them back to index.php which I dont want. I want it to just refresh the same page. I guess ^4 just does nothing and if I enter in any other values for where the echo is, nothing happens as well. I dont understand how sendrequest is interpreting the ^5 or ^4 values. Is this specific to something? I have an action on the form and just to test it out I set it to redirect to google but thats completely overlooked when the form is submitted. So yeah if anyone could shed some light on this situation that would be great. I have been lost for like 5 hrs. thanks, Chris Quote Link to comment 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.