note 78396 added to language.types.array

From: Date: Wed, 10 Oct 2007 09:14:20 +0000
Subject: note 78396 added to language.types.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-131268@lists.php.net to get a copy of this message
<?php //Simple Login Script using associative array. //You may modify the codes and use $_POST['FORM_FIELD_DATA'] for your web-page. //You may spice-up the codes with more form field validation & security features. //$user_name=$_POST['user_name']; //$password=$_POST['password']; $test_user_name = 'michelle_smith'; //for testing purpose only $test_password = 'msmith321'; //for testing purpose only $user_name = $test_user_name; $password = $test_password; // here user_name is key and password is the value of an array.. // website owner has to add new user/site member manually in $login_array $login_array = array( 'user_name' => 'password', 'alex_duff' => 'alx321', 'xena78' => 'xena321', 'dela_pena' => 'delp321', 'shawn_1981' => 'shw81', 'michelle_smith' => 'msmith321'); ksort ($login_array); reset($login_array); if (isset($login_array[$user_name])) { $pass_check = $login_array[$user_name]; if ($password === $pass_check) { echo "Welcome, $user_name!\n<br>"; //may redirect to specific webpage. } else { echo "Please try again!"; //may redirect to Error page. } } else { echo "Please register with us. Thanks!"; //may redirect to registration page. exit(); } echo("\n<br>"); echo 'Thanks to Thies C. Arntzen, Stig Bakken, Shane Caraveo, Andi Gutmans, Rasmus Lerdorf, Sam Ruby, Sascha Schumann, Zeev Suraski, Jim Winstead, Andrei Zmievski for wonderful PHP!'; ?> ---- Server IP: 69.147.83.197 Probable Submitter: 208.72.122.102 ---- Manual Page -- http://www.php.net/manual/en/language.types.array.php Edit -- https://master.php.net/note/edit/78396 Del: integrated -- https://master.php.net/note/delete/78396/integrated Del: useless -- https://master.php.net/note/delete/78396/useless Del: bad code -- https://master.php.net/note/delete/78396/bad+code Del: spam -- https://master.php.net/note/delete/78396/spam Del: non-english -- https://master.php.net/note/delete/78396/non-english Del: in docs -- https://master.php.net/note/delete/78396/in+docs Del: other reasons-- https://master.php.net/note/delete/78396 Reject -- https://master.php.net/note/reject/78396 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#131268) next »