Topic: Can't run PHP scripts.

I cannot run PHP scripts. I have tried to use the <pun_include "filename"> function and the normal PHP include function.

When I do it nothing shows up at all, and they are in the right directory.

Re: Can't run PHP scripts.

Do they execute fine without including them?

3 (edited by vulture 2006-03-25 11:54)

Re: Can't run PHP scripts.

The script doesn't work properly. For example:

In a normal webpage, the following code shows things depending on whether you're logged in or not.

<?php 
define('PUN_ROOT', './forum/'); 
require PUN_ROOT.'include/common.php';  

 
echo $pun_user['username']; 
?>

<?php
define('PUN_TURN_OFF_MAINT', 1);
define('PUN_QUIET_VISIT', 1);


echo $pun_users['id']; 

if($pun_user['username'] == "Guest"){
    echo "  <a href=\"forum/login.php\"><u><font face=\"arial\" color=\"white\"><b>Login</u></a>   <a href=\"forum/register.php\"><font face=\"arial\" color=\"white\"><b><u>Register</u></a>   <a href=\"http://localhost/ausesports/forum/login.php?action=forget\"><font face=\"arial\" color=\"white\"><b><u>Forgot Password?</u></a>  ";
} else {
    echo("  <a href=\"forum/login.php?action=out&id=".$pun_user['id']."\"><u><font face=\"arial\" color=\"white\"><b>Logout</a>");
}

?>

But on the forums page it's ruined. It prints...

Login   Register   Forgot Password? "; } else { echo("  Logout"); } ?>

...in text. With some of the links not working.

Re: Can't run PHP scripts.

Just an idea, but try this: <pun_include 'filename'>

Re: Can't run PHP scripts.

Dont understand what your trying to accomplish.... But your problaby better off checking this out and see how it works.
http://www.punres.org/files.php?pid=206

Also.... I am not the best coder in the world by far. But one thing I learnt early on is to close my tags. You have 3 open font tags, and also bold tags.

Plus use ' inbetween your quotes instead of \" less confusing.
For example...

echo " <a href='forum/login.php'><font face='arial' color='white'><b><u>Login</u></b></a>";

Plus you have brackets round your second echo statement which is not needed.

Sorry to pick again... but also instead of using

if($pun_user['username'] == "Guest")

use this

if ($pun_user['is_guest'])

It works fine on my site when the code is fixed... Both home page and forum.

Good luck... and hope you learn some things when fixing it wink smile

Re: Can't run PHP scripts.

I did all those fixes and it didn't work.

I also tried: <pun_include 'login2.php> And when I view the source I actually see <pun_include 'login2.php'> in it.

Re: Can't run PHP scripts.

Well , did you put the file in include/user/. I also reccomend checking if when you add the include for example
<pun_include "login.php"> make sure the text or file extension is the correct extension. Another thing you can do is check if the root to the user folder's are correctly chmodded.

Re: Can't run PHP scripts.

The link I gave you orignally

http://www.punres.org/files.php?pid=206

is exactly what your looking for but done properly. If it is not exact then you can change it slightly to your needs.

I commented on your code for your benefit, not to completely fix it.

Re: Can't run PHP scripts.

My code works on all other pages except the forums page, it doesn't make sense!

Re: Can't run PHP scripts.

So what is different from your code and the code in that link?? then you will find the problem.

That download does exactly what you want and works great. I use a modified version on my site.

Re: Can't run PHP scripts.

Yeah, the download is perfect. However, is there a version of the exact same thing that will work externally to the forums, like on a different page of a website?