|
$_SERVER["QUERY_STRING"] will give you the query string. (I forget if it includes the ? or not.) Picking off everything prior to the first ? (i.e. the URL part) isn't too hard.
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
Interestingly enough, I get all the pieces of the request neatly delimited by ampersands.
mysite.com/a/b/c?d=1&e=2&request=3
Debug Output
Request ($_SERVER["REQUEST_URI"]): "/a/b/c?d=1&e=2&request=3"
Request ($_GET["request"]): "3"
Request ($_SERVER["QUERY_STRING"]): "request=index.php&request=a/b/c&d=1&e=2&request=3"
d="1"
e="2"
mysite.com/a/b/c?d=1&e=2&request=%26+%3F
Debug Output
Request ($_SERVER["REQUEST_URI"]): "/a/b/c?d=1&e=2&request=%26+%3F"
Request ($_GET["request"]): "& ?"
Request ($_SERVER["QUERY_STRING"]): "request=index.php&request=a/b/c&d=1&e=2&request=%26+%3F"
d="1"
e="2"
Although the key-value pairs remain encoded, I guess it's still better to just use explode to get the key-value pairs first and then explode the resulting items to get the keys and values.
My GUID: ca2262a7-0026-4830-a0b3-fe5d66c4eb1d
Now I can Google this value and find all my Code Project posts!
|
|
|
|
|
I did some testing, and it appears that certain values in the query can replace $1 in .htaccess with just 406.shtml or 406_shtml. mysite.com/a/b/c?d=1&e=2&%85 will cause this problem. It looks like I will have to parse the contents of $_SERVER['REQUEST_URI'] within the script if I want to handle all the cases without fail.
My GUID: ca2262a7-0026-4830-a0b3-fe5d66c4eb1d
Now I can Google this value and find all my Code Project posts!
|
|
|
|
|
I have to analyze a system written in php. I am a .NET programmer. I will be emulating the php system. I have been given a tar dump of the directory. After decompression I need to find the starting php script. What should I be looking for? I have many php scripts, but it feels like a haystack. Can someone tell me what the starting needle name should be??
Thanks in advance... Chuck..
|
|
|
|
|
the default page in a directory normally is called index.php
|
|
|
|
|
Luc, Nice article. The problem is not recognising the PHP code or being able to read the code.
The problem is that I have several hundred PHP files. Which one is the first? That starts the app running. From there I and untangle the ball of string I have for years. Where is the beginning?
|
|
|
|
|
Do all PHP programs start with "main.php" or "index.php" or "default.php"?
|
|
|
|
|
No. In a web application, the default file in a folder is index.php, that is what gets served to a client when accessed by a browser.
You can create any filename.php you like and execute it locally by using a command line that fits your PHP platform and refers to the source file.
And there are ways to compile a bunch of PHP files into a single EXE, haven't done that yet.
|
|
|
|
|
|
i want to learn python language in my mobile.. Can u give me information about these..
|
|
|
|
|
|
use pys60
gomobile package,
free development you can download from sourceforce..
enjoye
all the best
http://dhruvdave.com
|
|
|
|
|
anybody has bplustree code in python
|
|
|
|
|
|
Please explain more detailed on the blender part coding. what is expected.
"Take chances, make mistakes. That's how you grow. Pain nourishes your courage. You have to fail in order to practice being brave." - Mary Moore
|
|
|
|
|
Hi there,
Please can someone help me with this issue:
How do I display an image from a database showing the latest added images first (basically showing the last index to the first)
I have the rest of the code what I need is how do I access the files ?
eg:
<?php
<a href="?"><img src="?" alt="" width="50px" height="50px"/></a>
?>
please help where I have put the '?'.
The database is called pagination, the table is called images. There are 3 columns in the table `images`, name_id, name, image.
I want to display it in descending order acording to name_id.
If you could even coment with a link to a tutorial that would help I would appretiate it.
Thanx alot,
Josh
|
|
|
|
|
You will have to create a seperate PHP file that is able to load the image from the database and output it to the browser. You then set the '?' in the sample code you gave to that PHP file.
The PHP script that will actually present the image to the browser will be something similar to this:
<?php
mysql_connect("localhost","username","xxxxxxx");
mysql_select_db("database");
$rs = mysql_query("select image from images order by name_id ASC limit 1");
$row = mysql_fetch_assoc($rs);
$imagebytes = $row['image'];
header("Content-type: image/jpeg");
print $imagebytes;
?>
Note that you have to set the correct content type or the browser won't know what it is receiving. A full tutorial on storing images in a DB can be found at http://phpro.org/tutorials/Storing-Images-in-MySQL-with-PHP.html[^]
|
|
|
|
|
You dont necessarily have to have a seperate PHP page/script serve up the image, you could base64 encode the stream and embed it into your markup as you asked.
Assuming you have a variable, for example $imagestream that equals the image field from your table row access routine, you could do this:
<?php
echo '<a href="?"><img src="data:image/jpg;base64,' . base64_encode($imagestream) . '" alt="?" style="width: 50px; height: 50px;">';
?>
This works well for reasonably small to medium images, but be aware of two things:
The page load time is increased as the image data is encoded in the HTML (actually bloated).
Be sure your mime type is correct for the image.
|
|
|
|
|
hi please help me ;
i have html page and i need export doc with this
|
|
|
|
|
It sound like you want to use php to convert an html page to a microsoft word file (aka *.doc).
Never done that myself, but a *.doc is just a file type and so if you read up on how the file is structured you can write code to do this.
First though, you need to understand the file structure. You can google for this information as there are many people that have asked this same question. Here is one link that I found with a simple google search. http://blogs.technet.com/b/srd/archive/2008/07/18/how-to-parse-doc-file-format.aspx[^]
Good Hunting!
Chris J
www.redash.org
|
|
|
|
|
Adding with you:
The op will have to do two parsing:
1. Compound Document format. This is described well in OpenOffice.
2. how to read data from the stream read from compound file. Its also available in OpenOffice.org
Actually file like excel, doc are written in compound document format. The format specification is open.
I know I am coward since the day I know that fortune favors the brave
|
|
|
|
|
|
|
Hi I am wondering if there is a way to compile the php source code like java programming language, so that user can't see the source code.
Please help me
waiting to hear from you.
|
|
|
|
|
Most PHP platforms allow you to compile and build PHP source into an EXE file. Check the documentation of your PHP platform.
|
|
|
|