Jump to content
xisto Community
Sign in to follow this  
jlhaslip

Script Won't Work At Trap17 -- Version Differences? But works flawlessly in my machine...

Recommended Posts


Here is the code:

<?php $data_array = array(); $data_array2 = array();$file_name = "menu_data.txt";$handle = @fopen($file_name, "r");if (!$handle)  {	echo "File Handle Not Available For Use"; exit;		}while (($data = fgetcsv( $handle, 1000, ",")) !== FALSE) {		if ( (strpos ($data[2],"$page="))) 	{					$data_array[] =  trim(substr($data[2], 6) );				}		}fclose($handle);$data_array2 = array_unique( $data_array );$submit = $_GET

;if( !isset($_GET

)  ||  ($_GET

 == "" )  ) {				if (file_exists($data_array2[0] . '.txt' )) {				include ( $data_array2[0] . '.txt' );				}				else {					include ('index.txt');				}		}		elseif (in_array($submit , $data_array2)) {				if (file_exists($submit . '.txt' )) {				include ( $submit . '.txt' );				}				else {					include ('index.txt');				}		}		else {				if (file_exists($data_array2[0] . '.txt' )) {				include ( $data_array2[0] . '.txt' );				}				else {					include ('index.txt');				}		}?>
As per the description above, this snippet works fine in the XAMPP setup on my local machine. ( Windows 98, php ver 5, safe mode off) However, when I upload it to the Xisto server, it never finds a valid page to 'include'. It always drops through the logic and reloads the Index page. I have tried to 'trim()' the various bits of data, I have used var_dump() to look at the data, I have written a script that outputs the array being tested and all methods 'appear' to provide what should be 'good' data for the query string to test against, but when I run the index.php main page script from this URL, I can never get off the Index page. Just wondering if anyone else can find the flaw in the Logic ( can't be a Logic flaw, because of the way it works in my machine) or the code (ditto) that would make a difference. I believe Xisto has php 4.4.1 installed and I suspect safe-mode is 'on'. I will do a php-info to confirm this. *edit* nope, safe mode appears to be off on the Xisto server.*edit*

Thanks for having a look and I hope someone nails this for me, because I have tried everything imaginable to force it to do a correct comparison. Thanks again.

*edit to add this following bit of information which might be useful*

When I run the script with echo statements to confirm the output of the arrays and the in the page selection, here is a sample of the output for all query strings on my machine and on the
Xisto server only when the '?page=' query string is absent.
array(7) { [0]=>  string(5) "index" [1]=>  string(3) "one" [2]=>  string(3) "two" [3]=>  string(5) "three" [4]=>  string(4) "four" [5]=>  string(4) "five" [6]=>  string(7) "contact" } data_array:array(7) { [0]=> string(5) "index" [1]=> string(3) "one" [2]=> string(3) "two" [3]=> string(5) "three" [4]=> string(4) "four" [5]=> string(4) "five" [6]=> string(7) "contact" } data_array2:get_page:submit:
On my machine, when the query string is complete, of course the get_page and submit values compare favourably to the contents of the query string and the correct page is fetched for the browser.
On the Xisto server, here is a sample of the same results when the query string is other than empty:
array(0) { } data_array:array(0) { } data_array2:get_page:twosubmit:two
As you can see, I was requesting ?page=two, but the array results are empty and the index page displayed instead. As noted above, the arrays are full of correct information on my machine and when the Xisto server is fetching the basic index.php only.

So that explains what is happening, but not why and how to resolve this problem.
Any help or direction would be very appreciated. Thanks.

Share this post


Link to post
Share on other sites

This what you were trying to do?:

<?php$data_array = array();$data_array2 = array();$file_name = "menu_data.txt";$handle = @fopen($file_name, "r");if (!$handle)  {	echo "File Handle Not Available For Use"; exit;		}while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {   $num = count($data);   for ($c=0; $c < $num; $c++) {	   $data_array[] = $data[$c];   }}/*   if ( (strpos ($data[2],"$page=")))	 {	   $data_array[] =  trim(substr($data[2], 6) );   }}*/fclose($handle);$data_array2 = array_unique( $data_array );$submit = $_GET

;if( !isset($_GET

)  ||  ($_GET

 == NULL )  ) {				if (file_exists($data_array2[0] . '.txt' )) {				include ( $data_array2[0] . '.txt' );				}				else {					include ('index.txt');				}		}		elseif (in_array($submit , $data_array2)) {				if (file_exists($submit . '.txt' )) {				include ( $submit . '.txt' );				}				else {					include ('index.txt');				}		}		else {				if (file_exists($data_array2[0] . '.txt' )) {				include ( $data_array2[0] . '.txt' );				}				else {					include ('index.txt');				}		}?>

Not really sure where you were going at with:
   if ( (strpos ($data[2],"$page=")))	 {	   $data_array[] =  trim(substr($data[2], 6) );   }}

So, i couldnt implement it, and wrapped comments around it, just incase you still need it. But, meh, hope this helped.
Edited by truefusion (see edit history)

Share this post


