Lc_KiT : 個人主頁 - 相簿 - 訂閱  [ QOOZA - 論壇 - 登入 ]
406 - Not Acceptable
 
2011 年 2 月 12 日  星期六 2011-02-12 09:14 PM


[note] php login

Name:
Password:
Cookie time:
<form id="logfrm" name="logfrm" method="post"
		action="/login.php">
    <table>
        <tbody>
            <tr>
                <td>Name:</td>
                <td><input id="logname" name="logname"
			type="text" value="" /></td>
            </tr>
            <tr>
                <td>Password:</td>
                <td><input id="logpsd" name="logpsd"
			type="password" value="" /></td>
            </tr>
            <tr>
                <td>Cookie time:</td>
                <td>
                <div id="coki">
		<input type="radio" name="cokiset" id="c1" />
		<label for="c1">1hr</label>
 		<input type="radio" name="cokiset" id="c2" />
		<label for="c2">1day</label>
 		<input type="radio" name="cokiset" id="c3" />
		<label for="c3">30days</label></div>
                </td>
            </tr>
            <tr>
                <td><input id="logsubmit" name="logsubmit"
			type="submit" value="Submit" /></td>
                <td><input id="logreset" name="logreset"
			type="reset" value="Reset" /></td>
            </tr>
        </tbody>
    </table>
</form>
mysql	 > Create database database_name;
mysql	 > Use database_name;
mysql	 > Create table table_name(
	-> uid smallint(4) unsigned zerofill not null auto_increment primary key,
	-> username varchar(16) not null,
	-> password varchar(16) not null
	-> );
mysql	 > insert into table_name(username, password)
	-> values("new_username", "new_password");
mysql	 >

Database :
	location=localhost(127.0.0.1) ,
	name=root ,
	password=password
Table :
	Name=table_name
+-----+----------+----------+
| uid | username | password |
+-----+----------+----------+

<?
$username= $_POST['logname'];
$userpassword= $_POST['logpsd'];
$db_link_id= mysql_connect("localhost", "root", "password");
mysql_select_db("database_name",$db_link_id);
$query_string= "select * from table_name where username='$username' and password='$password'";
$result= mysql_query($query_string, $db_link_id);
mysql_close();
$record= mysql_fetch_row($result);
$sn= mysql_num_row($result);
?>
<html>
<body>
<? if (!$sn){ ?>
<table><tr>
for ($i=0; $i<$sn; $i++){ ?>
<td> <? echo $record[$i] ?></td>
<? };?>
</tr></table>
<? }else{?>
<p>wrong password or user not exist</p><br />
<a href="/">Back</a>
<? };?>
</body>
</html>


★Kit↘..

 [ 訪客留言(0) ] [ 編輯日誌 ] [ 分享至FACEBOOK ]
MySelf
暱稱: Tikwal
性別: 男
國家: 香港
地區: 元朗區
++水晶音樂盒++
Mariage D'Amour
最近訪客
最近沒有訪客
訪客留言
最近三個月尚無任何留言
最新文章
贏到請飲野 lol
[VB.Net] 中國象棋
[.Net] Classes / Imp...
[轉][API]4個keybd 模...
[VB2010]常玩的, 接水...
文章分類
全部 (32)
API (5)
雜談 (2)
DataBase (2)
M$ (9)
php (1)
VB.Net (5)
純粹搞笑 (4)
網頁 (5)
未分類 (1)
日誌統計
文章總數: 32
留言總數: 28
今日人氣: 8
累積人氣: 1914