PDA

View Full Version : Checking entered password against required one?


FethrdWlf
06-04-2011, 06:41 PM
So, my dad's boss needs to be able to change the content of a page. Simple: Use CKEditor on a simple page to update the content of a mysql table/row. Then, simply display that content on the actual page that gets changed.

I'm having problems though; In order to make the changes, you're required to enter in a password. It's worked for me in the past, but it just doesn't want to now. The script seems to forever reject what I've entered. Here's my code:

Form:
<form action="../scripts/repspecials.php" enctype="multipart/form-data" name="form1" id="form1">
<span style="text-align:center"><p>
<textarea id="post" name="post"><?php
while($row=mysqli_fetch_assoc($results)){
echo $row['content'];
}
?>
</textarea>
</p>
<p>
<noscript>
<strong>Please enable JavaScript in your browser to use the full page editor. Otherwise, you'll have to stick with the one above.</strong></noscript>
</p></span>
<p>&nbsp;</p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="16%" style="text-align:center"><label for="password">Password:</label></td>
<td width="34%" style="text-align:center"><input type="password" name="password" id="password" /></td>
<td width="25%" style="text-align:center"><strong>..............................</strong></td>
<td width="25%"><label for="update"></label>
<input type="submit" name="update" id="update" value="Update" /></td>
</tr>
</table>
<p>&nbsp;</p>
</form>
</p>
<p><script type="text/javascript">
CKEDITOR.replace( 'post' );
</script></p>

repspecials (update script):
<?php
include("mysql.php");
include("page.php");

$post = $_POST['post'];
$password = $_POST['password'];

if($password == $pass){
echo "You're awesome!";
}else{
echo "You suck!";
}
?>

I know it won't interact with MySQL right now, but it won't even tell me I'm awesome when I type in the password exactly as it should be. It still comes up with the other end of it: I suck.

page.php (password container):
<?php $pass="granite4"; ?>

Any help is greatly appreciated. This is my first website I'm doing for an actual client! :smile:

Corrosive
06-05-2011, 09:13 AM
Yes, that's odd. I think that should be working.

edbr
06-05-2011, 10:13 AM
echo the two strings to check which is not correcr