BTC USD 84,000.0 Gold USD 4,285.46
Time now: Jun 1, 12:00 AM

SUCCESSFUL~!!! Alhamdulillah

Nak tanya bukankah dah "purified" username dan password tapi kenapa tak guna myusername dan mypassword. Patutlah salah.

Code:
$sql="SELECT * FROM jos_users WHERE username='$myusername' and password='$mypassword'";

cmne 2??
xphm la,,
so kne tuka la myusername jd username ea??
 
Tukar yang asal:

Code:
$sql="SELECT * FROM jos_users WHERE username='[COLOR="Red"]$username[/COLOR]' and password='[COLOR="Red"]$password[/COLOR]'";

Kepada:

Code:
$sql="SELECT * FROM jos_users WHERE username='[COLOR="Blue"]$myusername[/COLOR]' and password='[COLOR="Blue"]$mypassword[/COLOR]'";
 
Tukar yang asal:

Code:
$sql="SELECT * FROM jos_users WHERE username='[COLOR="Red"]$username[/COLOR]' and password='[COLOR="Red"]$password[/COLOR]'";

Kepada:

Code:
$sql="SELECT * FROM jos_users WHERE username='[COLOR="Blue"]$myusername[/COLOR]' and password='[COLOR="Blue"]$mypassword[/COLOR]'";

da tuka,,,
hmmm
 

Attachments

  • 22.8 KB Views: 38
Pertama betulkan kod supaya jadi seperti ini ni:

Code:
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row

if($count){
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("myusername");
session_register("mypassword");
header("location:berjaya.php");
}
else {
echo "Username dan Kata Laluan salah";
}

Atas semak.php tambah:

session_Start();

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<?php
[COLOR="Blue"]session_Start();[/COLOR] < - tambah ni

$mysql_server = "localhost";
$mysql_user = "root";
$mysql_password = "";
$mysql_database = "club_1221";
 
Pertama betulkan kod supaya jadi seperti ini ni:

Code:
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row

if($count){
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("myusername");
session_register("mypassword");
header("location:berjaya.php");
}
else {
echo "Username dan Kata Laluan salah";
}

Atas semak.php tambah:

session_Start();

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<?php
[COLOR="Blue"]session_Start();[/COLOR] < - tambah ni

$mysql_server = "localhost";
$mysql_user = "root";
$mysql_password = "";
$mysql_database = "club_1221";

xjd,,
same je,,
hmm,,
td da try ubah byk kli da..
still error
 
Back
Top
Log in Register