Folgenden Code möchte ich verwenden, um ein PHP Login für meine Seite zu erstellen.
Code: Alles auswählen
<?php// Define your username and password$username = "someuser";$password = "somepassword";if ($_POST['txtUsername'] != $username || $_POST['txtPassword'] != $password) {?><h1>Login</h1><form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p><label for="txtUsername">Username:</label> <br /><input type="text" title="Enter your Username" name="txtUsername" /></p> <p><label for="txtpassword">Password:</label> <br /><input type="password" title="Enter your password" name="txtPassword" /></p> <p><input type="submit" name="Submit" value="Login" /></p></form><?php}else {?><p>This is the protected page. Your private content goes here.</p><?php}?>
Ähndlich diesem Code, nur eben für den Button in meinem Login Script:
Code: Alles auswählen
<a onClick="window.open('main.php','JSfenster', 'toolbar=no,width=800,height=600,left=50,top=100, status=no,scrollbars=auto,resize=no');return false" href="main.php">