Jump to content

Php Cancalling Out Css


ChidoriSoul
 Share

Recommended Posts

Hey, my register page works just fine when it is plain alone without PHP, it works with the layout that I use. When I add on the PHP, it turns into the link up there, with no style what so ever. My code:

<?php// Connects to your Databasemysql_connect("fdb1.awardspace.com", "chidorisoul_sh", "******") or die(mysql_error());mysql_select_db("chidorisoul_sh") or die(mysql_error());//This code runs if the form has been submittedif (isset($_POST['submit'])) {//This makes sure they did not leave any fields blankif (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] ) {die('You did not complete all of the required fields');}// checks if the username is in useif (!get_magic_quotes_gpc()) {$_POST['username'] = addslashes($_POST['username']);}$usercheck = $_POST['username'];$check = mysql_query("SELECT username FROM users WHERE username = '$usercheck'")or die(mysql_error());$check2 = mysql_num_rows($check);//if the name exists it gives an errorif ($check2 != 0) {die('Sorry, the username '.$_POST['username'].' is already in use.');}// this makes sure both passwords entered matchif ($_POST['pass'] != $_POST['pass2']) {die('Your passwords did not match. ');}// here we encrypt the password and add slashes if needed$_POST['pass'] = md5($_POST['pass']);if (!get_magic_quotes_gpc()) {$_POST['pass'] = addslashes($_POST['pass']);$_POST['username'] = addslashes($_POST['username']);}// now we insert it into the database$insert = "INSERT INTO users (username, password)VALUES ('".$_POST['username']."', '".$_POST['pass']."')";$add_member = mysql_query($insert);?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html>  <head>    <title>Register</title><style type="text/css"><!--body,td,th {    color: #FF0000;    font-family: Tahoma;    font-size: 9px;    font-weight: bold;}body {    background-color: #000000;}.thead {background: #302226;border: 1px solid #000000;border-bottom: 0px;text-align: center;vertical-align: middle;height: 15px;}.tnav {background: #302226;border: 1px solid #000000;border-bottom: 0px;text-align: center;height: 15px;}.tnav2 {background: #302226;border: 1px solid #000000;border-bottom: 1px solid black;text-align: center;height: 15px;}.news {background: #302226;border: 1px solid #000000;border-bottom: 1px solid #000000;text-align: center;height: 15px;}.banner {border-bottom: 0px;}.dis {border-top: 0px;}.con {border-top: 0px;border-bottom: 0px;}.party {background: #302226;border: 1px solid #000000;border-bottom: 0px;text-align: center;height: 25px;}a:link {    color: #990000;    text-decoration: none;}a:visited {    text-decoration: none;    color: #990000;}a:active {    text-decoration: none;    color: #FFFFFF;}.style1 {color: #FFFFFF}--></style><body><table align="center" width="200" height="247" border="0" cellpadding="0" cellspacing="0" bordercolor="#FF0000">  <tr>    <td align="left" valign="top"><table width="802" height="120" border="1" cellpadding="0" cellspacing="0" bordercolor="#FF0000" class="banner">      <tr>        <th background="http://i286.photobucket.com/albums/ll84/ChidoriSoul/BetterAsteroidBanner.png?t=1243111409" scope="col"> </th>      </tr>    </table>      <table width="802" height="120" border="1" cellpadding="0" cellspacing="0" bordercolor="#FF0000" class="con">        <tr><!--- Ads --><div style="text-align: center"><script type="text/javascript"><!--google_ad_client = "pub-4468899317544238";/* TPARPG */google_ad_slot = "0388012058";google_ad_width = 728;google_ad_height = 90;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></div><!--- End of Ads --><!--- Left Nav -->                   <th width="122" align="center" valign="top" bgcolor="#302226" scope="row">                    <div class="thead style1" id="thead"> <font color='limegreen'>General Options</font> </div>          <div class="tnav"> <a href="http://tparpg.awardspace.co.uk/home.php"><font color='blue'>Home</font></a></div>          <div class="tnav"> <a href="http://tparpg.awardspace.co.uk/register.php"><font color='blue'><del>Register</del></font></a></div>          <div class="tnav"> <a href="http://tparpg.awardspace.co.uk/login.php"><font color='blue'><del>Login</del></font></a></div>                    <div class="thead style1" id="thead"> <font color='limegreen'>Miscellaneous</font> </div>          <div class="tnav"> <a href="http://tparpg.awardspace.co.uk/about.php"><font color='blue'>About TPA</font></a></div>          <div class="tnav"> <a href="http://tparpg.awardspace.co.uk/storyline.php"><font color='blue'>Storyline</font></a></div>          <div class="tnav"> <a href="http://tparpg.awardspace.co.uk/chatbox.php"><font color='blue'>Chatbox</font></a></div>          <div class="tnav"> <a href="http://www.punbb-hosting.com/forums/TPA_Forums/index.php"><font color='blue'>Forum</font></a></div>                    <div class="thead style1" id="thead"> <font color='limegreen'>Statistics</font> </div>          <div class="tnav"> <font color='blue'>Total Users: 0</font></div>                     </th><!--- End Of Left Nav --><!--- Start Content --> <th width="520" align="center" valign="top" bgcolor="#302226" scope="row">          <div class="news" id="thead"> Index </div>                   <br /><?php}else{?><form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"><table border="0"><tr><td>Username:</td><td><input type="text" name="username" maxlength="60"></td></tr><tr><td>Password:</td><td><input type="password" name="pass" maxlength="10"></td></tr><tr><td>Confirm Password:</td><td><input type="password" name="pass2" maxlength="10"></td></tr><tr><th colspan=2><input type="submit" name="submit" value="Register"></th></tr> </table></form><?php}?><!--- End Content --><!--- Right Nav -->                   <th width="122" align="center" valign="top" bgcolor="#302226" scope="row">                    <div class="thead style1" id="thead"> <font color='limegreen'>General Options</font> </div>          <div class="tnav"> <a href="http://tparpg.awardspace.co.uk/home.php"><font color='blue'>Home</font></a></div>          <div class="tnav"> <a href="http://tparpg.awardspace.co.uk/register.php"><font color='blue'><del>Register</del></font></a></div>          <div class="tnav"> <a href="http://tparpg.awardspace.co.uk/login.php"><font color='blue'><del>Login</del></font></a></div>                     <div class="thead style1" id="thead"> <font color='limegreen'>Miscellaneous</font> </div>          <div class="tnav"> <a href="http://tparpg.awardspace.co.uk/about.php"><font color='blue'>About TPA</font></a></div>          <div class="tnav"> <a href="http://tparpg.awardspace.co.uk/storyline.php"><font color='blue'>Storyline</font></a></div>          <div class="tnav"> <a href="http://tparpg.awardspace.co.uk/chatbox.php"><font color='blue'>Chatbox</font></a></div>          <div class="tnav"> <a href="http://www.punbb-hosting.com/forums/TPA_Forums/index.php"><font color='blue'>Forum</font></a></div>                    <div class="thead style1" id="thead"> <font color='limegreen'>Statistics</font> </div>          <div class="tnav"> <font color='blue'>Total Users: 0</font></div>                     </th><!--- End Of Right Nav --><!--- Disclaimer --><table width="765" height="45" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FF0000" "backgroundcolor="#302226" class="dis"><tr>    <td align="center" valign="top"><strong>Disclaimer</strong><br />   The Pokémon Asteroid RPG is © owned and coded by Shadow. All sprites are Copyrighted 2009 Pokémon © Nintendo, Game Freak, Creatures Ink all rights reserved.The Asteroid RPG is not affiliated with the organizations listed above or any other organizations that have co-operated or are co-operating in the programming or making of Pokémon. The images are copyright of their respective owners. This RPG is best viewed with Firefox. </td>  </tr></table></a></div><!--- End of Disclaimer -->

