Demonic Posted June 22, 2008 Share Posted June 22, 2008 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 More sharing options...
Demonic Posted June 22, 2008 Author Share Posted June 22, 2008 Wow, no help and like 3-4 Pros are online. Link to comment https://forums.phpfreaks.com/topic/111383-solved-unexpected-redirection/#findComment-571772 Share on other sites More sharing options...
Darklink Posted June 22, 2008 Share Posted June 22, 2008 What is the code in the function goBack(). The code you provided us doesn't show us much at all. Link to comment https://forums.phpfreaks.com/topic/111383-solved-unexpected-redirection/#findComment-571784 Share on other sites More sharing options...
grlayouts Posted June 22, 2008 Share Posted June 22, 2008 well if goback is a browser backlink to previous page didnt it come from admin.php? if not provide full code. Link to comment https://forums.phpfreaks.com/topic/111383-solved-unexpected-redirection/#findComment-571790 Share on other sites More sharing options...
Demonic Posted June 22, 2008 Author Share Posted June 22, 2008 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>"; } Link to comment https://forums.phpfreaks.com/topic/111383-solved-unexpected-redirection/#findComment-571794 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.