Putting HTML in PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
Mexican Hat
Forum Newbie
Posts: 19
Joined: Sat Mar 08, 2003 8:35 pm
Location: Baltimore, Maryland
Contact:

Putting HTML in PHP

Post by Mexican Hat »

Can some one help me put my html code into php.

This is my code:
<html><head><title> mexican hat designs </title>

<style>
<!--
a.email { text-decoration:none; }
-->
</style>

<script language="javascript">
<!--
oneOff = new Image
oneOff.src = "home1.gif"
oneOn = new Image
oneOn.src = "home2.gif"
twoOff = new Image
twoOff.src = "aboutme1.gif"
twoOn = new Image
twoOn.src = "aboutme2.gif"
threeOff = new Image
threeOff.src = "portfolio1.gif"
threeOn = new Image
threeOn.src = "portfolio2.gif"
fourOff = new Image
fourOff.src = "information1.gif"
fourOn = new Image
fourOn.src = "information2.gif"
fiveOff = new Image
fiveOff.src = "contactme1.gif"
fiveOn = new Image
fiveOn.src = "contactme2.gif"
spacer = new Image
spacer.src = "mexicanhatdesigns.gif"
oneOver = new Image
oneOver.src = "home3.gif"
twoOver = new Image
twoOver.src = "aboutme3.gif"
threeOver = new Image
threeOver.src = "portfolio3.gif"
fourOver = new Image
fourOver.src = "information3.gif"
fiveOver = new Image
fiveOver.src = "contactme3.gif"

function changePic(picName,thePic) {
document[picName].src = eval(thePic + ".src")
}

//-->
</script>

</head><body bgcolor="#FFFFFF" alink="#000000" link="#C00000" vlink="#C00000">

<script language="javascript">
function go() {
var user = document.login.user.value;
var pass = document.login.pass.value;
if ( pass == "" ) { alert("Invalid Password!"); }
else { location = user.toLowerCase() + "/" + pass.toLowerCase() + ".htm" }
}

//-->
</script>

<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0"><tr valign="middle" align="center"><td><table width="635" cellpadding="0" cellspacing="0" border="0">
<tr><td width="45" height="150" background="image1.gif"></td><td width="345" height="150" background="image2.gif"></td><td width="245" heigth="150" background="image3.gif"></td></tr>

<tr><td width="45" height="85" background="image4.gif"></td><td width="345" height="85" background="image5.gif"><img src="image6.gif" width="19" height="55"><a href="home.html" onMouseOver="changePic('picA','oneOn');changePic('sidePic','oneOver')" onMouseOut="changePic('picA','oneOff');changePic('sidePic','spacer')"><img src="home1.gif" name="picA" width="47" height="55" border="0"></a><img src="image7.gif" width="18" heigth="55"><a href="aboutme.html" onMouseOver="changePic('picB','twoOn');changePic('sidePic','twoOver')" onMouseOut="changePic('picB','twoOff');changePic('sidePic','spacer')"><img src="aboutme1.gif" name="picB" width="47" height="55" border="0"></a><img src="image7.gif" width="18" heigth="55"><a href="portfolio.html" onMouseOver="changePic('picC','threeOn');changePic('sidePic','threeOver')" onMouseOut="changePic('picC','threeOff');changePic('sidePic','spacer')"><img src="portfolio1.gif" name="picC" width="47" height="55" border="0"></a><img src="image7.gif" width="18" heigth="55"><a href="information.html" onMouseOver="changePic('picD','fourOn');changePic('sidePic','fourOver')" onMouseOut="changePic('picD','fourOff');changePic('sidePic','spacer')"><img src="information1.gif" name="picD" width="47" height="55" border="0"></a><img src="image7.gif" width="18" heigth="55"><a href="contactme.html" onMouseOver="changePic('picE','fiveOn');changePic('sidePic','fiveOver')" onMouseOut="changePic('picE','fiveOff');changePic('sidePic','spacer')"><img src="contactme1.gif" name="picE" width="47" height="55" border="0"></a><img src="image6.gif" width="19" heigth="55"></td><td width="245" height="85" background="home4.jpg"></td></tr>

