Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-17-2006, 07:18 PM   #1
Vectar
Registered User
 
Join Date: May 2005
Posts: 71
Default Password protection

I have a problem with a passowrd protected page.

I need this file:
Admin.php

PHP Code:
<?php
include("./dbconnect.php");
if(!empty(
$titel)) {
$titel addslashes($titel);
$bericht addslashes($bericht);

$sql "INSERT INTO nieuws (id, titel, bericht) VALUES ('NULL', '$titel','$bericht')";
$query mysql_query($sql) or die("Cannot query the database.<br>" mysql_error());
echo 
"Database Updated.";
} else {
?>
<link href="admin_style.css" rel="stylesheet" type="text/css" />
<form name="nieuws" method="post" action="<?php echo $PHP_SELF?>">
<p><strong>Please fill out all of the following fields:</strong></p>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="95" height="25">Nieuws/Titel*:</td>
<td width="948">
<input type="text" name="titel" size="50"></td>
</tr>
<tr>
<td width="95" height="25">Bericht*:</td>
<td width="948" rowspan="2">
<font size="1">
<textarea name="bericht" rows=10 cols=37></textarea>
</font></td>
</tr>
<tr>
  <td>&nbsp;</td>
</tr>
</table>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form> <?php
}//end this function
?>
to be password protected with the use of this form.

login.html

HTML Code:
<html> 
<head> 
<title>Login</title> 
</head> 
 
<body> 
<form name="login"  method="post" action="protected.php"> 
        Username:  
        <input name="formuser" type="text" id="formuser"> 
        <br> 
        Password:  
        <input name="formpass" type="password" id="formpass"> 
        <br> 
        <input type="submit" name="Submit" value="Submit">  
        <input type="reset" name="Reset" value="Reset">      
                  </form> 
</body> 
</html>
Now i need to add this script into my admin.php and i should work. Thats what the tutorial says but i can not make it work. When i add my content to the protected area it just keeps given errors.

PHP Code:
<?php 
$user 
"your_username_here"
$password "your_password_here"
$formuser $_POST["formuser"]; 
$formpass $_POST["formpass"]; 
if((
$formuser == $user) && ($formpass == $password)){ 
//Protected Content here 

else { 
echo(
"Login Incorrect, Please click back and try again"); 

?>
Vectar is offline   Reply With Quote
Old 10-18-2006, 07:15 PM   #2
peptobismol
Senior Member
 
Join Date: Oct 2005
Posts: 746
Default

in your form, try
<form name="login" method="post" action="protected.php">
Username:
<input name="formuser" type="text" name="formuser">
<br>
Password:
<input name="formpass" type="password" name="formpass">
<br>
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Reset" value="Reset">
</form>
</body>


'name' is what is expected.
peptobismol is offline   Reply With Quote
Reply


Thread Tools
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 Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Password Protection Script klippowiths ActionScript 2.0 3 05-08-2006 05:40 AM
Password protection and direction grimm ActionScript 1.0 (and below) 1 06-30-2005 01:16 PM
Username and password protection lelales ActionScript 2.0 2 05-14-2005 10:30 PM
password protection solarant ActionScript 2.0 2 10-12-2003 11:44 AM
Password protection jellowombat1 ActionScript 1.0 (and below) 1 10-26-2002 09:28 PM


All times are GMT. The time now is 03:26 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.