Jump to content
xisto Community
damoon

Tell Me Where Am Wrong

Recommended Posts

i built this php script to redirect a particular password to a page according to the password inputed....

password= 237806422

<html><head><title>Redirector</title></head><body><FORM action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"><input type="text" name="pass"/><input type="submit" value="Enter"/></body></html><?php/////collect variables//////$pass = $_POST['pass']///////variables collected//////if $pass=="237806422" {header(location: main.php);}else{die;}?>please where did i go wrong?

Share this post


Link to post
Share on other sites

but apart from that are u sure theres no other error/bugs??

Well, you should be telling the answer to it. Did it run correctly after applying the changes? If not what is the error being shown?

Share this post


Link to post
Share on other sites

but apart from that are u sure theres no other error/bugs??
please go through it


I think you should instead do a run in your script and paste the error message here if there's any. I'm not a PHP compiler, don't expect me to run through the codes and generate the errors for you with my brain.

Share this post


Link to post
Share on other sites

Well, everything were bad in that script, I just fixed it, didn't try if it works, but I think it should work:

<?phpif ( isset($_POST['pass']) && $_POST['pass'] == '237806422'){	header("Location: http://forums.xisto.com/no_longer_exists/;;'>http://forums.xisto.com/no_longer_exists/;;	exit;}else{	exit;}?><html><head><title>Redirector</title></head><body><form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"><input type="text" name="pass" /><input type="submit" value="Enter" /></form></body></html>

Replace http://forums.xisto.com/no_longer_exists/ with your website location, you need to use the full url path and not only main.php as you did before.. Also having so much errors in your code, I suggest you first read a tutorial on how to do something in PHP, because it seems that you don't know any basic stuff. :lol:
Edited by Quatrux (see edit history)

Share this post


Link to post
Share on other sites

Well, everything were bad in that script, I just fixed it, didn't try if it works, but I think it should work:

<?php  if ( isset($_POST['pass']) && $_POST['pass'] == '237806422') {	 header("Location: http://forums.xisto.com/no_longer_exists/;;	 exit; } else {	 exit; } ?> <html><head><title>Redirector</title></head> <body> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type="text" name="pass" /> <input type="submit" value="Enter" /> </form> </body></html>
The html will never show because the script will exit before it reaches the html. The "else { exit; }" should be removed.

Share this post


Link to post
Share on other sites

Yes, you're right, that is what you get when you don't do any testing, I wrote it very fast and copied the content and made a really terrible mistake.. anyway remove the else { exit; } and it should work.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.