<tr><td width="45" height="250"><img src="mexicanhatdesigns.gif" name="sidePic" width="45" height="250" border="0"></td><td width="345" height="250"><table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"><tr><td align="center" valign="middle"><table width="239" cellpadding="0" cellspacing="0" border="0"><tr><td><form name="login" style="margin-bottom: 0px;"><table cellpadding="0" cellspacing="3" border="0"><tr><td><font face="Arial" size="1" Color="#000000">Username:</td><td><input type="text" name="user" style="border: solid 1px #C0C0C0; background: #FFFFFF; color: #000000;" size="26"></td></tr><tr><td><font face="Arial" size="1" Color="#000000">Password:</td><td><input type="password" name="pass" style="border: solid 1px #C0C0C0; background: #FFFFFF; color: #000000;" size="26"></td></tr><tr><td></td><td><div align="center"><input type="button" name="login" value="login" style="border: solid 1px #C0C0C0; background: #FFFFFF; color: #000000;" onMouseOver="style.backgroundColor='#FFFFFF'; style.cursor='hand';" onMouseOut="style.backgroundColor='#FFFFFF';" onClick="go()"></td></tr></table></form></td></tr></table></td></tr></table></td>

<td width="245" height="250" background="home5.jpg"></td></tr>
<tr><td width="45" height="75" background="image8.gif"></td><td width="345" height="75" background="image9.gif">

<div align="center"><table cellpadding="0" cellspacing="7" border="0"><tr><td><div align="center"><font face="Arial" size="1" color="#000000">http://www.mexicanhatdesigns.com</td></tr><tr><td><div align="center"><font face="Arial" size="1" color="#000000">e-mail: <a class="email" href="mailto:help@mexicanhatdesigns.com">help@mexicanhatdesigns.com</a></td></tr><tr><td><div align="center"><font face="Arial" size="1" color="#000000">&copy copyright 2003 mexican hat designs. all rights reserved.</td></tr></table></td>
<td width="245" height="75" background="image10.gif"></td></tr></table></td></tr></table>

</body></html>
And I want to replace it with the HTML code in the PHP. Here is the PHP file.
<?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) {
$output = "<HTML>"
."<HEAD><LINK REL=StyleSheet HREF=\"_style.css\" TYPE=\"text/css\"></HEAD>"
."<BODY bgcolor=#e1e1e1><center>"
."<form action='". $_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) );
}
}
?>
I tried to put my HTML in there but when I tested it out it didn't work. So I'm guessing I doing it wrong. If anyone could help me that would be great.

Peace 8)
jamesm87
Forum Newbie
Posts: 21
Joined: Sat May 31, 2003 1:54 pm
Location: London, UK

Post by jamesm87 »

ok... What i do is put the HTML in wordpad then click replace. Search " and replace with '. press replace all.

Then go into your php code and write

Code: Select all

echo " your html code ";
That should do it
jamesm87
Forum Newbie
Posts: 21
Joined: Sat May 31, 2003 1:54 pm
Location: London, UK

Post by jamesm87 »

There I have done it for you. just insert it in your php script

Code: Select all

echo "<style> 
<!-- 
a.email &#123; text-decoration:none; &#125; 
--> 
</style> 

<script language='javascript'> 
<!-- 
oneOff = new Image 
oneOff.src = 'home1.gif' 
oneOn = new Image 
oneOn.src = 'home2.gif' 
twoOff = new Image 
twoOff.src = 'aboutme1.gif' 
twoOn = new Image 
twoOn.src = 'aboutme2.gif' 
threeOff = new Image 
threeOff.src = 'portfolio1.gif' 
threeOn = new Image 
threeOn.src = 'portfolio2.gif' 
fourOff = new Image 
fourOff.src = 'information1.gif' 
fourOn = new Image 
fourOn.src = 'information2.gif' 
fiveOff = new Image 
fiveOff.src = 'contactme1.gif' 
fiveOn = new Image 
fiveOn.src = 'contactme2.gif' 
spacer = new Image 
spacer.src = 'mexicanhatdesigns.gif' 
oneOver = new Image 
oneOver.src = 'home3.gif' 
twoOver = new Image 
twoOver.src = 'aboutme3.gif' 
threeOver = new Image 
threeOver.src = 'portfolio3.gif' 
fourOver = new Image 
fourOver.src = 'information3.gif' 
fiveOver = new Image 
fiveOver.src = 'contactme3.gif' 

function changePic(picName,thePic) &#123; 
document&#1111;picName].src = eval(thePic + '.src') 
&#125; 

