Jump to content

[SOLVED] Unexpected redirection...


Demonic

Recommended Posts

I'm writing some code to update a profile when I submit the form this code is executed:

 

				if( !empty($p1) ) {
					if( $p1 == $p2 ) {							
						$hash = substr(md5(rand(1,9999)) . $_POST['name'],0,15);
						$userSystem->setPassword( md5( $hash.$p ), $hash );
						$newpass = true;
					} else {
						return str_replace('{goback}',goBack(),$l['admin_client_pwd_mismatch']);
					}
				}

 

If the passwords are correct everything is handy dandy, but when the pass is incorrect it sends me the admin.php?  Quite weird because I didn't order for this to redirect anywhere, e.g. the form action is:

 

admin.php?action=editClient

 

If i put a exit after the else clause, it'll exit fine.  What can I do to return the actual words, because I can put "return 'tes';" and still does the same thing.

Link to comment
https://forums.phpfreaks.com/topic/111383-solved-unexpected-redirection/
Share on other sites

Naw I figured out the problem, basically I set up my class to create a temporary user id based on the current session so I wouldn't have to write the same class over.

 

I just added this above the return:

 

				$userSystem->tempUserIDBackUp();
				$userSystem->tempData();

 

Solved

 

What is the code in the function goBack().

 

function goBack() {
return " <a href='javascript:history.go(-1);'>Go Back</a>";
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.