Posted: Fri Jun 27, 2003 11:51 am
MexicanHat: I'm guessing at the start of each of your closed off pages?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
... I wonder whether you know about matching braces.Mexican Hat wrote:Still confused.
But I know that not right. Where do I put this code:Code: Select all
<?php function valid_login($username, $password) { return ($username == 'name1' && $password == 'pass1') or ($username == 'name2' && $password == 'pass2') or ($username == 'name3' && $password == 'pass3'); } function login_screen($failed = 0) { ?><html> <head><LINK REL=StyleSheet HREF="_style.css" TYPE="text/css"></HEAD> <body bgcolor="#e1e1e1"><center> <form action="<?php echo $_SERVERї'PHP_SELF']; ?>" method='post'> <table border="0"> <TR><TD>Username:<TD><input type="text" name="username" maxlength="20"> <TR><TD>Password: <TD><input type="password" name="password" maxlength="20"> <TR><TD colspan="2"><center><input type="submit" name="submit" value="Login"> </table> </form> <BR><BR> if ($failed) $output .= <font color = red><b>Failed ".$_SESSIONї'count']." time(s) : Keep Trying Biatch</b></font> return $output ."<BR><BR></center></body></html>"; } session_start(); if( ! isset($_SESSIONї'count']) ) $_SESSIONї'count'] = 0; else $_SESSIONї'count']++; if( ! isset($_SESSIONї'logged_in']) ) { if ( ! isset($_POSTї'submit'])) { die (login_screen()); } elseif ( valid_login($_POSTї'username'], $_POSTї'password']) ) { $_SESSIONї'count'] = 1; $_SESSIONї'logged_in'] = 1; } elseif ( $_SESSIONї'count'] > 3 ) { header("Location: baby/index.html"); exit; } else { die ( login_screen($failed = 1) ); } }
PeaceCode: Select all
} session_start(); if( ! isset($_SESSIONї'count']) ) $_SESSIONї'count'] = 0; else $_SESSIONї'count']++; if( ! isset($_SESSIONї'logged_in']) ) { if ( ! isset($_POSTї'submit'])) { die (login_screen()); } elseif ( valid_login($_POSTї'username'], $_POSTї'password']) ) { $_SESSIONї'count'] = 1; $_SESSIONї'logged_in'] = 1; } elseif ( $_SESSIONї'count'] > 3 ) { header("Location: baby/index.html"); exit; } else { die ( login_screen($failed = 1) ); } }ї/
it seems to me like you need to read about these things:Mexican Hat wrote:I'm trying to get the hang of php but it's still confusing. The thing I don't understand is why you can't just put your regular HTML in php you have to change it around with / or '.
Peace
Yeah.m3rajk wrote:heavey: echo, print and things like that don't appear in markup languages...
Code: Select all
<?php
session_start();
if( ! isset($_SESSION['count']) ) $_SESSION['count'] = 0;
else $_SESSION['count']++;
?>