$uname = $_POST["name"]; $data = file_get_contents("http://$uname.stumbleupon.com/favorites/"); $msite = $_POST['msite']; $regex = '/$msite/'; if (preg_match($regex, $data, $match)){ echo "You Stumbled Successfully!"; } else{ echo "Try Again!"; PHP: What is happening is that the outcome is always successful even though it is a false statement.
Actually, since you're using user input in the expression, you might as well want to use preg_quote() to avoid errors.
I tried your advice with a session register but the script keeps on randomizing the output.... for example if I echo one of the session variables and then hit submit it tries to verify it against a different random variable...meaning sometimes it will fail and at times it will succeed.