Jump to content
Sign in to follow this  
Elnof

Unknown error

Recommended Posts

My server doesn't show the code, it acts like its a blank HTML document (it is set up for PHP). It runs a simple "hello world" program, but not this. Is there any typo's?

<?php function displayPage($String) {  return str_replace("_", " ", $String); } if (isset(oops)) {  $comeFrom = true;  $page = displayPage($_GET["oops"]);  $message = "Sorry, you can not view the " . $page . " page if you are not logged in!"; } else {  $message = null; } if (isset(loggedIn)) $rowSpan = 2; else $rowSpan = 1;?><html> <head>  <title><?php if (comeFrom == true) echo "You're not logged in"; else echo "Log In page"; ?></title>  <link rel="stylesheet" type="text/css" href="settings.css">  <script language="JavaScript1.2">   //Advanced Email Check credit-   //By JavaScript Kit ([url="http://www.javascriptkit.com"]http://www.javascriptkit.com[/url])   //Over 200+ free scripts here!   var testresults   function checkemail(){	var str=document.getElementById('email').value;	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i	if (filter.test(str))	 testresults=true	else{	 alert("Please input a valid email address!")	 testresults=false	}	return (testresults)   }  </script>  <script>   function checkbae(){	if (document.layers||document.getElementById||document.all)	 return checkemail()	else	 return true    }  </script> </head> <body align="center">  <center>   <div class="mainContainer">	<div class="header">	 <table border="0" width="772px">	  <tr>	   <?php echo "<td rowspan='" . $rowSpan . "'>"; ?>		<div class="logo">		 <img src="logo.png" alt="Nateck Logo" />		</div>	   </td>	  </tr>	  <tr>	   <td align="right">		<div class="welcome">		 <?php 		  if (isset($_SESSION["loggedIn"])) {		   echo "Welcome " . $_SESSION["useName"] . "!</td></tr>";		   echo "<tr><td><a href='logOut.php'>Log Out</a>"; 		  }		  else echo "<a href='logIn.php'>Log In</a>"; 		 ?>		</div>	   </td>	  </tr>	 </table>	</div>	<div class="navBar">	 <div class="navLinks">	  <ul>	   <li><a href="home.php">Home</a></li>	   <li><a href="view.php?page=news">News</a></li>	   <li><a href="view.php?page=products">Products</a></li>	   <li><a href="view.php?page=projects">Projects</a></li>	   <li><a href="view.php?page=forums">Forums</a></li>	   <li><a href="view.php?page=contact_us">Contact Us</a></li>	   <li><a href="view.php?page=other">Other</a></li>	  </ul>	 </div>	</div>	<div class="content-pane">	 <div class="form-paragraph" align="left">	  <a id="logInForm"></a>	  <h2>Log In</h2>	  <div class="form">	   <?php 		if ($message != null)		 echo "<div class='error'>" . $message . "</div>"; 	   ?>	   <form action="welcome.php" method="post">		<label for="useName">Username:</label> 		<input type="text" id="useName" /><br />		<label for="passWord">Password:</label> 		<input type="password" id="passWord" /><br />		<input type="submit" value="Log In" />	   </form>	   <p>Don't have an account?  Click <a href="signUp.php">here</a> to sign up!</p>	  </div>	 </div>	 <center>	  <hr width="768px">	 </center>	 <table boarder="0" width="100%"> 	  <tr>	   <td>		<div class="form-username">		 <div class="form">		  <form action="forgot-email.php" method="post" onSubmit="return checkbae()">		   Forgot your account information?<br />		   <label for="email">Enter your e-mail:</label>		   <input type="text" id="email" id="email" /><br />		   <input type="submit" value="Get Account Info" id="button" />		  </form>		 </div>		</div>	   </td>	   <td>		<div class="form-question">		 <div class="form">		  <form action="secretQuestion.php" method="get">		   Didn't enter your e-mail when you signed up?<br />		   <label for="sQUsername">Enter your username:</label>		   <input type="text" id="sQUsername" /><br />		   <input type="Submit" value="Secret Question" />		  </form>		 </div>		</div>	   </td>	  </tr>	 </table>	</div>	<div class="footer">	 <p>	  This site is Copyright © 2007 Nateck - All rights reserved	 </p>	</div>	</div>   </center>  </body> </html>

Share this post


Link to post
Share on other sites

Add this to the top of the page:ini_set("display_errors", 1);error_reporting(E_ALL);Most likely you are getting an error message that does not show up.

Share this post


Link to post
Share on other sites

Well it wasn't supposed to "work", it just enables the display of error messages.If you add that code onto the top of the document, and you see no error messages and none of the static HTML, then PHP is having bigger problems. Open php.ini and set the display_startup_errors option to 1, because if you are explicitly enabling error messages and you aren't seeing errors or output, then there must be startup errors causing PHP to not run at all. Because if PHP was running, you would either see error messages or output, assuming you put that code in the right place. Save php.ini with the new option and restart the server, then try it again.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...