//--> 
</script> 

</head><body bgcolor='#FFFFFF' alink='#000000' link='#C00000' vlink='#C00000'> 

<script language='javascript'> 
function go() &#123; 
var user = document.login.user.value; 
var pass = document.login.pass.value; 
if ( pass == '' ) &#123; alert('Invalid Password!'); &#125; 
else &#123; location = user.toLowerCase() + '/' + pass.toLowerCase() + '.htm' &#125; 
&#125; 

//--> 
</script> 

<table width='100%' height='100%' cellspacing='0' cellpadding='0' border='0'><tr valign='middle' align='center'><td><table width='635' cellpadding='0' cellspacing='0' border='0'> 
<tr><td width='45' height='150' background='image1.gif'></td><td width='345' height='150' background='image2.gif'></td><td width='245' heigth='150' background='image3.gif'></td></tr> 

<tr><td width='45' height='85' background='image4.gif'></td><td width='345' height='85' background='image5.gif'><img src='image6.gif' width='19' height='55'><a href='home.html' onMouseOver='changePic('picA','oneOn');changePic('sidePic','oneOver')' onMouseOut='changePic('picA','oneOff');changePic('sidePic','spacer')'><img src='home1.gif' name='picA' width='47' height='55' border='0'></a><img src='image7.gif' width='18' heigth='55'><a href='aboutme.html' onMouseOver='changePic('picB','twoOn');changePic('sidePic','twoOver')' onMouseOut='changePic('picB','twoOff');changePic('sidePic','spacer')'><img src='aboutme1.gif' name='picB' width='47' height='55' border='0'></a><img src='image7.gif' width='18' heigth='55'><a href='portfolio.html' onMouseOver='changePic('picC','threeOn');changePic('sidePic','threeOver')' onMouseOut='changePic('picC','threeOff');changePic('sidePic','spacer')'><img src='portfolio1.gif' name='picC' width='47' height='55' border='0'></a><img src='image7.gif' width='18' heigth='55'><a href='information.html' onMouseOver='changePic('picD','fourOn');changePic('sidePic','fourOver')' onMouseOut='changePic('picD','fourOff');changePic('sidePic','spacer')'><img src='information1.gif' name='picD' width='47' height='55' border='0'></a><img src='image7.gif' width='18' heigth='55'><a href='contactme.html' onMouseOver='changePic('picE','fiveOn');changePic('sidePic','fiveOver')' onMouseOut='changePic('picE','fiveOff');changePic('sidePic','spacer')'><img src='contactme1.gif' name='picE' width='47' height='55' border='0'></a><img src='image6.gif' width='19' heigth='55'></td><td width='245' height='85' background='home4.jpg'></td></tr> 

<tr><td width='45' height='250'><img src='mexicanhatdesigns.gif' name='sidePic' width='45' height='250' border='0'></td><td width='345' height='250'><table width='100%' height='100%' cellpadding='0' cellspacing='0' border='0'><tr><td align='center' valign='middle'><table width='239' cellpadding='0' cellspacing='0' border='0'><tr><td><form name='login' style='margin-bottom: 0px;'><table cellpadding='0' cellspacing='3' border='0'><tr><td><font face='Arial' size='1' Color='#000000'>Username:</td><td><input type='text' name='user' style='border: solid 1px #C0C0C0; background: #FFFFFF; color: #000000;' size='26'></td></tr><tr><td><font face='Arial' size='1' Color='#000000'>Password:</td><td><input type='password' name='pass' style='border: solid 1px #C0C0C0; background: #FFFFFF; color: #000000;' size='26'></td></tr><tr><td></td><td><div align='center'><input type='button' name='login' value='login' style='border: solid 1px #C0C0C0; background: #FFFFFF; color: #000000;' onMouseOver='style.backgroundColor='#FFFFFF'; style.cursor='hand';' onMouseOut='style.backgroundColor='#FFFFFF';' onClick='go()'></td></tr></table></form></td></tr></table></td></tr></table></td> 

<td width='245' height='250' background='home5.jpg'></td></tr> 
<tr><td width='45' height='75' background='image8.gif'></td><td width='345' height='75' background='image9.gif'> 

