|
 |
|
อยากให้เวลาล็อกอินแล้วไปที่หน้า profile ของผู้ใช้ในทันที ช่วยแนะนำหน่อยครับ |
|
 |
|
|
 |
 |
|
ผมเพิ่งเริ่มหัดphp ครับ คือผมทำระบบสมาชิก ทีสมาชิกสามารถเข้าไปแก้ใขข้อมูลที่จะแสดงในเพจของตัวเองน่ะครับ
ที่อยากถามก็คือจะทำยังใงเวลาที่ผู้ใช้ล็อกอินแล้วมัน direct ไปที่หน้า profile ของผู้ใช้นั้นๆเลยน่ะครับ
นี่โคดล็อกอินที่ผมมี
Code (PHP)
<?php
session_start();
if($_POST) {
$email = $_POST['email'];
$Password = $_POST['Password'];
include("gubig.inc.php");
my_connect();
$sql = "SELECT * FROM supplier WHERE email = '$email' AND Password = '$Password';";
$result = mysql_query($sql);
if(mysql_num_rows($result) != 1) {
echo "<font size=5 color=red>wrong username or password<p />
<a href=\"javascript: history.back()\">back to complete</a></font>";
}
else {
$_SESSION['email'] = mysql_result($result, 0, "email");
$_SESSION['Password'] = mysql_result($result, 0, "Password");
<?php
session_start();
if($_POST) {
$email = $_POST['email'];
$Password = $_POST['Password'];
include("gubig.inc.php");
my_connect();
$sql = "SELECT * FROM supplier WHERE email = '$email' AND Password = '$Password';";
$result = mysql_query($sql);
if(mysql_num_rows($result) != 1) {
echo "<font size=5 color=red>wrong username or password<p />
<a href=\"javascript: history.back()\">back to complete</a></font>";
}
else {
$_SESSION['email'] = mysql_result($result, 0, "email");
$_SESSION['Password'] = mysql_result($result, 0, "Password");
header("Location:job/manathai/jshow_mtp.php");
echo "welcome to gubig family";
}
exit;
}
?>
<!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>supplier login page</title>
<style type="text/css">
<!--
body,td,th {
font-family: Century Gothic, CordiaUPC, Calibri;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
body {
background-image: url(../Artwork/login.gif);
background-repeat: no-repeat;
}
-->
</style></head>
<body>
<table width="339" height="58" border="0">
<tr>
<td height="54"><a href="../../home.php">big chat</a> | <a href="../../supplier.php">register as supplier</a></td>
</tr>
</table>
<table width="991" height="142" border="0">
<tr>
<td height="138"> </td>
</tr>
</table>
<table width="993" height="298" border="0">
<tr>
<td height="294"><div align="center">
<form id="form1" name="form1" method="post" action="">
<p><strong>already register as a supplier, please log in</strong></p>
<table width="442" border="0">
<tr>
<td width="168"><div align="left">company name</div></td>
<td width="264"><label>
<div align="left">
<input name="name" type="text" id="name" size="50" />
</div>
</label></td>
</tr>
<tr>
<td><div align="left">email address</div></td>
<td><label>
<div align="left">
<input name="email" type="text" id="email" size="50" />
</div>
</label></td>
</tr>
<tr>
<td><div align="left">password</div></td>
<td><label>
<div align="left">
<input name="Password" type="password" id="Password" size="30" />
</div>
</label></td>
</tr>
</table>
<p>
<label>
<input type="submit" name="login" id="login" value="login" />
</label>
</p>
</form>
</div></td>
</tr>
</table>
<table width="991" height="147" border="0">
<tr>
<td height="143"> </td>
</tr>
</table>
<table width="992" border="0">
<tr>
<td><div align="center"><a href="../../index.php">home</a></div></td>
<td><div align="center"><a href="../../about_us.php">idea</a></div></td>
<td><div align="center"><a href="../../supplier login.php">supplier</a></div></td>
<td><div align="center"><a href="../../career.php">careers</a></div></td>
<td><div align="center"><a href="../../terms_of_use.php">privacy policy</a></div></td>
<td><div align="center">support</div></td>
<td><div align="center">site map</div></td>
<td><div align="center"><a href="../../contact_us.php">contact us</a></div></td>
</tr>
</table>
</body>
</html>
echo "welcome to gubig family";
}
exit;
}
?>
<!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>supplier login page</title>
<style type="text/css">
<!--
body,td,th {
font-family: Century Gothic, CordiaUPC, Calibri;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
body {
background-image: url(../Artwork/login.gif);
background-repeat: no-repeat;
}
-->
</style></head>
<body>
<table width="339" height="58" border="0">
<tr>
<td height="54"><a href="../../home.php">big chat</a> | <a href="../../supplier.php">register as supplier</a></td>
</tr>
</table>
<table width="991" height="142" border="0">
<tr>
<td height="138"> </td>
</tr>
</table>
<table width="993" height="298" border="0">
<tr>
<td height="294"><div align="center">
<form id="form1" name="form1" method="post" action="">
<p><strong>already register as a supplier, please log in</strong></p>
<table width="442" border="0">
<tr>
<td width="168"><div align="left">company name</div></td>
<td width="264"><label>
<div align="left">
<input name="name" type="text" id="name" size="50" />
</div>
</label></td>
</tr>
<tr>
<td><div align="left">email address</div></td>
<td><label>
<div align="left">
<input name="email" type="text" id="email" size="50" />
</div>
</label></td>
</tr>
<tr>
<td><div align="left">password</div></td>
<td><label>
<div align="left">
<input name="Password" type="password" id="Password" size="30" />
</div>
</label></td>
</tr>
</table>
<p>
<label>
<input type="submit" name="login" id="login" value="login" />
</label>
</p>
</form>
</div></td>
</tr>
</table>
<table width="991" height="147" border="0">
<tr>
<td height="143"> </td>
</tr>
</table>
<table width="992" border="0">
<tr>
<td><div align="center"><a href="../../index.php">home</a></div></td>
<td><div align="center"><a href="../../about_us.php">idea</a></div></td>
<td><div align="center"><a href="../../supplier login.php">supplier</a></div></td>
<td><div align="center"><a href="../../career.php">careers</a></div></td>
<td><div align="center"><a href="../../terms_of_use.php">privacy policy</a></div></td>
<td><div align="center">support</div></td>
<td><div align="center">site map</div></td>
<td><div align="center"><a href="../../contact_us.php">contact us</a></div></td>
</tr>
</table>
</body>
</html>
ตอนนี้ที่เจอคือพอล็อกอินแล้วมันก้ตรงไปตามนี้ header("Location:job/manathai/jshow_mtp.php"); เราจะทำยังใงให้มันไปเพจที่ถูกต้องโดยใช้ข้อมูลจาก username กับ password ที่ใช้ล็อกอินครับ
Tag : PHP, MySQL, Action Script, Ajax, jQuery, WebService

|
|
 |
 |
 |
 |
Date :
2011-02-10 17:18:32 |
By :
thanadol |
View :
834 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณครับพี่วิน เดี๋ยวจะลองดูนะครับ ขอบคุณครับ
|
 |
 |
 |
 |
Date :
2011-02-11 06:22:24 |
By :
thanadol |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|