sig.php & av.php return only default png images

A signature and avatar generator addon

Moderator: zanix

sig.php & av.php return only default png images

Postby rubio25 » Tue Sep 25, 2007 4:52 am

When I use the regular image output over the name URL parmaeter I get what I expect,
....addons/siggen/sig.php?name=Alastor&saveonly=0

But when I use the png parameter I get only the default image back. (same if I switch to any other file format)

Example URL is here:
..../addons/siggen/sig.php/Alastor.png

The fact that I am getting a png file generated indicates that permission and rewrite functions are set up ok, it is like sig.php can not retrieve the user information from the data base.

Is there anything I am doing wrong ? Do we have some debug switches I can pull here ? ANy input would be appreciated.
Last edited by rubio25 on Tue Oct 02, 2007 5:41 pm, edited 1 time in total.
rubio25
WR.net Apprentice
WR.net Apprentice
 
Posts: 8
Joined: Tue Jul 11, 2006 11:54 pm

sig.php & av.php return only default png images

Postby zanix » Tue Sep 25, 2007 5:51 am

Your server doesn't support getting the path after the .php
Code: Select all
http://wow.devportal.org/roster/addons/siggen/sig.php/Alastor.png

This is stated in the SigGen documentation

Remember, sig.php/Name.png is different than using mod_rewrite to allow sig/Name.png
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5543
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

Re: sig.php & av.php return only default png images

Postby rubio25 » Wed Oct 03, 2007 3:09 am

--Solved --

Now I did my resaerch, cause Zanix was saying my server would not forward the correct path.

Took me some time to figure it out. In the siggen.php file the charname is retrieved either as a $GET variable, that is when we use the usual path:

sig.php?member=charname or when we use the fake one sig.php/charname.png you get it using a global server variable named $_SERVER['PATH_INFO']

The name is than placed into a variable that is used in a SQL statement to retrieve the char's details out of the roster database.

Now when the hoster switches off some of the globals or changes them or you have another apache derivate that is using another standard, than the $_SERVER['PATH_INFO'] might be empty thus the name can not be retrieved and the expected image will not be build. In my case the PATH_INFO value in the array is empty, as a consequence the sql statment can not work and the default settings kick in.

Unless you do a proper URL redirect in .htaccess, that is the server takes care that the URL is replaced by a one which filles the $Get varibale with the proper char name, which in my case did not work either.

If you need into about how to do a redirect in the .htaccess file [url=http://www.wowroster.net/MediaWiki/SigGen#Usage]read this section in the manual
[/url]
If you do not know what this is about you need to take a weekend off and google for the .htaccess file description or consult the apache .htaccess manual.

I am not sure why the redirect did not work on my server, I am still looking into my regular expressions there but my guess is that the hoster overrides my settings as the error log does not show any .htaccess errors unless I delibaretly do introduce one to test if it is working at all.

What I did is I wrote a php script to debug which varibles do I have access to from the siggen directory and thus found one which I could use instead of $_SERVER['PATH_INFO'].

In my case I have one called $_SERVER['ORIG_PATH_INFO']

so I extended the siggen.php file as follows:

[PHP]

// do the alternate name eval when globals are screwed up

// hack if global path info is empty check if different exist

if( empty($char_name))
{
$pngspoof = $_SERVER['ORIG_PATH_INFO'];
$leftstring= "php/" ;
$char_name = extractBetweenDelimeters($pngspoof, $leftstring ,".png");

}

function extractBetweenDelimeters($inputstr,$delimeterLeft,$delimeterRight) {
$posLeft = stripos($inputstr,$delimeterLeft)+1;
$posRight = stripos($inputstr,$delimeterRight,$posLeft+2);
return substr($inputstr,$posLeft,$posRight-$posLeft);
}

[/PHP]

I set this lines directly in front of // Get image mode ( signature | avatar | etc ) around Line 98

Now the name char variable gets filled and I have what I wanted without needing to redirect and fumble around with the hoster.

So when this happens that the image url is not parsed as expected check the server varibles first to see it the name tag is empty.

Just my 2 cents.
Last edited by rubio25 on Thu Oct 04, 2007 6:12 pm, edited 9 times in total.
rubio25
WR.net Apprentice
WR.net Apprentice
 
Posts: 8
Joined: Tue Jul 11, 2006 11:54 pm

Re: sig.php & av.php return only default png images

Postby rubio25 » Thu Oct 04, 2007 5:56 pm

You can use this file to test the server variables. To test upload this file to your server and place it in the siggen root folder, than call it via browser. - only use for troubleshooting sever variables.

Usage: Copy paste source text into a blank file and save as test.php, than upload into the siggen root for testing - - delete after testing for security purposes.

Code: Select all


<p>
   <h2> Testing Server and local Browser variables </h2>

   to test siggen use the url format <br>
   http://www.example.com/roster/addons/siggen/test.php/Charname.png<br>
   change the URL according to your server and path settings. <br>
   change Charname.png to a valid value <br>
   For <b>security reasons</b> it is highly recommended that you <b> DELETE</b>  this script after testing<br>
</p>

<?php

if( $_SERVER['PATH_INFO']=="")
{
   echo "<h2> char_name is empty - SERVER['PATH_INFO'] not filled </h2>" ;
}


echo "PHP_SELF=".$PHP_SELF."<br>QUERY_STRING=".$QUERY_STRING."<br>";
foreach ($_GET as $key => $value ){    echo "Name: ",$key,"   Value :",$value ,"<br>";}print_r($_GET);

foreach ($_SERVER as $key => $value ){    echo "Name: ",$key,"   Value :",$value."<br>";}print_r($_SERVER);

?>

rubio25
WR.net Apprentice
WR.net Apprentice
 
Posts: 8
Joined: Tue Jul 11, 2006 11:54 pm


Return to SigGen

Who is online

Users browsing this forum: No registered users and 0 guests

cron