Link to post
Share on other sites

Well, it might, haven't tried it yet. Just to explain that code that you commented out is the critical part of the code. It checks a list of csv data which was used to build the Menu and grabs the contents of the third data item in the array and places it in what should become an array full of unique contents so that a query string matches the list of valid results. If the submitted query string is not valid against the array elements, then ignore the query string and use the index.txt as the include. It is a security check so that users can't mess with the query string and enter a query string which is for either a file you don't want them to have access to or which will allow them to call a file which doesn't exist and produce an error. So I'm off to try that code you entered and I'll let you know the results.

Share this post


Link to post
Share on other sites

No success. Same problem. Created an array when using the URL with no Query String, and created an empty array with the Query string included in the URL. Only difference was that the length of the array using the for loop was about 12 times longer, but it only was produced on the original pass. Even though it had 85 elements to check, it coudn't find the correct page to include.

Share this post


Link to post
Share on other sites

Well it worked fine for me, when i tested it out. I made 3 empty text files (for the test). Each had their own seperate info to be displayed. The menu_data.txt had 'index,one,two' as its info, and the script stuck 'index' in its own key, and so forth. And, when $_GET


wasnt defined it showed me the content from index.txt . When i gave $_GET


the value of 'two', it showed me the content found in two.txt .And as for the security thingy, just dont make any files that store special info with the extension: "txt".

Edited by truefusion (see edit history)

Share this post


Link to post
Share on other sites

Was that on your local machine or at the Trap server?The data gets read from a file (menu_data.txt) that is already defined and includes the information to build the page menu. The third entry in every line of that file is something like '?page=one' which builds the query string. The purpose of the script we are looking at here is to read that same file and pull out the list of acceptable query strings. If the user doesn't mess with the queery string, I agree that there should be no need for the security check, but in light of the fact that the real world exists, I am trying to re-use the data in the same format as it is presently available and perform this check against the data. It is not that it won't work, because it does on my machine. The problem is that it won't work at the Xisto server and if I knew why that was so, I could correct for the differences, but I just do not understand why it works locally on my machine and not up there.

Share this post


Link to post
Share on other sites

I tested it on my computer. The script you provided in the first post, gave me blank arrays. Then i modified it and it filled in the arrays based on the information given and seperated by commas in menu_data.txt . The modified version should work on Xisto. I have PHP v4.4.1 installed on this comp.

Share this post


Link to post
Share on other sites

Here, try this data, it is the actual file I have for testing. The good stuff is in the third column. Those are the query strings chunks I want to validate against. array element number 2. Only if it has the '?page=' as part of the string.

~ Pages ~,sbhead1,header,,Index Page,link,?page=index,Index Page here,Index Alternate Text here
Template Script,link,?page=one,Template Script Title,Template Script Alternate Text here
Sidebar Script,link,?page=two,Sidebar Script Title,Sidebar Script Alternate Text here
Array Script,link,?page=three,Array Script Title,Array Script Alternate Text here
Sample Menu Data,link,?page=four,Sample Menu Data Page,Sample Menu Data Alternate Text here
Contact Form,link,?page=five,Explain the email Form,Explain the email Form Text here
Contact the Author,link,?page=contact,Contact the Author from here,Contact the Author Alternate Text here
,,footer,,
~ Forums ~,sbhead2,header,,
Xisto,link1,trap17.com Forum and Hosting,Xisto Forum and Hosting
PC Pit Stop,link1,pcpitstop.com Pit Stop Forum,PC Pit Stop Forum
CSS Creator,link1,csscreator.com Creator Forum,CSS Creator Forum
PC How to's,link1,pchowtos.co.uk How To Forum,PC How To Forum
Xisto,link1,astahost.com Forum,Xisto Forum
,,footer,,
 ,sbhead1,header,,


Share this post


Link to post
Share on other sites

After modifying the script again:

                include ( $data_array2[0] . '.txt' );
}
else {
include ('index.txt');
}
}
elseif (in_array($submit , $data_array2)) {
if (file_exists($submit . '.txt' )) {
include ( $submit . '.txt' );
}
else {
include ('index.txt');
}
}

else {
if (file_exists($data_array2[0] . '.txt' )) {
include ( $data_array2[0] . '.txt' );
}
else {
include ('index.txt');
}
}
?> linenums:0'><?php$data_array = array();$data_array2 = array();$row = 0;$file_name = "menu_data.txt";$handle = @fopen($file_name, "r");if (!$handle) { echo "File Handle Not Available For Use"; exit; }while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $num = count($data); for ($c=0; $c < $num; $c++) { $data_array[$row][] = $data[$c]; } $row++;}/* if ( (strpos ($data[2],"$page="))) { $data_array[] = trim(substr($data[2], 6) ); }}*/fclose($handle);$data_array2 = $data_array;$submit = $_GET

