Go Back   Webmaster Malaysia Forum » Website Design & Development » Website Programming

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-01-2005, 05:49 PM
marco's Avatar
Novice Webmaster
 
Join Date: Sep 2004
Location: Shah Alam
Posts: 43
Rep Power: 0
marco is on a distinguished road
Send a message via MSN to marco Send a message via Yahoo to marco
Question Login Session -PHP prob.

Bile enter username dan password, msg kjuar camni..

Method Not Allowed
The requested method POST is not allowed for the URL /login.php.


--------------------------------------------------------------------------------

Apache/1.3.33 Server at andy Port 80


Coding Login.php:

<?
include 'conf.php';
if($_POST)
{

$_SESSION['user'] = send_login($_POST['username'],$_POST['password']);
if(!empty($_SESSION['user']['username']))
{
$_SESSION['user']['auth'] = True;
}

}
function send_login($username,$password)
{
$qid = mysql_query("select username from login where username='$username'
and password='$password'");
$data = mysql_fetch_array($qid);
if(!empty($data))
{
return $data;
}
else
{
return false;
}
}
pres($_SESSION);
?>


Coding Form:

<form name="form1" method="post" action="login.php">
<table width="70%" border="1" cellspacing="0"
cellpadding="0">
<tr>
<td height="21">Username</td>
<td><input name="username" type="text" id="username"></td>
</tr>
<tr>
<td height="21">Password</td>
<td><input name="password" type="text" id="password"></td>
</tr>
<tr>
<td height="21">&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
<a href="logout.php">logout</a><br>
<a href="index.php">Main</a>


Coding utk conf.php:

<?

//ni untuk menghubungkan ke mySQL

mysql_pconnect('localhost','username','password');
mysql_select_db('marco');



session_start();


function pres ($data)

{
echo '<pre>';
var_dump($data);
echo '</pre>';
}


function require_login()
{
if($_SESSION['user']['auth'])
}
echo 'OK!';

echo $_SESSION['user'];
}

else

{
header("Location: login.php);
}
}

?>


Apache dah running.. tapi tak leh. Ape masalahnya?
__________________
regards,

Blog : The Living Earendur
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
login annuR Website Programming 2 18-05-2006 02:32 PM
session login sheismaria Website Programming 2 18-05-2006 02:20 PM
css prob on ie prozone Website Design 0 21-10-2005 11:37 PM
login php with session boby Website Programming 3 18-08-2005 04:20 PM
calendar prob, need help PLEASE Devilz Website Design 3 22-07-2005 01:16 PM


All times are GMT +8. The time now is 01:55 PM. Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.


WebmasterMalaysia.com is Proudly Hosted by Exabytes Semi Dedicated Server.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61