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

SUCCESSFUL~!!! Alhamdulillah

<!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
include("../config.php");




// username and password sent from form
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];

// To protect MySQL injection (more detail about MySQL injection)
//$myusername = stripslashes($myusername);
//$mypassword = stripslashes($mypassword);
//$myusername = mysql_real_escape_string($myusername);
//$mypassword = mysql_real_escape_string($mypassword);

$sql="SELECT * FROM jos_users WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);

// Mysql_num_row is counting table row
$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");

//new code from me
$_SESSION['username']=$myusername;
$_SESSION['mypassword']=$mypassword;
header("location:berjaya.php");
}
else {
echo "Username dan Kata Laluan salah";
}
?>
<body>
</body>
</html>

copy code ini dalam semak.php
 
..ni error nye,,,

error mcm nih kena pastikan takda ruang kosong selepas dan sebelum buka kata <?php dan ?>

PHP:
<?php
adalah ok

PHP:
     <?php
akan kuar error headers already sent.
 
error mcm nih kena pastikan takda ruang kosong selepas dan sebelum buka kata <?php dan ?>

PHP:
<?php
adalah ok

PHP:
     <?php
akan kuar error headers already sent.

da cek,,
sume ok,,
but still kua error
 
<!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
include("../config.php");




// username and password sent from form
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];

// To protect MySQL injection (more detail about MySQL injection)
//$myusername = stripslashes($myusername);
//$mypassword = stripslashes($mypassword);
//$myusername = mysql_real_escape_string($myusername);
//$mypassword = mysql_real_escape_string($mypassword);

$sql="SELECT * FROM jos_users WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);

// Mysql_num_row is counting table row
$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");

//new code from me
$_SESSION['username']=$myusername;
$_SESSION['mypassword']=$mypassword;
header("location:berjaya.php");
}
else {
echo "Username dan Kata Laluan salah";
}
?>
<body>
</body>
</html>

copy code ini dalam semak.php

huwaaaaaaaaaaaaaaa:((:((:((:((
error same,,,
jap,y db_kucing 2 nk kne import ke dlm dtbse ke
 
ce TT email kat aku file² dia siap ngan database. aku cuba try test tgk. :)

email aku
 
Fail Semak, cuba gantikan dengan ni. Pasti berjaya :P:


<!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

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

$conn = mysql_connect($mysql_server, $mysql_user, $mysql_password);

mysql_select_db($mysql_database, $conn);


// username and password sent from form
$myusername=$_POST['username'];
$mypassword=$_POST['password'];

// To protect MySQL injection (more detail about MySQL injection)
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);

$result = mysql_query("SELECT * FROM jos_users WHERE username='$myusername' and password='$mypassword'", $conn) or die ('Could not connect');

// If result matched $myusername and $mypassword, table row must be 1 row

if(mysql_num_rows($result) > 0){
// Register $myusername, $mypassword and redirect to file "login_success.php"
$_SESSION['username'] = $myusername;
$_SESSION['password'] = $mypassword;
header("location:berjaya.php");
}
else {
echo "Username dan Kata Laluan salah";
}
?>

<body>
</body>
</html>
 
Last edited:
Ye ke? Saya dah test keseluruhan fail. Jadi, sila gantikan coding dibawah ni:

fail semak.php

<!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

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

$conn = mysql_connect($mysql_server, $mysql_user, $mysql_password);

mysql_select_db($mysql_database, $conn);


// username and password sent from form
$myusername=$_POST['username'];
$mypassword=$_POST['password'];

// To protect MySQL injection (more detail about MySQL injection)
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);

$result = mysql_query("SELECT * FROM jos_users WHERE username='$myusername' and password='$mypassword'", $conn) or die ('Could not connect');

// If result matched $myusername and $mypassword, table row must be 1 row

if(mysql_num_rows($result) > 0){
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_start();
$_SESSION['username'] = $myusername;
$_SESSION['password'] = $mypassword;
header("location:berjaya.php");
}
else {
echo "Username dan Kata Laluan salah";
}
?>

<body>
</body>
</html>

fail berjaya.php

<!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>

<?
session_start();

if (($_SESSION['username'] != '') && ($_SESSION['password'] != '')){
echo 'Login Success'; // Ganti dengan apa yang patut
}
else echo 'Cannot Login'; // ini boleh ganti dengan apa yang patut
?>


by the way, edit php code guna apa? Cuba guna NetBeans untuk edit php and run test. Sure boleh fix
 
Last edited:
Ye ke? Saya dah test keseluruhan fail. Jadi, sila gantikan coding dibawah ni:

fail semak.php



fail berjaya.php




by the way, edit php code guna apa? Cuba guna NetBeans untuk edit php and run test. Sure boleh fix

sy try,,
sy edit gne dreamweavr,,
sbb sy kne synchronze koding2 2
 
Last edited:
Back
Top
Log in Register