<div align='center'><table cellpadding='0' cellspacing='7' border='0'><tr><td><div align='center'><font face='Arial' size='1' color='#000000'>http://www.mexicanhatdesigns.com</td></tr><tr><td><div align='center'><font face='Arial' size='1' color='#000000'>e-mail: <a class='email' href='mailto:help@mexicanhatdesigns.com'>help@mexicanhatdesigns.com</a></td></tr><tr><td><div align='center'><font face='Arial' size='1' color='#000000'>&copy copyright 2003 mexican hat designs. all rights reserved.</td></tr></table></td> 
<td width='245' height='75' background='image10.gif'></td></tr></table></td></tr></table> 
";
User avatar
Mexican Hat
Forum Newbie
Posts: 19
Joined: Sat Mar 08, 2003 8:35 pm
Location: Baltimore, Maryland
Contact:

Post by Mexican Hat »

Hey Thanks A lot. I have one question. What does the "echo" do?

Peace 8)
User avatar
werlop
Forum Commoner
Posts: 68
Joined: Sat Mar 22, 2003 2:50 am
Location: /dev/null

Post by werlop »

What does the "echo" do?

echo() is an inbuilt function in php. It is very similar to print ()

Basically what it does is output whatever string you pass it, for example

Code: Select all

<?php
echo("This string");
?>
outputs:

This string

You can also pass it variables.

The best place to answer questions like yours is the PHP manual.
User avatar
discobean
Forum Commoner
Posts: 49
Joined: Sun May 18, 2003 9:06 pm
Location: Sydney, Australia
Contact:

use <<<HTML;

Post by discobean »

using single quotes instead of double quotes in your HTML isn't the best way to go...

so instead.. use this..

Code: Select all

<?php
echo <<<HTML
<html>
<body style="background-color: #fff">
  here is my body
</body>
</html>
HTML;
?>
double quotes arn't an issue here
you can still put your {$variables} inside the text too..

Marz.
User avatar
Mexican Hat
Forum Newbie
Posts: 19
Joined: Sat Mar 08, 2003 8:35 pm
Location: Baltimore, Maryland
Contact:

?

Post by Mexican Hat »

Does it really matter where I can put "echo <<<HTML" just anywhere before the html.

Peace 8)
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

Put it wherever you want the HTML to be inside your PHP script. Just make sure if you use echo that it is inside both the <? and ?>. If its outside of them you can just use regular HTML.
User avatar
Mexican Hat
Forum Newbie
Posts: 19
Joined: Sat Mar 08, 2003 8:35 pm
Location: Baltimore, Maryland
Contact:

Is this right?

Post by Mexican Hat »

Is this right? Here is my code:

<?php
echo <<<HTML
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) {
$output = <html><head><title> mexican hat designs
</title></head><body>
<table width="400" height="100 cellpadding="3" cellspacing="3" border="1">
<tr>
<td><font face="Arial" size="5" color="black"> Welcome
</td>
</tr>
</table>
</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) );
}
}
HTML;
?>

But when I veiw it in my browser it give me a message like this:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/virtual/site125/fst/var/www/html/logine.php on line 22
so I don't know whats wrong? Please help :(

Peace 8)
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

Personally I would not use echo <<<HTML because I've never even heard of it. I just assumed it would be used like a normal echo. Please read more about echo() at http://www.php.net/echo. I'm not sure if this is what you are looking for . . .

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) {
echo "<html><head><title> mexican hat designs
</title></head><body>
<table width="400" height="100" cellpadding="3" cellspacing="3" border="1">
<tr>
<td><font face="Arial" size="5" color="black"> Welcome
</td>
</tr>
</table>
</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) );
        }
}
?>
User avatar
Mexican Hat
Forum Newbie
Posts: 19
Joined: Sat Mar 08, 2003 8:35 pm
Location: Baltimore, Maryland
Contact:

Post by Mexican Hat »

Why do they make it so hard to add html and javascript into php. There has to be an easier way.

Anyway I try to do what you have with the echo and then the /"

I hope it works this time. For the javascript in my code, will it work like this /' I guess. Anyway thanks for all your help.

Peace 8)
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

It is actually pretty easy, but I don't know why you were trying to do this:

Code: Select all

<?php
function login_screen($failed = 0) { 
$output = <html><head><title> mexican hat designs 
</title></head><body> 
<table width="400" height="100 cellpadding="3" cellspacing="3" border="1"> 
<tr> 
<td><font face="Arial" size="5" color="black"> Welcome 
</td> 
</tr> 
</table> 
</body></html> 
}

