FRIHOSTFORUMSSEARCHFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

PHP Problem...

 


Naif
Hi guys. I am having an odd problem right now. I am not able to access pages from my website. Here is the URL to the site:

http://www.dhonixpress.com

Try accessing the page http://www.dhonixpress.com/index.php?videos

Instead of the videos page opening, you are presented with the homepage itself. I think the admin of the server has disabled global variables. I have been using global variables from a very long time and I dont know how to use those super globals. Here is the code which handles my pages. Can someone make the neccesary changes?

Code:

<?php

include("page_begin"); // Include html code which is common to all the pages



if(empty($argv)) {    // If no page arguments are supplied, include the default, i.e. the home page
        include("pages/home");                       
}

elseif(!empty($argv)) // otherwise do a check on the page requested, if its valid, include it
{

   $argv[0] = strtolower($argv[0]);
    $pages = array('home', 'biography', 'about', 'statistics', 'news', 'videos'); // Used for file security check
       
   if( in_array($argv[0], $pages) && file_exists("pages/$argv[0]") ) { // Finally the file security check

                      include("pages/$argv[0]");
        }

// If the argument passed is invalid/non-existant, print the following message

        else {
                echo "Invalid page request!";
   }
}

include("page_end"); // Html code common to all pages

?>

kv
I don't thing you can use $argv in a php webscript. You can use it if it is a called from command line though. Here is a solution to your problem.

instead of

http://www.dhonixpress.com/index.php?videos

change to

http://www.dhonixpress.com/index.php?page=videos

In your php code,

use $_REQUEST['page'] instead of $argv[0].
[/code]
Naif
Hi Kv. Thanks for your reply. Till yesterday I was able to use the $argv variable. I have resolved this problem on my own now. I know I could have passed the file names through a page variable but i wanted them to be passed as index.php?videos because many search engines have already indexed the pages like that.
Bondings
I switched "register_globals" to off yesterday. To enable it for a directory you need to place "php_flag register_globals on" in a .htaccess file in that directory.
WebSiteGuru
Would that be the cause of my problem, too? I am getting a phase error at my site in my config.php file.

I have not a chance yet to make changes to my .htaccess file, but I will.
mathiaus
WebSiteGuru wrote:
Would that be the cause of my problem, too? I am getting a phase error at my site in my config.php file.

I have not a chance yet to make changes to my .htaccess file, but I will.

Parse error, no you have another problem with your code. You need to create a new topic with the code (use pastebin and link to it.)
anticitizen1
turning "register_globals" to off helps in security. thanks
thnn
just put
Code:
$argv = $_GET['argv'];
at the top of your page and that will get the value from the address and assign it to the variable.
Related topics

A PHP problem !
HTML + PHP problem
A php problem
PHP problem...
PHP Problem: Unable to execute ext. commands

[PHP] Problem with Dynamic Sig's Font Color
Form and PHP problem
PHP imagecreate + CSS problem.
PHP imagecreate + CSS problem.
simple php problem, please help...

PHP Problem
PHP Problem
MySQL and PHP problem in the future
Need Help integrating php variable into mySQL SELECT query
php problem
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.