Putting HTML in PHP
Posted: Sat May 31, 2003 2:29 pm
Can some one help me put my html code into php.
This is my code:
Peace
This is my code:
And I want to replace it with the HTML code in the PHP. Here is the PHP file.<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">© 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>
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.<?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) );
}
}
?>
Peace