Salve, ho aggiunto nella gallery del mio sito uno script php per rendere tramite cutenews alcune sezioni private..sembra che tutto funzioni, ma quando inserisco i dati per il log in, mi si riapre sempre quella stessa pagina, che mi ripropone in login. Forse sbaglio a posizionare questo codice:
Lo script è questo:Codice HTML:<?PHP include("auth.inc.php"); ?>
potete dare un'occhiata e cercare di aiutarmi????Codice HTML:<?PHP session_start(); // authenticate username/password against /cutenews/data/users.db.php // returns: -1 if user does not exist // 0 if user exists but password is incorrect // 1 if username and password are correct function auth($user, $pass){ $result = -1; if((trim($user) != "") && (trim($pass) != "")){ // make sure that the script has permission to read this file! $data = file("data/users.db.php"); // iterate through file foreach ($data as $line){ $arr = explode("|", $line); // if username matches // test password if($arr[2] == $user){ // if match, user/pass combination is correct // return 1 if($arr[3] == $pass){ $result = 1; break; }else{ // otherwise return 0 $result = 0; break; } } } } // return value return $result; } // Check if Sessions have exist or else see if any var's are posted if(!isset($_SESSION["SESSION_UNAME"]) && !isset($_SESSION["SESSION_UPASS"])){ $f_user = $_POST['f_user']; $f_pass = md5($_POST['f_pass']); }else{ $f_user = $_SESSION["SESSION_UNAME"]; $f_pass = $_SESSION["SESSION_UPASS"]; } if($_GET['logout'] == "true"){ $f_user = ""; $f_pass = ""; session_unset(); session_destroy(); header("Location: ?"); } if(auth($f_user, $f_pass) == 1){ $_SESSION["SESSION_UNAME"] = $f_user; $_SESSION["SESSION_UPASS"] = $f_pass; }else{ echo <<<HTML <html> <head> <title>Private Section</title><style> body {background-color:#e7ebff; background-image:url(''); background-position: center;} body, td {font :11px Verdana, Tahoma, Geneva, Arial, Helvetica; color :#80b7ff; scrollbar-arrow-color: #6699CC; scrollbar-3dlight-color: #6699CC; scrollbar-highlight-color:#6699CC; scrollbar-face-color: #80b7ff; scrollbar-shadow-color: #6699CC; scrollbar-darkshadow-color:#6699CC; scrollbar-track-color:#80b7ff;} a:link, a:visited, a:active { color: #6699CC; font-weight: bold; text-decoration:underline; } a:hover { cursor:none; color:#80b7ff; text-decoration:underline;} } p, div { color: #80b7ff; font-family: verdana, tahoma; text-align: justify; font-size: 11px; } </style> </head> <body> <center> <table border="0" cellspacing="5" cellpadding="5"> <form action="" method="POST"> <tr> <td><b>Username:</b></td> <td><input type="text" size="20" name="f_user"></td> </tr> <tr> <td><b>Password:</b></td> <td><input type="password" size="20" name="f_pass"></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" name="submit" value=" Log In "> </td> </tr> </form> </table> </center> </body> </html> HTML; exit(); } ?>
Se volete fare una prova il link è http://www.jennifersky.altervista.or...ery_events.php
nick: test
password: test
per favore, ne ho un disperato bisogno :(

LinkBack URL
About LinkBacks