?>
Why would you make a variable equal to all that HTML code? An easier way would be to just

Code: Select all

<?php
echo "HTML stuff here . . ."; 
?>
in an if statement. The if statement would make sure that the login was succesful and then you could output the code you wanted. Also, if you were trying just to output HTML, it works inside of the die() command. It would be just as easy to echo() it though.

Code: Select all

<?php
die ("<html><head><title> mexican hat designs </title></head>");
?>
User avatar
Mexican Hat
Forum Newbie
Posts: 19
Joined: Sat Mar 08, 2003 8:35 pm
Location: Baltimore, Maryland
Contact:

Post by Mexican Hat »

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 8)
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Re: Putting HTML in PHP

Post by m3rajk »

ok. i suggest forgetting everything before my post....why? simple... when i frist got here all i used was echo commands. one for each line of html.. it gets really ugly realy fast.

this is what was suggested for me when dealing with chunks that are html ... only i'm taking the html you gave and using that in place of anything i wrote

Code: Select all

<?php 

/* php code needed before html output */

   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'>

<!-- the rest of your html -->

if you have large chunks of php to put in, then make a linebreak in your html and have

<?php
/* php code */
?>

set up with a space ...sorta like i have here in this writing. it'll look neater and be helpful to your maintenece programmer

and to whoever is using the <? open tag, go look at your php.ini file,you'll note that the default for the short tags is off, so you should get used to <?php

since you can never be sure about remote servers, unless you have the connection and space to host on your own, you should write to the defaults....unless there's some mod for security, in which case, expect that anyone running a reliable host will have as much security as possible. that will make your code the most portable
User avatar
Mexican Hat
Forum Newbie
Posts: 19
Joined: Sat Mar 08, 2003 8:35 pm
Location: Baltimore, Maryland
Contact:

Post by Mexican Hat »

Still confused.

Code: Select all

<?php
   function valid_login($username, $password) &#123;
      return ($username == 'name1' && $password == 'pass1') or
             ($username == 'name2' && $password == 'pass2') or
             ($username == 'name3' && $password == 'pass3');
   &#125;

   function login_screen($failed = 0) &#123;
?><html> 
  <head><LINK REL=StyleSheet HREF="_style.css" TYPE="text/css"></HEAD> 
  <body bgcolor="#e1e1e1"><center> 
  <form action="<?php echo $_SERVER&#1111;'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&#1111;'count']." time(s) : Keep Trying Biatch</b></font>

      return $output ."<BR><BR></center></body></html>";
   &#125;


   session_start();
   if( ! isset($_SESSION&#1111;'count']) ) $_SESSION&#1111;'count'] = 0;
   else $_SESSION&#1111;'count']++;

   if( ! isset($_SESSION&#1111;'logged_in']) ) &#123;
      if ( ! isset($_POST&#1111;'submit'])) &#123;
         die (login_screen());
      &#125; elseif ( valid_login($_POST&#1111;'username'], $_POST&#1111;'password']) ) &#123;
         $_SESSION&#1111;'count']  = 1;
         $_SESSION&#1111;'logged_in']  = 1;
      &#125; elseif ( $_SESSION&#1111;'count'] > 3 ) &#123;
         header("Location: baby/index.html");
         exit;
      &#125; else &#123;
         die ( login_screen($failed = 1) );
      &#125;
   &#125;
But I know that not right. Where do I put this code:

Code: Select all

&#125;


   session_start();
   if( ! isset($_SESSION&#1111;'count']) ) $_SESSION&#1111;'count'] = 0;
   else $_SESSION&#1111;'count']++;

   if( ! isset($_SESSION&#1111;'logged_in']) ) &#123;
      if ( ! isset($_POST&#1111;'submit'])) &#123;
         die (login_screen());
      &#125; elseif ( valid_login($_POST&#1111;'username'], $_POST&#1111;'password']) ) &#123;
         $_SESSION&#1111;'count']  = 1;
         $_SESSION&#1111;'logged_in']  = 1;
      &#125; elseif ( $_SESSION&#1111;'count'] > 3 ) &#123;
         header("Location: baby/index.html");
         exit;
      &#125; else &#123;
         die ( login_screen($failed = 1) );
      &#125;
   &#125;&#1111;/
Peace :(
Post Reply