• Advertisement
Sign in to follow this  

[web] My PHP Is Borked!

This topic is 4431 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am using XAMPP for the complete setup of a PHP and MYSQL server environment and i have a simple problem in that the php portions of my code appear to be doing nothing. I have all the code in the directory that apache expects it in. Can anyone think of any reasons why no even echo is producing output? Thanks, Dave

Share this post


Link to post
Share on other sites
Advertisement
Hey Dave,

my guess is that you've got a parse error.

Start your script like this:

<?php

error_reporting(E_ALL);


It is wise to use the E_STRICT flag too but this is only possible if you're using PHP version 5.

More information about this function can be found here: http://php.net/error_reporting.

There is a default error level set in php.ini, you could change this to E_ALL and set the "show errors on startup" option to true.

I hope this will help.

Walter

Share this post


Link to post
Share on other sites
I have now tried E_ALL, and no errors are reportee. I neglected to mention that i actually had all this working not so long and havn't changed anything since then. I thought maybe a process wasn't running but everything is.

I also tried a simple page, that just echoed a word and that didn't work either.

Dave

Here is the code of the file that isn't working. Everything that is plain HTML works, the php doesn't.


<?php
error_reporting ( E_ALL )
// SESSION HANDLING
session_start();

$loginSignupString = "";
$playArrowSyntax = "";
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Log In</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<?php
require_once("new/externals/ext_mysqlconnect.php");
require_once("new/externals/ext_session.php");
require_once("new/externals/ext_usersinterface.php");

function ActOnSignupFeed()
{
AddUser( $_POST[ 'uname' ],$_POST[ 'pword' ],$_POST[ 'fname' ],$_POST[ 'lname' ] );
global $loginSignupString;
$loginSignupString = "<a href='./new/login.php'>Log In</a> | <a href='./new/signup.php'>Sign Up</a>";
}

function ActOnLoginFeed()
{
if ( SafeUserLogIn( $_POST[ 'uname' ], $_POST[ 'pword' ] ) == TRUE )
{
// Set the session user name to be the one that just logged in
$_SESSION[ 'userid' ] = $_POST[ 'uname' ];
global $loginSignupString;
$loginSignupString = "<a href='index.php?logout=1'>Log Out</a>";
global $playArrowSyntax;
$playArrowSyntax = '<img src="new/art/play.bmp"/>';
}
else
{
global $loginSignupString;
$loginSignupString = "<a href='index.php'>Log In</a> | <a href='./new/signup.php'>Sign Up</a>";
}
}

function ActOnLogOutFeed()
{
SafeLogUserOut( $_SESSION[ 'userid' ] );
EndSession();

// unset the session userid because after the logout there isn't one set
//$_SESSION[ 'userid' ];
// Now load as if the page was loading for the first time
ActOnNoFeed();
}

function ActOnNoFeed()
{
// First check whether any user has logged in. Check whether session-uname has been created
if ( isset( $_SESSION[ 'userid' ] ) )
{
global $loginSignupString;
$loginSignupString = "<a href='index.php'>Log Out</a>";
global $playArrowSyntax;
$playArrowSyntax = '<img src="new/art/play.bmp"/>';
}
else
{
global $loginSignupString;
$loginSignupString = "<a href='./new/login.php'>Log In</a> | <a href='./new/signup.php'>Sign Up</a>";
}
}

?>

</head>

<body>
<?php
// Check the value of the 'form type'
if ( $_POST[ 'formaction' ] == "signup" ) // if the feeding page was the signup page then...
{
ActOnSignupFeed();
}
else if ( $_POST[ 'formaction' ] == "login" ) // if the feeding page was the log in page then...
{
ActOnLoginFeed();
}
else if ( $_REQUEST[ 'logout' ] == "1" )
{
ActOnLogOutFeed();
}
else
{
ActOnNoFeed();
}
?>
<!-- PRESENTATION -->
<table border="0" align="center">
<tr>
<td align="center"><img src="new/art/treasure_hunt_logo.png" /></td>
</tr>
<tr>
<td align="center"><?php echo $loginSignupString; ?></td>
</tr>
<tr>
<td align="center"><?php echo $playArrowSyntax; ?></td>
</tr>
</table>
<a href="new/author.php">Author [DEBUG-Only click when logged in]</a>

</body>
</html>


Share this post


Link to post
Share on other sites
Have you looked at the source that the web server is serving?

It's entirely possible that you haven't configured it to parse PHP files at all, and it's just serving them as normal HTML.

Mark

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement