Computer Science Canada read values from url www.l.com/3@4.png |
Author: | abcdefghijklmnopqrstuvwxy [ Wed Mar 21, 2007 9:15 pm ] |
Post subject: | read values from url www.l.com/3@4.png |
How do i use the values 3 and 4 in php code from nothing but that url? |
Author: | octopi [ Wed Mar 21, 2007 9:38 pm ] |
Post subject: | Re: read values from url www.l.com/3@4.png |
the correct format for doing things like this it www.host.com/path/to/file.php?var=value&var2=value2 now, in php you can do the following: $var = $_REQUEST['var']; $var2 = $_REQUEST['var2']; print $var; //out puts value; print $var2; //outputs value2 alternatively if your trying to do something custom (and stupid), you can access the HTTP_SERVER_VARS array, if you aren't doing the standard things, and develop your anwser from values in there. |
Author: | abcdefghijklmnopqrstuvwxy [ Wed Mar 21, 2007 10:01 pm ] |
Post subject: | RE:read values from url www.l.com/3@4.png |
Cool... What i'm trying to do is make a signature image that will display in forums. If I made the img link to say www.myhost.com/signature.png?var=value&var2=value2 will that work as expected? EDIT: not just a signature image but a php script that pretends to be a png image. |
Author: | rdrake [ Wed Mar 21, 2007 10:11 pm ] |
Post subject: | RE:read values from url www.l.com/3@4.png |
Make sure your web server is set up to process the PNG files as PHP scripts first. As for whether or not it'd work, I doubt it. If the forum is using phpBB then it probably will work, other forums actually require you to have images in an image tag. You would be better off just using a regular script with the PHP ending. Many images are in the PNG format and it would be impractical for you to use that as a PHP alias, as normal images would also be processed as scripts. |
Author: | abcdefghijklmnopqrstuvwxy [ Wed Mar 21, 2007 10:38 pm ] |
Post subject: | RE:read values from url www.l.com/3@4.png |
unless you only had one folder that the server processed .png files as php scripts... in which case it is fine... and i've seen this done in multiple types of forums using the image tag... Maybe it is for that reason that it has to end in .png and which is also why it is custom (and stupid) to use the forum www.myhost.com/sigs/4@2@3.png. But I don't understand how I can title the php script that actually resides in the .png script to work with that syntax. As in, what is www.myhost.com/sigs4@2.png actually called... |
Author: | abcdefghijklmnopqrstuvwxy [ Wed Mar 21, 2007 11:05 pm ] | ||
Post subject: | RE:read values from url www.l.com/3@4.png | ||
No matter what I do this script keeps giving me "this file can't be displayed because there is an error in it" every time i try to view it.
That's not the whole thing, but the bug resides in that code. I'm guessing there is no such thing as a $_REQUEST array if you don't embed the php in html? |
Author: | abcdefghijklmnopqrstuvwxy [ Wed Mar 21, 2007 11:09 pm ] |
Post subject: | RE:read values from url www.l.com/3@4.png |
I know trying to understand me must be hell so just take a look at my signature.. that is what i'm trying to do. I think it has to end in .png but I don't know how to extract that values, nor do i know what to actually name the fake .png file (that is actually a php script) EDIT: Disregard my last post... _REQUEST does exist i just tested it. |
Author: | octopi [ Wed Mar 21, 2007 11:17 pm ] | ||
Post subject: | Re: read values from url www.l.com/3@4.png | ||
You probally want to do something like this make a file named something like show_image.php now you'll have a variable named like image_file $image_file = $_REQUEST['image_file']; now when you goto show_image.php?image_file=flower.png the filename 'flower.png' will be in the variable $image_file, so now you want to output it to the browser. The reason your getting errors is probally because you don't output anything to the browser.
that should work, provided the file exists, also note that it is not advisable to just grab and retreive files off your server....can potentially used to steal your data. (access any file on your server) |
Author: | octopi [ Wed Mar 21, 2007 11:21 pm ] |
Post subject: | Re: read values from url www.l.com/3@4.png |
I looked at your signature, it looks like you want to overlay text onto the image, you'll need to look up the GD image functions, they provide means to place text on images. http://ca3.php.net/manual/en/function.imagettftext.php also look at the stuff on the left. (other functions you can use) |
Author: | abcdefghijklmnopqrstuvwxy [ Wed Mar 21, 2007 11:37 pm ] |
Post subject: | RE:read values from url www.l.com/3@4.png |
Thanks, yeah I already know how to overlay text onto the sig with GD I just don't know how to pass in values to aid in the text i'm overlaying onto the image |
Author: | abcdefghijklmnopqrstuvwxy [ Thu Mar 22, 2007 2:33 am ] |
Post subject: | RE:read values from url www.l.com/3@4.png |
Alright, I've done a lot of fiddling nothing you've suggested works for the forums. It seems the ? in the query is parsed by the forum and then not displayed. It has to end in .png and include no "?"s. If you click my signature and choose view image you will see how skwizz.com managed to accomplish this. IF ANYONE HAS ANY IDEA HOW TO ACCOMPLISH WHAT SKWIZZ HAS I'D MARRY YOU OR THANK YOU FOREVER! I've spent hours trying to figure it out... |
Author: | md [ Thu Mar 22, 2007 7:26 am ] |
Post subject: | RE:read values from url www.l.com/3@4.png |
the URL requested is in one of the $_SERVER vars iirc. you can always take and parse that. |
Author: | octopi [ Thu Mar 22, 2007 8:21 am ] |
Post subject: | Re: read values from url www.l.com/3@4.png |
You need to use mod_rewrite to convert that wild url you want to use, into one your web server will understand. Thats about all I can say. http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html Theres stuff on the internet, but your gonna have to find/figure this one out yourself. |
Author: | Amailer [ Thu Mar 22, 2007 1:04 pm ] |
Post subject: | RE:read values from url www.l.com/3@4.png |
I think you have to marry Octopi now And thank lol Thats the way I would have done it, thats the only way I know how to do it :/ (unless, you check the acess logs hmmm) |
Author: | abcdefghijklmnopqrstuvwxy [ Thu Mar 22, 2007 3:28 pm ] |
Post subject: | RE:read values from url www.l.com/3@4.png |
Thanks octopi i guess i'll look into it. After searching on the net endlessly and turning up nothing, I got a bright idea which works and is fairly simple. Basically I added a directive to send any 404s to a php script. That php script parses it and if it meets the criteria it'll display the signature. In essence it allows me to have: www.host.com/name@45@32@87.png and actually have an image display. Since I figured out a way first I don't have to marry anyone, however! |
Author: | md [ Thu Mar 22, 2007 5:32 pm ] |
Post subject: | Re: read values from url www.l.com/3@4.png |
octopi @ 2007-03-22, 8:21 am wrote: You need to use mod_rewrite to convert that wild url you want to use, into one your web server will understand.
Thats about all I can say. http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html Theres stuff on the internet, but your gonna have to find/figure this one out yourself. mod_rewrite is an apache mod. Many people now use better web servers instead of apache, like lighttpd. Saying you need to use mod_rewrite is therefor completely false, as it's not even an option with some servers (though they offer similar functionality). |
Author: | abcdefghijklmnopqrstuvwxy [ Fri Mar 23, 2007 1:10 am ] |
Post subject: | RE:read values from url www.l.com/3@4.png |
Also didn't I prove I didn't NEED to use mod_rewrite? |
Author: | md [ Fri Mar 23, 2007 2:06 pm ] |
Post subject: | RE:read values from url www.l.com/3@4.png |
Look at $_SERVER! It contains a whole lot of very useful info, like hte name of the page requested. Also, many forums strip out any parameters passed to supposed images as a security feature. Compsci.ca additionally filters out .php as it's usually not an image, and using img tags pointing at php scripts with parameters can be a nifty way of causing trouble. |
Author: | abcdefghijklmnopqrstuvwxy [ Fri Mar 23, 2007 2:53 pm ] |
Post subject: | RE:read values from url www.l.com/3@4.png |
Quote: Look at $_SERVER! It contains a whole lot of very useful info, like hte name of the page requested. huh?? |
Author: | rdrake [ Fri Mar 23, 2007 3:58 pm ] |
Post subject: | Re: RE:read values from url www.l.com/3@4.png |
abcdefghijklmnopqrstuvwxy @ Fri Mar 23, 2007 2:53 pm wrote: Quote: Look at $_SERVER! It contains a whole lot of very useful info, like hte name of the page requested. huh?? |
Author: | octopi [ Fri Mar 23, 2007 4:35 pm ] |
Post subject: | Re: read values from url www.l.com/3@4.png |
The OP already said he figured it all out. Quote: Basically I added a directive to send any 404s to a php script. That php script parses it and if it meets the criteria it'll display the signature. ...
Since I figured out a way first I don't have to marry anyone, however! |
Author: | abcdefghijklmnopqrstuvwxy [ Fri Mar 23, 2007 4:59 pm ] |
Post subject: | RE:read values from url www.l.com/3@4.png |
Exactly, but thanks anyway md... |
Author: | ideas101 [ Thu Jan 14, 2010 2:41 am ] |
Post subject: | Re: read values from url www.l.com/3@4.png |
Great post!!! looking forward on sharing my expertise and learning new ideas here at the same time..i'll see you around guys...Make it a GREAT DAY!!! |