What does the PHP error message "Use of undefined constant login - assumed 'login" -
before hosting there no problems, after upload them appear 000webhost notice "use of undefined constant login - assumed 'login' in /storage/ssd4/109/2310109/public_html/surat/login.php on line 26"
if (isset($_post[login])){ $user = $_post['user']; $pass = md5($_post['pass']); $login=mysql_query("select * phpmu_user username='$user' , password='$pass' , status='y'"); $cocok=mysql_num_rows($login); $r=mysql_fetch_array($login); if ($cocok > 0){ $_session[login] = $r[id_user]; $_session[username] = $r[username]; $_session[namalengkap] = $r[nama_lengkap]; $_session[password] = $r[password]; $_session[level] = $r[level]; $_session[unit] = $r[unit_kerja]; header('location:index.php'); }else{ echo "<script>window.alert('maaf, anda tidak memiliki akses'); window.location=('index.php')</script>"; } }
because php can't know if login key, or variable.
2 solutions :
if (isset($_post['login'])){
or ...
if (isset($_post[$login])){
but in case, think it's key. , same problem $_session array.
Comments
Post a Comment