Error login admin. :( please help me

This is where you share YOUR scripts with others

Moderators: macek, egami, gesf

rizaldamanik
New php-forum User
New php-forum User
Posts: 1
Joined: Mon Feb 25, 2013 7:27 pm

Error login admin. :( please help me

Postby rizaldamanik » Mon Feb 25, 2013 7:54 pm

Please help me. my script error in admin login.
this my script.

Code: Select all

<?php
session_start();
include ('koneksi.php');
$nama=$_POST['nama'];
$pass=md5($_POST['pass']);

$result=mysql_query("select * from biodata where nama='$nama' and pass='$pass'");

while ($row=mysql_fetch_array($result)){
   $id=$row['id'];
}

$cek_login=mysql_num_rows($result);
if (empty($cek_login))
{
   ?>
   <script language="javascript">alert("Password atau Username Anda salah!!");</script>
   <script> document.location.href='index.php'; </script>
   <?
}
else
{
   session_register('id');
   session_register('nama');
   ?>
   <script> document.location.href='admin.php'; </script>
   <?
}

?>

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: Error login admin. :( please help me

Postby seandisanti » Mon Mar 04, 2013 12:45 pm

Is it giving you an error? what happens when you go to the page? also, you should look into using mysqli or PDO is even better. there are good tutorials available everywhere for both. I always refer people to jream.com's basics videos for a quick crash course in a few minutes.


Return to “Your Scripts”

Who is online

Users browsing this forum: No registered users and 1 guest