Forums Sign Up Reply Search Statistics
Fast Template GraFX Software Solutions - Forum / Fast Template /

Question about cache file name using $_SERVER['argv']

 
Author rr1024
Forums Member
#1 Posted: 27 Nov 2007 09:13:45
Reply 
The outputs are as such
$fname = 06ed1ec76d691a0ffcdedd1953104501.ft

Before Md5
$FName .= join( "_and_", $q );

preMd5 = /testing/fastdemo/iscripts_test1.php?ID=3&myid=sys temID=3&myid=system

print_r of $_SERVER['argv'] = Array ( [0] => ID=3&myid=system )

This seems strange since $_SERVER['argv'] contains the same vars in [0] however I'm not sure how $_SERVER['argv'] would produce more arrays, there very little information that I could find.

Does $_SERVER['argv'] combine post vars and get vars how would it ever have multiple vars like
[0] ID=3&myid=system
[1] some other vars
[2] somemore vars

If $_SERVER['argv'] does also include posted or some other information from where ever then shouldn't
IF ( count( $_SERVER['argv'] ) )

BE this way
IF ( count( $_SERVER['argv'] ) > 1 )
Author software
Admin
#2 Posted: 28 Nov 2007 23:20:17
Reply 
self_script function will be changed so this part
$fname = $_SERVER['REQUEST_URI'];
if (count($_SERVER['argv'])) {
foreach ($_SERVER['argv'] as $val) {
$q[] = $val;
}
$fname .= join("_and_", $q);
}

is no longer valid.
There are servers where $_SERVER['argv'] is not allowed so it will be better I guess
$fname = md5(getenv('SCRIPT_NAME').str_replace("&","_and_", $_SERVER['QUERY_STRING']));
like this
Author rr1024
Forums Member
#3 Posted: 29 Nov 2007 01:27:38
Reply 
Just a question why bother with the string replace in th query string, why not just do it simply?

IF ( isSet( $_SERVER ) ) {
$fname = md5( $_SERVER['REQUEST_URI'] );
OR
$fname = md5( $_SERVER['SCRIPT_NAME'] . $_SERVER['QUERY_STRING'] );
}ELSE{
$fname = md5( getenv('SCRIPT_NAME') . getenv['QUERY_STRING'] );
}

This seems like it would be easier ?? I've never known any problems with md5 having issues with &
Author rr1024
Forums Member
#4 Posted: 29 Nov 2007 04:26:12
Reply 
Here is my test results and code

ERROR: ( GET = /testing/fast_tpl/orgingal/cache_ex.php ?? ID=3333&ar=abc&dd=hello%20world ) -- ( SERVER = /testing/fast_tpl/orgingal/cache_ex.php ?? ID=3333&ar=abc&dd=hello%20world ) -- ( Fname = 3b241b4298942e43a8c44677cc56891d )
ERROR: ( GET = /testing/fast_tpl/orgingal/cache_ex.php ?? ID=3333&ar=abc&dd=hello%20world ) -- ( SERVER = /testing/fast_tpl/orgingal/cache_ex.php ?? ID=3333&ar=abc&dd=hello%20world ) -- ( Fname = 3b241b4298942e43a8c44677cc56891d )

The code I used was as follows:

IF ( isSet( $_SERVER ) ) {
//$fname = md5( $_SERVER['REQUEST_URI'] );
//OR
$fname = md5( $_SERVER['SCRIPT_NAME'] . trim( $_SERVER['QUERY_STRING'] ) );
}ELSE{
$fname = md5( getenv('SCRIPT_NAME') . trim( getenv('QUERY_STRING') ) );
}
$T1 = "GET = " . getenv('SCRIPT_NAME') ." ?? ". trim( getenv('QUERY_STRING') );
$T2 = "SERVER = " . $_SERVER['SCRIPT_NAME'] . " ?? " . trim( $_SERVER['QUERY_STRING'] );
$T3 = "Fname = " . $fname;
$this->error(" ( $T1 ) -- ( $T2 ) -- ( $T3 )", 0 );

The above code I used to replace the following code.

IF ( count( $_SERVER['argv'] ) > 1 ) { //WAS? IF ( count( $_SERVER['argv'] ) ) {
FOREACH ( $_SERVER['argv'] AS $val) {
$q[] = $val;
}

$fname .= join("_and_", $q);
}

seems to work and can't think of any reason to continue using the _and_ replacement unless you know a good reason??

Oh...by the way....Fast template is very nice....thanks for keeping it going!!!! I like it much much better than smarty which is a hog, slow and way too complicated
Author rr1024
Forums Member
#5 Posted: 29 Nov 2007 04:28:51
Reply 
Hope this is useful
Author software
Admin
#6 Posted: 4 Dec 2007 17:25:49
Reply 
It's no use of md5 either if we are looking at this from certain angleIt's no use of md5 either if we are looking at this from certain angle.
If you use md5 there should be no problem with or without _and_ but
if you want to dump md5 ( for different reasons), this replace is important.
In linux gives strange results if you use & in file names.

Oh...by the way....Fast template is very nice....thanks for keeping it going!!!! I like it much much better than smarty which is a hog, slow and way too complicated

Th ;) We are all doing it ;)
That includes you so it's helpful.
 
Your Reply

» Username  » Password 
Only registered users are allowed to post here. Please enter your login/password details upon posting a message, or sign up first.