Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes

Php Programming Code Examples

Php > User Management Code Examples

Password authentification

Password authentification <? if (!empty($addtolog)) { $connection = mysql_pconnect($dbhost,$dbuser,$dbpass); $verify = "SELECT * FROM tablename WHERE username='$admin' and password='$password'"; $verres = mysql_db_query($dbname,$verify,$connection); $num = mysql_numrows($verres); if ($num != "0") { $query = "INSERT INTO adminlog (id,admin,entry,date) VALUES ('0000','".$admin."','".$entry."','".$date."')"; $result = mysql_db_query($dbname,$query,$connection); mysql_close($connection); exit; } else { echo "username and password are either incorrect or not in the database"; exit; } } ?> <form method="post"> name: <input type="text" name="admin"><br> passwd <input type="password" name="password"><br> entry: <textarea cols="30" rows="4" wrap="virtual" name="entry"></textarea> <br><input type="submit" name="addtolog"> </form>