problem running php on apache (xampp) after new install

Problems with the Windows version of XAMPP, questions, comments, and anything related.

problem running php on apache (xampp) after new install

Postby Duke555 » 31. May 2010 05:50

how are you?
i just wanted to ask you what to do in the following situation.
I have a code (see below) that worked fine on someone's xampp on linux. i installed xampp (on windows xp) on my machine
and instead of a normal output i get the following (see immediadtely below). how do i resolve it?

thank you :)
======
* Home
*
*


You must register first below in order to access member-only area of the site.

'; } ?>

Please complete a registration form below in order to shop on our site

Registration form:
Email address: <? //if there was no error only
Please include a valid email address and/or name'; } ?>
Name: <? //if there was no error onl

* Register
* Products
* My Shopping Cart
Welcome, email address.
Feel free to browse our Products and My Cart sections of the site.
Not registered under ? Click here


===========
<php?
//start output buffer to avoid issues with the header()
ob_start();
//include the header template
include("header.html");
//require all the necessary files
//include("register.php");

//if user requested to 'forget' previous signin and/or user wishes to register (again) then...
if (isset($_GET['delete_cookie'])) {
setcookie('email','', time()-3600, '/', '', 0, 0); //delete $_COOKIE['email']
setcookie('name','', time()-3600, '/', '', 0, 0); //delete $_COOKIE['name']

echo "Logging out...";
//transfer to the index.php for unregistered users
$url = "http://".$_SERVER['HTTP_HOST']."/index.php";
header("Location: ".$url);
}
//if user has not registered before then...
if(!isset($_COOKIE['email']))
{
?>
<div id="navigation">
<ul>
<li><a href="index.php" class="active">Home</a></li>
<li></li>
<li></li>
</ul>
</div>
<div id="content">
<?
if ($_GET['error'] == "1") {
$error_code = 1; //this means that there's been an error and we need to notify the customer
}
if ($_GET['error'] == "2") {
$error_code = 2; //this means that there's been an error and we need to notify the customer
}
?>
<br>
<?
if ($error_code == 2) {
echo '<p class="error">You must register first below in order to access member-only area of the site.</p>';
}

?>
<p>Please complete a registration form below in order to shop on our site</p>

<p>Registration form:</p>
<form method=GET action="register.php">
<table>
<tr>
<td align=right>
Email address:
</td><td align=left>
<input type=text size=25 name="email" value="<?
//if there was no error only then output email address
if(!$error_code)
{
echo $_GET['email'];
}
?>">
<?

// if email address/name provided by the user is invalid (in which case error code is == to 1) THEN ...
if ($error_code==1)
{
//output an error message
echo '<b class="error">Please include a valid email address and/or name</b>';
}
?>
</td>
</tr>
<tr>
<td align=right>
Name:
</td><td align=left>
<input type=text size=25 name="name" value="<?
//if there was no error only then output email address
if(!$error_code)
{
echo $_GET['name'];
}
?>">
</td>
</tr>
<TR>
<TD colspan=2 align=center>
<input type=submit value="SUBMIT">
</TD></TR>
</TABLE>
</form>
<?
}
//if user registred before i.e. $_COOKIE[email] has a (valid) value
else
{
?>
<div id="navigation">
<ul>
<li><a href="index.php" class="active">Register</a></li>
<!-- should only make the links below a live link when a user is a registrered user-->
<li><a href="products.php">Products</a></li>
<li><a href="my_cart.php">My Shopping Cart</a></li>
</ul>
</div>
<br>
<div id="content">
<table>
<tr>
<td>
<br>
<br>
<p>Welcome, <? echo $_COOKIE['name']."! Thank you for registering under ".$_COOKIE['email'];?> email address.
<br>
<br>
Feel free to browse our Products and My Cart sections of the site.
<br>
<br>
<br>
<br>
<br>
<br>
Not <? echo $_COOKIE['name']; ?> registered under <? echo $_COOKIE['email']; ?>? Click <strong><a href="index.php?delete_cookie=1">here</a></strong>
</p>
</td>
</tr>
</TABLE>
</div>
<?
}
?>
<br>
<?
//include the header template
include("footer.html");
//flush the output buffer AFTER all the header() functions may have been used and thus avoid errors
//assoc. with outputting before hearder() functions
ob_end_flush();
?>
Duke555
 
Posts: 4
Joined: 27. May 2010 04:56

Re: problem running php on apache (xampp) after new install

Postby Altrea » 31. May 2010 08:29

keyword:
short_open_tags
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8297
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: problem running php on apache (xampp) after new install

Postby Nobbie » 31. May 2010 08:42

Duke555 wrote:<php?


This runs neither on Windows nor on Linux, it's simply wrong.
Nobbie
 
Posts: 8778
Joined: 09. March 2008 13:04

Re: problem running php on apache (xampp) after new install

Postby Duke555 » 03. June 2010 08:53

yes, thank you
it was wrong i was tryingt o get it to work by changing things and init. made a mistake in that scipt.
regardsless the post above is absolutely correct, i just had to make that change in the config. file.
Duke555
 
Posts: 4
Joined: 27. May 2010 04:56


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 61 guests