PHP للمطور - معمو — الصفحة ٧٨٦

17: PHP and MySQL 786 على المستخدم. دعنا نمضي إلى استرداد متحولات النموذج والاتصال مع قاعدة البيانات في حال وجود هذه المتحولات فقط. وسوف نركز هنا على مقطع PHP فقط: //Attcomt, toy fetch, the data varjabĺes Suseenemes BHTTP POST_VARS]sername Spassword = SITTE POS VARS ('password' ** cedirect the user to the search page ?> // Connect to the database $conn = mysql_connect('localhost', 'jon', 'secret') or die(mysql_error()); mysql_select_db('Library', $conn) or die(mysql_error()); // Close the connection to the database mysql_close($conn); قاعدة البيانات إلا عندما يتم توفير قيمتي اسم المستخدم وكلمة لا نقوم الآن بالاتصال مع المرور عن طريق إرسال النموذج دعنا الآن نحاول المصادقة على المستخدم استناداً إلى هاتين <?php // Attempt to fetch the form variables $username = $HTTP_POST_VARS['username']; $password $HTTP_POST_VARS['password']; = // If the username and password are valid, // redirect the user to the search page. if (isset($username) && isset($password)) { // Connect to the database $conn = mysql_connect('localhost', 'jon', 'secret') or die(mysql_error()); mysql_select_db('Library', $conn) or die(mysql_error()); Sagi -115ELECT Descring PROK 16918 MERE USE Superfame and password $resule - mysql query (engl. القيمتين:
ص٧٨٦

نص مستخرج آليًا من الصورة، وقد يقع فيه خطأ.