Otsi Vahvlist
Kuvatakse tulemused sildile ''checkloginphpga''.
Leitud 1 tulemus
-
Tere, asi selline, et kui ma login enda veebimängus oma kasutajasse sisse ja õige parooli panen siis juhtub järgmine asi: Warning: session_register() [function.session-register]: Cannot send session cookie - headers already sent by (output started at /www/apache/domains/www.a-rp.eu/htdocs/taavi/checklogin.php:2) in /www/apache/domains/www.a-rp.eu/htdocs/taavi/checklogin.php on line 38 Warning: session_register() [function.session-register]: Cannot send session cache limiter - headers already sent (output started at /www/apache/domains/www.a-rp.eu/htdocs/taavi/checklogin.php:2) in /www/apache/domains/www.a-rp.eu/htdocs/taavi/checklogin.php on line 38 Warning: Cannot modify header information - headers already sent by (output started at /www/apache/domains/www.a-rp.eu/htdocs/taavi/checklogin.php:2) in /www/apache/domains/www.a-rp.eu/htdocs/taavi/checklogin.php on line 40 Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively in Unknown on line 0 Aga kui vale parooli panen, kuvab, et Vale parool või kasutajanimi. Checklogin.php fail: // Ühendame MySQLiga $host="localhost"; // Hostinimi $username="polesinuasi"; // Mysql username $password="polesinuasi"; // Mysql password $db_name="polesinuasi"; // Database name $tbl_name="kasutajad"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // username and password sent from form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $encrypted_mypassword=md5($mypassword); $sql="SELECT * FROM $tbl_name WHERE name='$myusername' and password='$encrypted_mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("myusername"); session_register("mypassword"); header("location:login_success.php"); } else { echo "Vale kasutajanimi või parool."; } Ning login_success.php fail: session_start(); if(!session_is_registered(myusername)){ header("location:logi.php"); } ?> Logimine õnnestus. Et mis teha, et noid warninguid ära saada? Ise alles õpin ja ei saa aru, mis tegema peaks. Suured tänud neile, kes aidata oskavad.
- 8 vastust
-
- checkloginphpga
- jama
-
(ja 1 veel)
Sildistatud koos: