Page 1 of 1

My php Dont work..

PostPosted: 22. September 2012 21:15
by ggilir
Hey i just did download and install the xampp 1.8.0

but my php dont work..
it shows the php codes??:S

like

Image

how do i fix so i can use my php codes

if i use

<?
echo "Hello ";

?>

it also dont work;(

Re: My php Dont work..

PostPosted: 23. September 2012 08:07
by Altrea
Hi ggilir,

Instead of the php short open tag <? simply use the long one <?php

best wishes,
Altrea

Re: My php Dont work..

PostPosted: 23. September 2012 11:22
by ggilir
But it still dont work.. i get errors.

Notice: Use of undefined constant username - assumed 'username' in C:\xampp\htdocs\chat\plugin\core.php on line 6

Notice: Undefined index: username in C:\xampp\htdocs\chat\plugin\core.php on line 6

Notice: Use of undefined constant mode - assumed 'mode' in C:\xampp\htdocs\chat\index.php on line 3

Notice: Undefined index: mode in C:\xampp\htdocs\chat\index.php on line 3

and in my logins.

Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\chat\login.php on line 15

and on a real webserver they work:(

Re: My php Dont work..

PostPosted: 23. September 2012 13:48
by JJ_Tagy
For reference: Notice != error

Without the offending code, we can only guess what the problem is.

Re: My php Dont work..

PostPosted: 23. September 2012 13:59
by ggilir
<?php
require("plugin/core.php");
$hent = mysql_query("select * from users where username='$_POST[username]' and password='" . securePassword($_POST[password]) . "'");
$hent = mysql_fetch_array($hent);
if (strtolower($hent[username]) == strtolower($_POST[username])) {
$_SESSION[username] = $hent[username];
$_SESSION[lastmove] = 0;
$sid = substr(md5(session_id()), 0, 5);
mysql_query("update users set ip='$_SERVER[REMOTE_ADDR]' where username='$hent[username]'");
mysql_query("update users set sessionid='$sid' where username='$hent[username]'");
?><a onclick="newwindow=window.open('chatframe.php','chatten','height=620,width=920', 'resizable=no');">Åben chatten</a><?
} else {
echo "Næh";
}
?>

Re: My php Dont work..

PostPosted: 23. September 2012 14:03
by ggilir
but when i did use older version of xampp it did work fine. when i did download this = ERROR ! :S

Re: My php Dont work..

PostPosted: 23. September 2012 15:00
by JJ_Tagy
It seems your short open tags is turned off. You will either need to change all <? to <?php or open your php.ini and turn the setting on.