0
if($xtype!="")
{
    $xid = $_REQUEST['xid'];
}
Else
{
    session_destroy();
    unset($_SESSION['uid']);
    unset($_SESSION['pwd']);
    unset($_SESSION['utype']);
    unset($_SESSION['user']);
}

echo "
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'><html><head><TITLE>TITLE</title><link rel='stylesheet' type='text/css' href='xmlTree.css'/></head><body><BR><table class=mtbl>";

$uname=$_SESSION['user'];

if($xtype=="")
{
echo 
"<FORM METHOD=POST target=_self>Username:</br><Input  type=text name=uid></p>Password:</br><Input type=password name=pwd></p><Input type=submit value=Login></FORM>";
}

The above code will display this in the browser :

"; $uname=$_SESSION['user']; if($xtype=="") { echo "

And I don't know why. I checked settings in my httpd.conf, php.ini and nothing seems to make any difference **On the actual web server and on browser to this page it works 100% . Just in my WAMP setup it displays some php code in the browser. So if you would navigate to the actual website, then it displays perfectly. I am trying to test the site on my wamp VM and have copied the files from the server to my wamp. ** I am guessing that somewhere there is some setting that is different...

Apache Version : 2.4.9 PHP Version : 5.5.12 MySQL Version : 5.6.17

jaesson1985
  • 718
  • 2
  • 11
  • 19
  • check this link `http://stackoverflow.com/questions/12142172/apache-shows-php-code-instead-of-executing` may be it helps – Agha Umair Ahmed Nov 24 '14 at 09:22
  • I checked your code (XAMPP). And I dont see any PHP-Code. You did use " – Tream Nov 24 '14 at 09:23
  • @Agha Umair Ahmed : My php works, is installed. I have other sites within my wamp that work perfectly and that do not have this issue. I also applied most fixes from this forums but all did not solve the issue. As you see above, only SOME php is displayed in browser. The other is parsed just fine – jaesson1985 Nov 24 '14 at 09:25
  • @Tream : Yes . This code uses ?> . I added short tag functionality as well as using – jaesson1985 Nov 24 '14 at 09:26
  • Then start debugging your code. Try to remove parts of the Code, like the echo " – Tream Nov 24 '14 at 09:30
  • @Tream : Yes , with the entire echo " – jaesson1985 Nov 24 '14 at 09:33
  • even when I put `echo "";` there it will still display the `$uname=$_SESSION['user'];if($xtype==""){echo` on the browser – jaesson1985 Nov 24 '14 at 09:35
  • Last thing I can think of: Open it in Nodepad++ and check, if you can find any hidden chars, that shouldnt be there. Or just copy your code into the normal windows Notepad and save it again. Also, it should be "else" not "Else". – Tream Nov 24 '14 at 09:50
  • Or just write clean code: 1) Do your Stuff in PHP 2) Do your HTML-Stuff (without any php-logic). Check the wikipedia-link I posted before. – Tream Nov 24 '14 at 09:52
  • No hidden chars. Copied and saved. No changes – jaesson1985 Nov 24 '14 at 09:55
  • But see, why does it work online and on the webserver and not in my test wamp vm - that's what I don't understand ! I should just be able to copy paste things from the server and they should work alike. – jaesson1985 Nov 24 '14 at 09:58

0 Answers0