Please login or register. Welcome to the Studio, guest!


Quick Links:


newBookmarkLockedFalling

Gunny

Gunny Avatar
Go Team Tux!

**
Official Member

37


November 2005
This is a little PHP password script I came up with. Problem is, no matter what you type into the password entry box, it lets you in! The code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html>
<head>
<title>YAK Members Login</title>
</head>
<body>

<form name="input" method="post"
action="<?php echo $_SERVER['SCRIPT_NAME']?>">

<p><label for="code">Type the code you reviced: </label>
<input type="text" name="code" id="code" /></p>
<p><input type="submit" name="submit" value="submit" /></p>
</form>
<?php
//affirm and neg echo varibles
$entry ="
<script>
alert('Entry Code Confirmed! Press Okay to enter.');
location.replace('http://localhost/yak/clubyak');
</script>
";

$noentry ="
<script>
alert('Entry Code Inncorrect! Bad luck');
location.replace('http://www.google.com');
</script>
";

//grab text box
if (isset($_POST['submit'])) {
$name = $_POST['code'];
//if yes
if($name == 232 || 343 || 565) {
echo $entry;
}
//if no
else {
echo $noentry;
}
}
?>



</body>
</html>



crazynarutard

crazynarutard Avatar

*****
Senior Studio Member

1,470


August 2005
if(preg_match('/^(232|343|565)$/',$name))


Last Edit: Feb 18, 2006 4:22:45 GMT by crazynarutard

Gunny

Gunny Avatar
Go Team Tux!

**
Official Member

37


November 2005
How does it work?

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
That says this.
if($name == 232 || 343 || 565)
"If variable name == 232 or if 343 or if 565 then...."

You want it to say.
if($name == 232 || $name == 343 || $name == 565)
"If variable name == 232 or if variable name == 343 or if variable name == 565 then..."

CJ's actually does the same, but says this.
if(preg_match('/^(232|343|565)$/',$name))
"if variable names matches from start (^) either 232, 343, 565, to end ($) then...."

newBookmarkLockedFalling