Da3m0n Posted December 8, 2007 Report Share Posted December 8, 2007 <?php session_start(); require_once($_SERVER['DOCUMENT_ROOT'].'/db.php'); if (!session_is_registered('username') && $_SESSION['logged_in'] != TRUE) { if (isset($_POST['Login'])) { if($_POST['username']!='' && $_POST['password']!='') { $u = strip_tags($_POST['username']); $p = md5(strip_tags($_POST['password'])); //Now let us look for the user in the database. $query = sprintf("SELECT user_id, username, acess FROM users WHERE username = '%s' AND user_password = '%s' LIMIT 1;", mysql_real_escape_string($u), mysql_real_escape_string($p)); $result = mysql_query($query); if (mysql_num_rows($result) != 1) { echo "Wrong username or password!"; include($_SERVER['DOCUMENT_ROOT'].'/templates/login.tpl'); }else{ $row = mysql_fetch_array($result); $_SESSION['user_id'] = $row['user_ID']; $_SESSION['logged_in'] = TRUE; $_SESSION['username'] = $u; show_userbox(); } $error = 'Please user both your username and password to access your account'; include($_SERVER['DOCUMENT_ROOT'].'/templates/login.tpl'); } }else{ include($_SERVER['DOCUMENT_ROOT'].'/templates/login.tpl'); } }else{ show_userbox(); } ?> Tas ir mans pirmais login scripts, ja kut kas ir nepareiz saciet uzreiz ( ka izlaboot, vai uzrakstit labaak) . problema ir tada: nestrada mysql dala, domaju ka nepareizi sastadits mysql cods... help me please;[ Link to comment Share on other sites More sharing options...
Aleksejs Posted December 8, 2007 Report Share Posted December 8, 2007 Kuru erroru viš šobrīd rād? ;) Link to comment Share on other sites More sharing options...
Da3m0n Posted December 8, 2007 Author Report Share Posted December 8, 2007 SOLVED Link to comment Share on other sites More sharing options...
Recommended Posts