;if( !isset($_GET

) || ($_GET

== NULL ) ) { if (file_exists($data_array2[0] . '.txt' )) { include ( $data_array2[0] . '.txt' ); } else { include ('index.txt'); } } elseif (in_array($submit , $data_array2)) { if (file_exists($submit . '.txt' )) { include ( $submit . '.txt' ); } else { include ('index.txt'); } } else { if (file_exists($data_array2[0] . '.txt' )) { include ( $data_array2[0] . '.txt' ); } else { include ('index.txt'); } }?>
You get something like this as the output:
Array(    [0] => Array        (            [0] => ~ Pages ~            [1] => sbhead1            [2] => header        )    [1] => Array        (            [0] => Index Page            [1] => link            [2] => ?page=index            [3] => Index Page here            [4] => Index Alternate Text here        )    [2] => Array        (            [0] => Template Script            [1] => link            [2] => ?page=one            [3] => Template Script Title            [4] => Template Script Alternate Text here        )    [3] => Array        (            [0] => Sidebar Script            [1] => link            [2] => ?page=two            [3] => Sidebar Script Title            [4] => Sidebar Script Alternate Text here        )    [4] => Array        (            [0] => Array Script            [1] => link            [2] => ?page=three            [3] => Array Script Title            [4] => Array Script Alternate Text here        )    [5] => Array        (            [0] => Sample Menu Data            [1] => link            [2] => ?page=four            [3] => Sample Menu Data Page            [4] => Sample Menu Data Alternate Text here        )    [6] => Array        (            [0] => Contact Form            [1] => link            [2] => ?page=five            [3] => Explain the email Form            [4] => Explain the email Form Text here        )    [7] => Array        (            [0] => Contact the Author            [1] => link            [2] => ?page=contact            [3] => Contact the Author from here            [4] => Contact the Author Alternate Text here        )    [8] => Array        (            [0] => footer        )    [9] => Array        (            [0] => ~ Forums ~            [1] => sbhead2            [2] => header        )    [10] => Array        (            [0] => Xisto            [1] => link1            [2] => [url="http://forums.xisto.com/"&;            [3] => Xisto Forum and Hosting            [4] => Xisto Forum and Hosting        )    [11] => Array        (            [0] => PC Pit Stop            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => PC Pit Stop Forum            [4] => PC Pit Stop Forum        )    [12] => Array        (            [0] => CSS Creator            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => CSS Creator Forum            [4] => CSS Creator Forum        )    [13] => Array        (            [0] => PC How to's            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => PC How To Forum            [4] => PC How To Forum        )    [14] => Array        (            [0] => Xisto            [1] => link1            [2] => [url="http://forums.xisto.com/"&;            [3] => Xisto Forum            [4] => Xisto Forum        )    [15] => Array        (            [0] => footer            [1] => sbhead1            [2] => header        ))Array(    [0] => Array        (            [0] => ~ Pages ~            [1] => sbhead1            [2] => header        )    [1] => Array        (            [0] => Index Page            [1] => link            [2] => ?page=index            [3] => Index Page here            [4] => Index Alternate Text here        )    [2] => Array        (            [0] => Template Script            [1] => link            [2] => ?page=one            [3] => Template Script Title            [4] => Template Script Alternate Text here        )    [3] => Array        (            [0] => Sidebar Script            [1] => link            [2] => ?page=two            [3] => Sidebar Script Title            [4] => Sidebar Script Alternate Text here        )    [4] => Array        (            [0] => Array Script            [1] => link            [2] => ?page=three            [3] => Array Script Title            [4] => Array Script Alternate Text here        )    [5] => Array        (            [0] => Sample Menu Data            [1] => link            [2] => ?page=four            [3] => Sample Menu Data Page            [4] => Sample Menu Data Alternate Text here        )    [6] => Array        (            [0] => Contact Form            [1] => link            [2] => ?page=five            [3] => Explain the email Form            [4] => Explain the email Form Text here        )    [7] => Array        (            [0] => Contact the Author            [1] => link            [2] => ?page=contact            [3] => Contact the Author from here            [4] => Contact the Author Alternate Text here        )    [8] => Array        (            [0] => footer        )    [9] => Array        (            [0] => ~ Forums ~            [1] => sbhead2            [2] => header        )    [10] => Array        (            [0] => Xisto            [1] => link1            [2] => [url="http://forums.xisto.com/"&;            [3] => Xisto Forum and Hosting            [4] => Xisto Forum and Hosting        )    [11] => Array        (            [0] => PC Pit Stop            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => PC Pit Stop Forum            [4] => PC Pit Stop Forum        )    [12] => Array        (            [0] => CSS Creator            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => CSS Creator Forum            [4] => CSS Creator Forum        )    [13] => Array        (            [0] => PC How to's            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => PC How To Forum            [4] => PC How To Forum        )    [14] => Array        (            [0] => Xisto            [1] => link1            [2] => [url="http://forums.xisto.com/"&;            [3] => Xisto Forum            [4] => Xisto Forum        )    [15] => Array        (            [0] => footer            [1] => sbhead1            [2] => header        ))Array(    [0] => Array        (            [0] => ~ Pages ~            [1] => sbhead1            [2] => header        )    [1] => Array        (            [0] => Index Page            [1] => link            [2] => ?page=index            [3] => Index Page here            [4] => Index Alternate Text here        )    [2] => Array        (            [0] => Template Script            [1] => link            [2] => ?page=one            [3] => Template Script Title            [4] => Template Script Alternate Text here        )    [3] => Array        (            [0] => Sidebar Script            [1] => link            [2] => ?page=two            [3] => Sidebar Script Title            [4] => Sidebar Script Alternate Text here        )    [4] => Array        (            [0] => Array Script            [1] => link            [2] => ?page=three            [3] => Array Script Title            [4] => Array Script Alternate Text here        )    [5] => Array        (            [0] => Sample Menu Data            [1] => link            [2] => ?page=four            [3] => Sample Menu Data Page            [4] => Sample Menu Data Alternate Text here        )    [6] => Array        (            [0] => Contact Form            [1] => link            [2] => ?page=five            [3] => Explain the email Form            [4] => Explain the email Form Text here        )    [7] => Array        (            [0] => Contact the Author            [1] => link            [2] => ?page=contact            [3] => Contact the Author from here            [4] => Contact the Author Alternate Text here        )    [8] => Array        (            [0] => footer        )    [9] => Array        (            [0] => ~ Forums ~            [1] => sbhead2            [2] => header        )    [10] => Array        (            [0] => Xisto            [1] => link1            [2] => [url="http://forums.xisto.com/"&;            [3] => Xisto Forum and Hosting            [4] => Xisto Forum and Hosting        )    [11] => Array        (            [0] => PC Pit Stop            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => PC Pit Stop Forum            [4] => PC Pit Stop Forum        )    [12] => Array        (            [0] => CSS Creator            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => CSS Creator Forum            [4] => CSS Creator Forum        )    [13] => Array        (            [0] => PC How to's            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => PC How To Forum            [4] => PC How To Forum        )    [14] => Array        (            [0] => Xisto            [1] => link1            [2] => [url="http://forums.xisto.com/"&;            [3] => Xisto Forum            [4] => Xisto Forum        )    [15] => Array        (            [0] => footer            [1] => sbhead1            [2] => header        ))Array(    [0] => Array        (            [0] => ~ Pages ~            [1] => sbhead1            [2] => header        )    [1] => Array        (            [0] => Index Page            [1] => link            [2] => ?page=index            [3] => Index Page here            [4] => Index Alternate Text here        )    [2] => Array        (            [0] => Template Script            [1] => link            [2] => ?page=one            [3] => Template Script Title            [4] => Template Script Alternate Text here        )    [3] => Array        (            [0] => Sidebar Script            [1] => link            [2] => ?page=two            [3] => Sidebar Script Title            [4] => Sidebar Script Alternate Text here        )    [4] => Array        (            [0] => Array Script            [1] => link            [2] => ?page=three            [3] => Array Script Title            [4] => Array Script Alternate Text here        )    [5] => Array        (            [0] => Sample Menu Data            [1] => link            [2] => ?page=four            [3] => Sample Menu Data Page            [4] => Sample Menu Data Alternate Text here        )    [6] => Array        (            [0] => Contact Form            [1] => link            [2] => ?page=five            [3] => Explain the email Form            [4] => Explain the email Form Text here        )    [7] => Array        (            [0] => Contact the Author            [1] => link            [2] => ?page=contact            [3] => Contact the Author from here            [4] => Contact the Author Alternate Text here        )    [8] => Array        (            [0] => footer        )    [9] => Array        (            [0] => ~ Forums ~            [1] => sbhead2            [2] => header        )    [10] => Array        (            [0] => Xisto            [1] => link1            [2] => [url="http://forums.xisto.com/"&;            [3] => Xisto Forum and Hosting            [4] => Xisto Forum and Hosting        )    [11] => Array        (            [0] => PC Pit Stop            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => PC Pit Stop Forum            [4] => PC Pit Stop Forum        )    [12] => Array        (            [0] => CSS Creator            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => CSS Creator Forum            [4] => CSS Creator Forum        )    [13] => Array        (            [0] => PC How to's            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => PC How To Forum            [4] => PC How To Forum        )    [14] => Array        (            [0] => Xisto            [1] => link1            [2] => [url="http://forums.xisto.com/"&;            [3] => Xisto Forum            [4] => Xisto Forum        )    [15] => Array        (            [0] => footer            [1] => sbhead1            [2] => header        ))Array(    [0] => Array        (            [0] => ~ Pages ~            [1] => sbhead1            [2] => header        )    [1] => Array        (            [0] => Index Page            [1] => link            [2] => ?page=index            [3] => Index Page here            [4] => Index Alternate Text here        )    [2] => Array        (            [0] => Template Script            [1] => link            [2] => ?page=one            [3] => Template Script Title            [4] => Template Script Alternate Text here        )    [3] => Array        (            [0] => Sidebar Script            [1] => link            [2] => ?page=two            [3] => Sidebar Script Title            [4] => Sidebar Script Alternate Text here        )    [4] => Array        (            [0] => Array Script            [1] => link            [2] => ?page=three            [3] => Array Script Title            [4] => Array Script Alternate Text here        )    [5] => Array        (            [0] => Sample Menu Data            [1] => link            [2] => ?page=four            [3] => Sample Menu Data Page            [4] => Sample Menu Data Alternate Text here        )    [6] => Array        (            [0] => Contact Form            [1] => link            [2] => ?page=five            [3] => Explain the email Form            [4] => Explain the email Form Text here        )    [7] => Array        (            [0] => Contact the Author            [1] => link            [2] => ?page=contact            [3] => Contact the Author from here            [4] => Contact the Author Alternate Text here        )    [8] => Array        (            [0] => footer        )    [9] => Array        (            [0] => ~ Forums ~            [1] => sbhead2            [2] => header        )    [10] => Array        (            [0] => Xisto            [1] => link1            [2] => [url="http://forums.xisto.com/"&;            [3] => Xisto Forum and Hosting            [4] => Xisto Forum and Hosting        )    [11] => Array        (            [0] => PC Pit Stop            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => PC Pit Stop Forum            [4] => PC Pit Stop Forum        )    [12] => Array        (            [0] => CSS Creator            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => CSS Creator Forum            [4] => CSS Creator Forum        )    [13] => Array        (            [0] => PC How to's            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => PC How To Forum            [4] => PC How To Forum        )    [14] => Array        (            [0] => Xisto            [1] => link1            [2] => [url="http://forums.xisto.com/"&;            [3] => Xisto Forum            [4] => Xisto Forum        )    [15] => Array        (            [0] => footer            [1] => sbhead1            [2] => header        ))Array(    [0] => Array        (            [0] => ~ Pages ~            [1] => sbhead1            [2] => header        )    [1] => Array        (            [0] => Index Page            [1] => link            [2] => ?page=index            [3] => Index Page here            [4] => Index Alternate Text here        )    [2] => Array        (            [0] => Template Script            [1] => link            [2] => ?page=one            [3] => Template Script Title            [4] => Template Script Alternate Text here        )    [3] => Array        (            [0] => Sidebar Script            [1] => link            [2] => ?page=two            [3] => Sidebar Script Title            [4] => Sidebar Script Alternate Text here        )    [4] => Array        (            [0] => Array Script            [1] => link            [2] => ?page=three            [3] => Array Script Title            [4] => Array Script Alternate Text here        )    [5] => Array        (            [0] => Sample Menu Data            [1] => link            [2] => ?page=four            [3] => Sample Menu Data Page            [4] => Sample Menu Data Alternate Text here        )    [6] => Array        (            [0] => Contact Form            [1] => link            [2] => ?page=five            [3] => Explain the email Form            [4] => Explain the email Form Text here        )    [7] => Array        (            [0] => Contact the Author            [1] => link            [2] => ?page=contact            [3] => Contact the Author from here            [4] => Contact the Author Alternate Text here        )    [8] => Array        (            [0] => footer        )    [9] => Array        (            [0] => ~ Forums ~            [1] => sbhead2            [2] => header        )    [10] => Array        (            [0] => Xisto            [1] => link1            [2] => [url="http://forums.xisto.com/"&;            [3] => Xisto Forum and Hosting            [4] => Xisto Forum and Hosting        )    [11] => Array        (            [0] => PC Pit Stop            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => PC Pit Stop Forum            [4] => PC Pit Stop Forum        )    [12] => Array        (            [0] => CSS Creator            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => CSS Creator Forum            [4] => CSS Creator Forum        )    [13] => Array        (            [0] => PC How to's            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => PC How To Forum            [4] => PC How To Forum        )    [14] => Array        (            [0] => Xisto            [1] => link1            [2] => [url="http://forums.xisto.com/"&;            [3] => Xisto Forum            [4] => Xisto Forum        )    [15] => Array        (            [0] => footer            [1] => sbhead1            [2] => header        ))Array(    [0] => Array        (            [0] => ~ Pages ~            [1] => sbhead1            [2] => header        )    [1] => Array        (            [0] => Index Page            [1] => link            [2] => ?page=index            [3] => Index Page here            [4] => Index Alternate Text here        )    [2] => Array        (            [0] => Template Script            [1] => link            [2] => ?page=one            [3] => Template Script Title            [4] => Template Script Alternate Text here        )    [3] => Array        (            [0] => Sidebar Script            [1] => link            [2] => ?page=two            [3] => Sidebar Script Title            [4] => Sidebar Script Alternate Text here        )    [4] => Array        (            [0] => Array Script            [1] => link            [2] => ?page=three            [3] => Array Script Title            [4] => Array Script Alternate Text here        )    [5] => Array        (            [0] => Sample Menu Data            [1] => link            [2] => ?page=four            [3] => Sample Menu Data Page            [4] => Sample Menu Data Alternate Text here        )    [6] => Array        (            [0] => Contact Form            [1] => link            [2] => ?page=five            [3] => Explain the email Form            [4] => Explain the email Form Text here        )    [7] => Array        (            [0] => Contact the Author            [1] => link            [2] => ?page=contact            [3] => Contact the Author from here            [4] => Contact the Author Alternate Text here        )    [8] => Array        (            [0] => footer        )    [9] => Array        (            [0] => ~ Forums ~            [1] => sbhead2            [2] => header        )    [10] => Array        (            [0] => Xisto            [1] => link1            [2] => [url="http://forums.xisto.com/"&;            [3] => Xisto Forum and Hosting            [4] => Xisto Forum and Hosting        )    [11] => Array        (            [0] => PC Pit Stop            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => PC Pit Stop Forum            [4] => PC Pit Stop Forum        )    [12] => Array        (            [0] => CSS Creator            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => CSS Creator Forum            [4] => CSS Creator Forum        )    [13] => Array        (            [0] => PC How to's            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => PC How To Forum            [4] => PC How To Forum        )    [14] => Array        (            [0] => Xisto            [1] => link1            [2] => [url="http://forums.xisto.com/"&;            [3] => Xisto Forum            [4] => Xisto Forum        )    [15] => Array        (            [0] => footer            [1] => sbhead1            [2] => header        ))Array(    [0] => Array        (            [0] => ~ Pages ~            [1] => sbhead1            [2] => header        )    [1] => Array        (            [0] => Index Page            [1] => link            [2] => ?page=index            [3] => Index Page here            [4] => Index Alternate Text here        )    [2] => Array        (            [0] => Template Script            [1] => link            [2] => ?page=one            [3] => Template Script Title            [4] => Template Script Alternate Text here        )    [3] => Array        (            [0] => Sidebar Script            [1] => link            [2] => ?page=two            [3] => Sidebar Script Title            [4] => Sidebar Script Alternate Text here        )    [4] => Array        (            [0] => Array Script            [1] => link            [2] => ?page=three            [3] => Array Script Title            [4] => Array Script Alternate Text here        )    [5] => Array        (            [0] => Sample Menu Data            [1] => link            [2] => ?page=four            [3] => Sample Menu Data Page            [4] => Sample Menu Data Alternate Text here        )    [6] => Array        (            [0] => Contact Form            [1] => link            [2] => ?page=five            [3] => Explain the email Form            [4] => Explain the email Form Text here        )    [7] => Array        (            [0] => Contact the Author            [1] => link            [2] => ?page=contact            [3] => Contact the Author from here            [4] => Contact the Author Alternate Text here        )    [8] => Array        (            [0] => footer        )    [9] => Array        (            [0] => ~ Forums ~            [1] => sbhead2            [2] => header        )    [10] => Array        (            [0] => Xisto            [1] => link1            [2] => [url="http://forums.xisto.com/"&;            [3] => Xisto Forum and Hosting            [4] => Xisto Forum and Hosting        )    [11] => Array        (            [0] => PC Pit Stop            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => PC Pit Stop Forum            [4] => PC Pit Stop Forum        )    [12] => Array        (            [0] => CSS Creator            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => CSS Creator Forum            [4] => CSS Creator Forum        )    [13] => Array        (            [0] => PC How to's            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => PC How To Forum            [4] => PC How To Forum        )    [14] => Array        (            [0] => Xisto            [1] => link1            [2] => [url="http://forums.xisto.com/"&;            [3] => Xisto Forum            [4] => Xisto Forum        )    [15] => Array        (            [0] => footer            [1] => sbhead1            [2] => header        ))Array(    [0] => Array        (            [0] => ~ Pages ~            [1] => sbhead1            [2] => header        )    [1] => Array        (            [0] => Index Page            [1] => link            [2] => ?page=index            [3] => Index Page here            [4] => Index Alternate Text here        )    [2] => Array        (            [0] => Template Script            [1] => link            [2] => ?page=one            [3] => Template Script Title            [4] => Template Script Alternate Text here        )    [3] => Array        (            [0] => Sidebar Script            [1] => link            [2] => ?page=two            [3] => Sidebar Script Title            [4] => Sidebar Script Alternate Text here        )    [4] => Array        (            [0] => Array Script            [1] => link            [2] => ?page=three            [3] => Array Script Title            [4] => Array Script Alternate Text here        )    [5] => Array        (            [0] => Sample Menu Data            [1] => link            [2] => ?page=four            [3] => Sample Menu Data Page            [4] => Sample Menu Data Alternate Text here        )    [6] => Array        (            [0] => Contact Form            [1] => link            [2] => ?page=five            [3] => Explain the email Form            [4] => Explain the email Form Text here        )    [7] => Array        (            [0] => Contact the Author            [1] => link            [2] => ?page=contact            [3] => Contact the Author from here            [4] => Contact the Author Alternate Text here        )    [8] => Array        (            [0] => footer        )    [9] => Array        (            [0] => ~ Forums ~            [1] => sbhead2            [2] => header        )    [10] => Array        (            [0] => Xisto            [1] => link1            [2] => [url="http://forums.xisto.com/"&;            [3] => Xisto Forum and Hosting            [4] => Xisto Forum and Hosting        )    [11] => Array        (            [0] => PC Pit Stop            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => PC Pit Stop Forum            [4] => PC Pit Stop Forum        )    [12] => Array        (            [0] => CSS Creator            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => CSS Creator Forum            [4] => CSS Creator Forum        )    [13] => Array        (            [0] => PC How to's            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => PC How To Forum            [4] => PC How To Forum        )    [14] => Array        (            [0] => Xisto            [1] => link1            [2] => [url="http://forums.xisto.com/"&;            [3] => Xisto Forum            [4] => Xisto Forum        )    [15] => Array        (            [0] => footer            [1] => sbhead1            [2] => header        ))Array(    [0] => Array        (            [0] => ~ Pages ~            [1] => sbhead1            [2] => header        )    [1] => Array        (            [0] => Index Page            [1] => link            [2] => ?page=index            [3] => Index Page here            [4] => Index Alternate Text here        )    [2] => Array        (            [0] => Template Script            [1] => link            [2] => ?page=one            [3] => Template Script Title            [4] => Template Script Alternate Text here        )    [3] => Array        (            [0] => Sidebar Script            [1] => link            [2] => ?page=two            [3] => Sidebar Script Title            [4] => Sidebar Script Alternate Text here        )    [4] => Array        (            [0] => Array Script            [1] => link            [2] => ?page=three            [3] => Array Script Title            [4] => Array Script Alternate Text here        )    [5] => Array        (            [0] => Sample Menu Data            [1] => link            [2] => ?page=four            [3] => Sample Menu Data Page            [4] => Sample Menu Data Alternate Text here        )    [6] => Array        (            [0] => Contact Form            [1] => link            [2] => ?page=five            [3] => Explain the email Form            [4] => Explain the email Form Text here        )    [7] => Array        (            [0] => Contact the Author            [1] => link            [2] => ?page=contact            [3] => Contact the Author from here            [4] => Contact the Author Alternate Text here        )    [8] => Array        (            [0] => footer        )    [9] => Array        (            [0] => ~ Forums ~            [1] => sbhead2            [2] => header        )    [10] => Array        (            [0] => Xisto            [1] => link1            [2] => [url="http://forums.xisto.com/"&;            [3] => Xisto Forum and Hosting            [4] => Xisto Forum and Hosting        )    [11] => Array        (            [0] => PC Pit Stop            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => PC Pit Stop Forum            [4] => PC Pit Stop Forum        )    [12] => Array        (            [0] => CSS Creator            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => CSS Creator Forum            [4] => CSS Creator Forum        )    [13] => Array        (            [0] => PC How to's            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => PC How To Forum            [4] => PC How To Forum        )    [14] => Array        (            [0] => Xisto            [1] => link1            [2] => [url="http://forums.xisto.com/"&;            [3] => Xisto Forum            [4] => Xisto Forum        )    [15] => Array        (            [0] => footer            [1] => sbhead1            [2] => header        ))Array(    [0] => Array        (            [0] => ~ Pages ~            [1] => sbhead1            [2] => header        )    [1] => Array        (            [0] => Index Page            [1] => link            [2] => ?page=index            [3] => Index Page here            [4] => Index Alternate Text here        )    [2] => Array        (            [0] => Template Script            [1] => link            [2] => ?page=one            [3] => Template Script Title            [4] => Template Script Alternate Text here        )    [3] => Array        (            [0] => Sidebar Script            [1] => link            [2] => ?page=two            [3] => Sidebar Script Title            [4] => Sidebar Script Alternate Text here        )    [4] => Array        (            [0] => Array Script            [1] => link            [2] => ?page=three            [3] => Array Script Title            [4] => Array Script Alternate Text here        )    [5] => Array        (            [0] => Sample Menu Data            [1] => link            [2] => ?page=four            [3] => Sample Menu Data Page            [4] => Sample Menu Data Alternate Text here        )    [6] => Array        (            [0] => Contact Form            [1] => link            [2] => ?page=five            [3] => Explain the email Form            [4] => Explain the email Form Text here        )    [7] => Array        (            [0] => Contact the Author            [1] => link            [2] => ?page=contact            [3] => Contact the Author from here            [4] => Contact the Author Alternate Text here        )    [8] => Array        (            [0] => footer        )    [9] => Array        (            [0] => ~ Forums ~            [1] => sbhead2            [2] => header        )    [10] => Array        (            [0] => Xisto            [1] => link1            [2] => [url="http://forums.xisto.com/"&;            [3] => Xisto Forum and Hosting            [4] => Xisto Forum and Hosting        )    [11] => Array        (            [0] => PC Pit Stop            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => PC Pit Stop Forum            [4] => PC Pit Stop Forum        )    [12] => Array        (            [0] => CSS Creator            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => CSS Creator Forum            [4] => CSS Creator Forum        )    [13] => Array        (            [0] => PC How to's            [1] => link1            [2] => [url="http://forums.xisto.com/no_longer_exists/;            [3] => PC How To Forum            [4] => PC How To Forum        )    [14] => Array        (            [0] => Xisto            [1] => link1            [2] => [url="http://forums.xisto.com/"&;            [3] => Xisto Forum            [4] => Xisto Forum        )    [15] => Array        (            [0] => footer            [1] => sbhead1            [2] => header        ))

From this:
~ Pages ~,sbhead1,headerIndex Page,link,?page=index,Index Page here,Index Alternate Text hereTemplate Script,link,?page=one,Template Script Title,Template Script Alternate Text hereSidebar Script,link,?page=two,Sidebar Script Title,Sidebar Script Alternate Text hereArray Script,link,?page=three,Array Script Title,Array Script Alternate Text hereSample Menu Data,link,?page=four,Sample Menu Data Page,Sample Menu Data Alternate Text hereContact Form,link,?page=five,Explain the email Form,Explain the email Form Text hereContact the Author,link,?page=contact,Contact the Author from here,Contact the Author Alternate Text herefooter~ Forums ~,sbhead2,headerXisto,link1,http://trap17.com Forum and Hosting,Xisto Forum and HostingPC Pit Stop,link1,http://pcpitstop.com Pit Stop Forum,PC Pit Stop ForumCSS Creator,link1,http://csscreator.com Creator Forum,CSS Creator ForumPC How to's,link1,http://pchowtos.co.uk How To Forum,PC How To ForumXisto,link1,http://astahost.com Forum,Xisto Forumfooter,sbhead1,header

Share this post


Link to post
Share on other sites

Before I present the alternative solution, I want to thank Truefusion for his efforts in assisting with this problem. That's what this Community is all about. Learning stuff and helping others to learn. Thanks, again.

Perhaps I wasn't too clear about the purpose of the data checking in this script, but what I expected from the original code was an array built from the third column in the data file (array element [2]) which has all the 'valid query string' results, from building the menu from the same data, so if someone messed with the query string, the Index page would be produced instead. Essentially, create a list of 'valid' results for the query string. As stated above, I had it working quite well on m machine, but for some reason, it would fail on the Xisto server.

So, I reduced all the Logic checks to check against an array which I had manually built and added to the file system. It now works great (again). Only downside is that any new menu items must be added to the array by hand, which on a small site is okay, but on a large site, or one which is dynamically created, is a concern. I'm no tfinished with this yet. I will come up with a better answer, but for now, here is the fix:

Data Array: create an array of acceptable query string values like this: I have it contained in an seperate file so the user doesn't have to change the code in the script file, but it could also be placed directly in the script, too. Depends on whether the user is savvy enough to alter the array contents without messing something up. If the Array is outside the script, only the data file gets whacked, not the scripting.

Contents of sample data array file:

<?php$data_array = array('index', 'one', 'two', 'three', 'four', 'five', 'contact');?>

And here is the new logic portion of the script: all it does is check against the array values as contained in the array listed above. So now I'll come up with a method to update the array based on the contents of the menu_data_element[2] and it will all be good again.
$submit = $_GET

;
echo $_GET

;

if( !isset($_GET

) ) {
if (file_exists($data_array[0] . '.txt' )) {
include ( $data_array[0] . '.txt' );
}
else {
include ('index.txt');
}
}
elseif (in_array($submit , $data_array)) {
if (file_exists($submit . '.txt' )) {
include ( $submit . '.txt' );
}
else {
include ('index.txt');
}
}
else {
if (file_exists($data_array[0] . '.txt' )) {
include ( $data_array[0] . '.txt' );
}
else {
include ('index.txt');
}
}
?> linenums:0'><?phpinclude( 'menu_array.php' ) ;$submit = $_GET

;echo $_GET

;if( !isset($_GET

) ) { if (file_exists($data_array[0] . '.txt' )) { include ( $data_array[0] . '.txt' ); } else { include ('index.txt'); } } elseif (in_array($submit , $data_array)) { if (file_exists($submit . '.txt' )) { include ( $submit . '.txt' ); } else { include ('index.txt'); } } else { if (file_exists($data_array[0] . '.txt' )) { include ( $data_array[0] . '.txt' ); } else { include ('index.txt'); } }?>
Thanks agian to Truefusion and the others who had a look at this problem.

Share this post


Link to post
Share on other sites

Glad to have helped! But, i also, would like to give thanks, for introducing me to the fgetcsv function. I wasnt aware of such a function, and its purpose. I find it quite useful, and may even use it in a script of mine. Maybe for a new CMS that i might make, or something. Since, the previous one i've made, works fine, but lacks some features. I'm always looking for another alternative for a database.

Share this post


Link to post
Share on other sites

Yes, me too. I am familiar with Databases, and all that, but there are places where they may not be available. For instance, my ISP gives me a space with a private URL, but no access to Database services, so I am trying to develop a small site which does not require them. Funny how they will allow php, but no databases? The two go hand in hand for so many uses... also, why use a database for seven entries to setup a menu?

Share this post


Link to post
Share on other sites

Some hosts don't run scripts properly but luckily for me Xisto has run every script that I've wanted to use. What I can't understand is why can't all hosts be the same and actually work.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.