CariDotMy

 Forgot password?
 Register

ADVERTISEMENT

Author: bender

tumpang tanye psl html n php

[Copy link]
Post time 18-12-2008 03:57 PM | Show all posts
lagi 1 kan...based on login id tu...cane kite nak paparkan semua data dlm DB?....kalo yg td just papar username yg login...
Reply

Use magic Report


ADVERTISEMENT


Post time 18-12-2008 04:31 PM | Show all posts
nak unset just letak $_SESSION['username'] = ''; atau session_unset();

nak display semau data user yg login

$sql = "SELECT * FROM table WHERE username = '". $_SESSION['username'] ."'";
Reply

Use magic Report

Post time 18-12-2008 06:11 PM | Show all posts
bile dah panggil $sql = "SELECT * FROM table WHERE username = '". $_SESSION['username'] ."'"; [/quote]..
cane nak display data dlm table tu?...

ni coding utk check login

<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password="1234"; // Mysql password
$db_name="test"; // Database name
$tbl_name="members"; // Table name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

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

// encrypt password
$encrypted_mypassword=md5($mypassword);

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

// 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 $tbl_name 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==1){
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("myusername");
session_register("mypassword");
header("location:login_success.php");
}
else {

?>
            <script language=javascript>
            window.alert (" Wrong Username n Password. Please Login Again");
             </script>
            <?
            echo "<meta http-equiv=\"refresh\" content=\"1;url=main_login.php\">\n";
}
?>


yg ni lak  login success...yg kat sini aku dpt papaerkan username n password je...nak paparkan nama penuh cane?
<?
session_start();
if(!session_is_registered(myusername)){
header("location:main_login.php");
}
?>

<html>
<body>
<p>Welcome <? echo $_SESSION['myusername']; ?> </p>
<p> <? echo $_SESSION['mypassword']; ?></p>
<p> </p>
<p><a href="main_login.php">logout </a></p>
<? session_unset();
?>
</body>
</html>
Reply

Use magic Report

Post time 18-12-2008 11:08 PM | Show all posts
ok2...dah dpt paparkan semua data....thanksss
Reply

Use magic Report

Post time 19-12-2008 12:55 AM | Show all posts
baru nk jawap
Reply

Use magic Report

Post time 19-12-2008 03:28 PM | Show all posts
Reply

Use magic Report

Follow Us
Post time 19-12-2008 11:22 PM | Show all posts
cane ek nak clear semua data lepas logout??
Reply

Use magic Report

Post time 20-12-2008 12:56 AM | Show all posts
data apa yg ko nak clearkan????

kalau session --> session_unset();
Reply

Use magic Report


ADVERTISEMENT


Post time 20-12-2008 12:15 PM | Show all posts
mcm kan bila aku 1st login tu aku panggil semua data dlm DB masuk ke sistem...pastu bile aku masuk pakai id lain..maklumat same gak kuar...nape ye...
Reply

Use magic Report

Post time 20-12-2008 12:28 PM | Show all posts
selalu lepas query aku buat free result

$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
$result = mysql_query("SELECT id,email FROM people WHERE id = '42'");
if (!$result)
{
    echo 'Could not run query: ' . mysql_error();
    exit;
}
$row = mysql_fetch_assoc($result);

dan setiap page buat close conecction

mysql_close($link);
Reply

Use magic Report

Post time 20-12-2008 12:43 PM | Show all posts
ooo..thanks..nanti aku cube...
Reply

Use magic Report

Post time 24-12-2008 09:17 PM | Show all posts
saper tau nak setting date dlm malay?..yg dlm tenet aku jumpe english je..
Reply

Use magic Report

Post time 24-12-2008 11:15 PM | Show all posts
Originally posted by pzan213 at 24-12-2008 09:17 PM
saper tau nak setting date dlm malay?..yg dlm tenet aku jumpe english je..


guna array()
Reply

Use magic Report

Post time 26-12-2008 12:29 PM | Show all posts
boardmanager..tau xpasal ape nie?..aku wat coding utk forgotten password...tp time run dier kuar niee

Warning:  mail() [function.mail]: SMTP server response: 501 5.5.4 Invalid Address in C:\xampp\htdocs\xampp\test\send_password_ac.php on line 52
Cannot send password to your e-mail address
Reply

Use magic Report

Post time 26-12-2008 06:22 PM | Show all posts
1. check ko punya smtp server ok ke tak.......
2. check setting kat php.ini letak smtp server = localhost , port =25
Reply

Use magic Report

Post time 26-12-2008 09:38 PM | Show all posts
nak cek mcm mane tuu?
Reply

Use magic Report


ADVERTISEMENT


Post time 26-12-2008 11:19 PM | Show all posts
guna telnet

The output on my system looks like this:

root@server1# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 server1.example.com ESMTP Postfix (Ubuntu)
ehlo localhost
250-server1.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit
221 2.0.0 Bye
Connection closed by foreign host.
Reply

Use magic Report

Post time 27-12-2008 01:12 AM | Show all posts
Originally posted by BorderManager at 26-12-2008 11:19 PM
guna telnet

The output on my system looks like this:

root@server1# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 server1.exam ...


pening dahhh...hehehe
Reply

Use magic Report

Post time 27-12-2008 01:13 AM | Show all posts
lagi 1 nak tny la...sini ade paparan...lepas tu kan cane kite nak wat link kat paparan tu ye...yg aku paparkan nie xde link...aku nak bile je kite pnggil dr DB...dier akan appar..pastu ader link pada nama or nokp tu..n then bile klik je link tu..dier p page yg ader full detail....

Reply

Use magic Report

Post time 27-12-2008 10:19 AM | Show all posts
aku tak tau pasal smpt window.. selalu guna postfix & sendmail je

ko buat je mcm n....

  1. <a hef="details.php?id=<?= $row['id'] ?>"><?= $row['name'] ?></a>
Copy the Code


kat details.php tu

  1. $sql = "SELECT * FROM user WHERE id = ". $_GET['id'];
Copy the Code
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

 

ADVERTISEMENT


Forum Hot Topic

 

ADVERTISEMENT


 


ADVERTISEMENT
Follow Us

ADVERTISEMENT


Mobile|Archiver|Mobile*default|About Us|CariDotMy

25-1-2025 01:29 PM GMT+8 , Processed in 0.063018 second(s), 30 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

Quick Reply To Top Return to the list