|
Posted by Jerry Stuckle on 12/26/34 11:46
Jason wrote:
> This is a new one for me, and I couldn't find anything about it online.
> So after wasting 4 hours of rewrites, I'm afraid that I have to beg the
> gurus for help!
>
> This is a relatively simple script. It takes a variable from the
> header, and compares it to a tab-delimited flat-text database. Once it
> finds a match, it uses the other info in the database to show a dynamic
> page.
>
> For instance, go to:
>
> http://www.wilkessmartstart.com/providers/
>
> These are all in the order by which they are in the database. Scroll
> down to "Diane Benesh Day Care Home," and click on the title to be
> taken to a view.php page. This is where you'll see the error, but it
> only happens with this one; all of the other names seem OK.
>
> Has anyone seen this one before, or have any idea what it means?
>
> TIA,
>
> Jason
>
>
> The only real PHP code in the script is as follows:
>
> // if there's no variable, send them to the intro page
> if (!$_GET['id']) header("Location: index.php?error=true");
>
> else {
> $found = FALSE;
>
> // if a single quote was in the name, PHP placed a \ in front
> //of it by default
> $_GET['id'] = str_replace("\'", "'", $_GET['id']);
> }
>
> // get database info
> $providers = FILE("$basepath/providers.xls");
>
> foreach ($providers as $key) {
>
> // get rid of the \n at the end
> $key = rtrim($key);
>
> // $more_junk is here for your benefit; there are really about
> // 20 variables in the script
> //
> // I actually don't use /t in the script, I use a real tab. I wasn't
> // sure if that would show up in the NG, though
> list ($facility, $more_junk) = explode("/t", $key);
>
> // if it's found, change the boolean and stop looking
> if ($_GET['id'] === $facility) {
> $found = TRUE;
> break;
> }
> }
>
>
> if ($found) {
> // print HTML code
> }
>
> else header("Location: index.php?error=true");
>
Well, one of your problem is the URL
http://www.wiklessmartstart.com/providers/view.php?id=Diane Benesh
is invalid. You can't have spaces in a URL. It should be
http://www.wiklessmartstart.com/providers/view.php?id=Diane%20Benesh
Browsers will try to correct for this, but it may be a problem when sending it
back into the server. Check out htmlentities() for how to convert the invalid
space to %20. It may not solve your problem, but it will fix another potential
problem you can have with some browsers.
And as for "bensch" having a special meaning in PHP (another post), no, it
doesn't. Even if it did, you wouldn't be using it in PHP here. It's strictly a
string. You could use any PHP reserved word here, also - or anything else, for
that matter.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|