Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.