Edited by ChidoriSoul
Link to comment
Share on other sites

Everything in your document before the <form> is dependent on this: if (isset($_POST['submit'])) {So what the PHP is saying, strangely, is "If a form was submitted, print the top half of the page (which includes the style sheet); if not, print only the bottom of the page, leaving out the doctype, the <html>, <head>, etc tags."So that's what it does. It prints out the document, starting with the form.That can't be what you intended. You need to rethink your placement of the if statements.

Link to comment
Share on other sites

I can't say, because I'm not sure what your trying to accomplish. Maybe you could explain it in big chunks of human code, likeif the user did not submit a formdo (this)elsedo (a different thing)

Link to comment
Share on other sites

The code below needs to be within the body area, where? depends on what should be shown by default, and when user logs on (if this is what you are trying to achieve)//This code runs if the form has been submittedif (isset($_POST['submit'])) { //This makes sure they did not leave any fields blank if (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] ) { die('You did not complete all of the required fields'); } // checks if the username is in use if (!get_magic_quotes_gpc()) { $_POST['username'] = addslashes($_POST['username']); } $usercheck = $_POST['username']; $check = mysql_query("SELECT username FROM users WHERE username = '$usercheck'") or die(mysql_error()); $check2 = mysql_num_rows($check); //if the name exists it gives an error if ($check2 != 0) { die('Sorry, the username '.$_POST['username'].' is already in use.'); } // this makes sure both passwords entered match if ($_POST['pass'] != $_POST['pass2']) { die('Your passwords did not match. '); } // here we encrypt the password and add slashes if needed $_POST['pass'] = md5($_POST['pass']); if (!get_magic_quotes_gpc()) { $_POST['pass'] = addslashes($_POST['pass']); $_POST['username'] = addslashes($_POST['username']); } // now we insert it into the database $insert = "INSERT INTO users (username, password) VALUES ('".$_POST['username']."', '".$_POST['pass']."')"; $add_member = mysql_query($insert);Also you have no closing head tag </head> and remove the quote frombackgroundcolor="#302226"<table width="765" height="45" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FF0000" "backgroundcolor="#302226" class="dis">

Edited by dsonesuk
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...