crypt () function

Hi!

Im new at PHP so this is a beginners question!

Im trying to crypt my password but its not going well!

I really dont know what im doing wrong, so i would be really thankfull if someone could tell me in a simple way an example how i can crypt () my password with my code, using a database!
This is some of my code without any crypt function!

<?php session_start(); include "conn.php"; // Database // Login if (isset($_POST['submit'])){ $sql = "SELECT id FROM memberss WHERE user='{$_POST['user']}' AND pass='{$_POST['passwd']}'"; $result = mysql_query($sql); if (mysql_num_rows($result) == 0){ header("Location: index.php?badlogin="); exit; } $_SESSION['sess_id'] = mysql_result($result, 0); $_SESSION['sess_user'] = $_POST['user']; header("Location: welcome.php"); exit; } // Logout if (isset($_GET['logout'])){ session_unset(); session_destroy(); header("Location: index.php"); exit; } ?>

Thanx :slight_smile:

[php]
AND pass=md5($_POST[‘passwd’]);
[/php]

but don’t forget to md5 the pass on registration to the site

Sponsor our Newsletter | Privacy Policy | Terms of Service