PHP Code Will Not Stay Hidden... Please Help!!!

joe904

Estimable
Apr 11, 2015
11
0
4,560
I am unable to figure this issue out and it is driving me up a wall. I am trying to write code for a members only area for my webpage, but the PHP code that I am using keeps showing when I go to the page.

1) I originally saved the file as a .PHP, and *NOT* an HTML.
2) I have tried restarting my server.
3) I tested the .PHP compatibility of the server using a "hello" PHP code which DID show up when I ran it.
4) I tried running the website using "localhost/member/index.php" (index.php was located in root folder) and going to the my main website and calling upon index.php, but it still did not work
5) I am not loading it up as a file:/// using Chrome or IE
5) I tried re-saving the .php file to .php

Software:
WIndows 2012SE
IIS 8.0 webserver
PHP 5.3.28
PHPmyadmin 4.4.4
MySQL 5.5.43 - Community Server (GPL)

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>1stoptutorials Members Area</title>
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
</head>

<body>
<div id="container">
<div id="head">
<ul id="menu">
<li><a class="current" href="index.html" title="">Home</a></li>
<li><a href="" title="">Sign In</a></li>
<li><a href="join.php" title="">Register</a></li>
</ul>
</div>
<div id="area"></div>
<div id="main">
<div id="content_left">
<form name="form1" method="post" action="register.php">
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<tr>
<td width="24%" align="left" valign="top">First Name</td>
<td width="76%"><input name="first_name" type="text" id="first_name2" value="<? echo $first_name; ?>"></td>
</tr>
<tr>
<td align="left" valign="top">Last Name</td>
<td><input name="last_name" type="text" id="last_name" value="<? echo $last_name; ?>"></td>
</tr>
<tr>
<td align="left" valign="top">Email Address</td>
<td><input name="email_address" type="text" id="email_address" value="<? echo $email_address; ?>"></td>
</tr>
<tr>
<td align="left" valign="top">Desired Username</td>
<td><input name="username" type="text" id="username" value="<? echo $username; ?>"></td>
</tr>
<tr>
<td align="left" valign="top">Information about you:</td>
<td><textarea name="info" id="info"><? echo $info; ?></textarea></td>
</tr>
<tr>
<td align="left" valign="top">&nbsp;</td>
<td><input type="submit" name="Submit" value="Join Now!"></td>
</tr>
</table>
</form>
</div>
<div id="content_right">
<h4>Latest Work</h4>
<div class="item_box">
<img src="images/t1.jpg" width="200" height="70" border="0" alt="Dragon" title="Dragon" /><br />
<strong>Dragon</strong> </div>
<div class="item_box">
<img src="images/t2.jpg" width="200" height="70" border="0" alt="Bricks" title="Bricks" /><br />
<strong>Bricks </strong></div>
</div>
<div class="spacer"></div>
</div>
<div id="footer"></div>
</div>
</body>
</html>
capture.jpg


Please Help!!! Thanks
 
Solution
Do you have the short_open_tag option enabled on your server? You'll need it be enabled for your code to work, or you'll need to replace your short tags with full <?php tags. Once enabled you can replace your "<? echo ..." with the short echo tag "<?= ..." as well. Alternatively you can upgrade to PHP 5.4 and then the short echo tag works without the short_open_tag option.

randomizer

Distinguished
Do you have the short_open_tag option enabled on your server? You'll need it be enabled for your code to work, or you'll need to replace your short tags with full <?php tags. Once enabled you can replace your "<? echo ..." with the short echo tag "<?= ..." as well. Alternatively you can upgrade to PHP 5.4 and then the short echo tag works without the short_open_tag option.
 
Solution