I've had a look at http://au2.php.net/strcmp and want to basically find out if it's the best way to compare?
I have two variables, $password and $password2 and I want to make sure they're EXACTLY the same, for the password check when a user wants to change their password.
Is that the correct function or is there something better?
Thanks so much, any advice really appreciated,
Rob
comparing a password string
Moderator: General Moderators
if you're comparing it on the server side, why not just use something like:
Code: Select all
<?php
if($_POST['password1'] != $_POST['password2'])
// some failure processing
else
// some success processing
?>- robster
- Forum Contributor
- Posts: 360
- Joined: Wed Jul 16, 2003 8:28 am
- Location: Sunshine Coast, Australia
cancel that, it was too easy 
Code: Select all
//check if they are the same or not
if ($get_password==$get_password2) { // This returns true.
// $get_password and $get_password2 are the same.
echo "passwords are the same<br>";
} else {
// $get_password and $get_password2 are NOT the same.
echo "passwords are NOT the same<br>";
}- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia