Jump to content

[SOLVED] False value query...


TheLoveableMonty

Recommended Posts

Alright, second query of the day.

 

<meta http-equiv="refresh" content="4">

<?php

$location = "curbil.dat";
$file = file_get_contents($location);
list($current, $max) = explode(":", $file);

$info_location = "inf-bin/bil/$current.dat";
$info = file_get_contents($info_location);
list($url, $alt) = explode("||", $info);

print "<A HREF=\"$url\" ALT=\"$alt\"><IMG SRC=\"http://www.tenthousandbillboards.com/img-bin/bil/$current.jpg\" HEIGHT=\"400\" WIDTH=\"600\" BORDER=\"0\"></A>";

$fp = fopen($location, "w");
if ($current == $max) {
    $current = "1:$max";
} elseif ($current > $max) {
    $current = "1:$max";
} else {
    $current = ($current+1) . ":$max";
}

fwrite($fp, $current);
fclose($fp);

?>

 

This is the most basic of basic queries.

 

When $info is false, it prints an error message. What I'd like to do is if $info is false, print an alternative, pre-defined banner and link so there's no broken image.

 

I don't know how to do it though.

 

http://www.tenthousandbillboards.com/demo.php is the script in action. Please excuse the pink image that may load; I asked a friend to whip up a test image while I was at work and he chose to humiliate his brother. Thus, I've just kept using it.

 

The script itself works - Image 7 is the only one I've uploaded files for. It's in the event that something's wrong, I'd like to have a replacement and log the error. I've got the log part sorted though.

Link to comment
https://forums.phpfreaks.com/topic/142865-solved-false-value-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.