Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Mods & Themes (http://www.bvlist.com/forumdisplay.php?f=109)
-   -   Countdown to event (http://www.bvlist.com/showthread.php?t=8922)

Chez 26th February 2013 17:17

Countdown to event
 
First of all the credits go to - hellix - stonebreath - putyn


Put this is you sql database.

PHP Code:

CREATE TABLE `countdow` (
  `
monthtext NOT NULL,
  `
daytext NOT NULL,
  `
yearyear(4NOT NULL,
  `
countdowtext NOT NULL
ENGINE=MyISAM DEFAULT CHARSET=utf8

Now you name this cimage.php and put it in your root

PHP Code:

<?
require_once ("include/bittorrent.php");
dbconn();
$res mysql_query("SELECT month, day, year, countdow FROM countdow") or sqlerr(__FILE____LINE__);
if (
mysql_num_rows($res) == 0)
echo(
"<b>Countdown is empty</b>\n");
else
while (
$arr mysql_fetch_assoc($res))
{
$target mktime(0,0,0,$arr['month'],$arr['day'],$arr['year']);
$diff $target time();

$days = ($diff - ($diff 86400)) / 86400;
$diff $diff - ($days 86400);
$hours = ($diff - ($diff 3600)) / 3600;
$diff $diff - ($hours 3600);
$minutes = ($diff - ($diff 60)) / 60;
$diff $diff - ($minutes 60);
$seconds = ($diff - ($diff 1)) / 1;

header ("Content-type: image/png");
$imgname "pic/countdown.png";
$im = @imagecreatefrompng ($imgname);
$background_color imagecolorallocate ($im000);
$orange imagecolorallocate ($im25512736);
$yellow imagecolorallocate ($im247246201);

imagestring ($im2605$arr['countdow'], $yellow);
imagestring ($im36518"[ $days day(s) ] [ $hours hour(s) ] [ $minutes minute(s) ] [ $seconds second(s) ]"$orange);

imagepng ($im);
imagedestroy ($im);
} {
}
?>

Now this countdown.php also in your root.

PHP Code:

<?php
require_once ("include/bittorrent.php");
dbconn();
loggedinorreturn();
//referer();
if (get_user_class() < UC_SYSOPstderr("Error""Permission denied");

if (
$_SERVER["REQUEST_METHOD"] == "POST")
{
if (
$_POST["delete"])
mysql_query("DELETE FROM countdow");
header("Location: $BASEURL/countdown.php");

if (
$_POST["month"] == "" || $_POST["day"] == "" || $_POST["year"] == "" || $_POST["countdow"] == "")
stderr("Error""Missing form data.");

$month htmlspecialchars($_POST["month"]);
$day htmlspecialchars($_POST["day"]);
$year htmlspecialchars($_POST["year"]);
$countdow htmlspecialchars($_POST["countdow"]);
$sql "INSERT INTO countdow (month, day, year, countdow) VALUES ('$month', '$day', '$year', '$countdow')";
$result mysql_query($sql);
header("Location: $BASEURL/countdown.php");
die;
}
stdhead("Countdown");
$res mysql_query("SELECT month, day, year, countdow FROM countdow") or sqlerr(__FILE____LINE__);
if (
mysql_num_rows($res) == 0)
echo(
"<h1>Add countdown</h1>
<form method=post action=countdown.php>
<table border=1 width=95% cellspacing=0 cellpadding=5>
<tr><td class=rowhead>Month of the countdown</td><td><input type=text name=month size=5></td></tr>
<tr><td class=rowhead>Day of the countdown</td><td><input type=text name=day size=5></td></tr>
<tr><td class=rowhead>Year of the countdown</td><td><input type=text name=year size=10></td></tr>
<tr><td class=rowhead>Countdown to</td><td><input type=text name=countdow size=70></td></tr></select></td></tr><tr><td colspan=2 align=center><input type=submit class='groovybutton' value='Okay' class=btn></td></tr>
</table>
</form>\n"
);
else
{
while (
$arr mysql_fetch_assoc($res))
{
echo(
"<table border=1 cellspacing=0 width=95% cellpadding=5>\n");
echo(
"<tr><td align=left><b>Month</b></td><td align=left><b>Day</b></td><td align=left><b>Year</b></td><td align=left><b>Countdow to</b></td></tr>\n");
echo(
"<tr><td><font color=black>".htmlspecialchars($arr['month'])."</td><td><font color=black>".htmlspecialchars($arr['day'])."</td><td align=left><font color=black>".htmlspecialchars($arr['year'])."</font><td align=left><font color=black>".htmlspecialchars($arr['countdow'])."</font></font></font></td></tr>\n");
}
echo(
"</table><p></p>");
echo(
"<form method=post action=countdown.php><tr><td colspan=2 align=center><input type=submit name='delete' class='groovybutton' value='Delete'></td></tr>");
}
?>
<?php stdfoot
(); ?>

put this where you want it to show

PHP Code:

echo("<img src='cimage.php'>"); 

Finally put this image in your pic folder.

http://i.imgur.com/OHZl3to.png

ratza 4th August 2013 01:48

what picture should we put ?the image you offered isn't there anymore :(


Thx for the mod

Krypto 4th August 2013 02:06

Nothing wrong with the image just Right Click and Save.

I've amended the Image Link and added it to another host as I don't appreciate images Hotlinked from TorrentStrike especially when I operate their servers.

Chez 4th August 2013 14:23

This is the only image that you need to put in PIC folder

http://i.imgur.com/OHZl3to.png

ratza 4th August 2013 14:52

http://www.bvlist.com/data:image/png...AAAElFTkSuQmCCits showing broken image :( and i did all steps.Where i did wrong?

firefly007 4th August 2013 15:08

http://i.imgur.com/OHZl3to.png

ratza 4th August 2013 15:25

yes i saw the image but is not showing in the script.Is showing broken image,bet is all there :)

Krypto 5th August 2013 03:51

1. Did you save the image to your pic folder?
2. Did you name the image as countdown.png ?

ratza 5th August 2013 04:10

yes, even when i don't put any date in mysql is hsowing broken image

fireknight 5th August 2013 05:04

If it is showing a broken image.
It means it cannot find the image, or the image does not exist.

You say you have renamed the image to - countdown.png
You have placed the image in your pic folder, in your root directory.
So the path to the image must be wrong, or just slightly of.

Code:

$imgname = "pic/countdown.png";
Check and see how other images paths are coded.

firefly007 5th August 2013 08:04

Quote:

Originally Posted by ratza (Post 42055)
http://www.bvlist.com/data:image/png...AAAElFTkSuQmCCits showing broken image :( and i did all steps.Where i did wrong?

Check also if its chmod-ed to 0755

assuming that your paths are correct and the image is in the right place, try this.

Eg.

Code:

# chmod 0755 /home/tracker/www/pic/countdown.png

Krypto 5th August 2013 10:36

There are numerous ways of checking the image path, in FireFox are:-

1. Right Click on the broken image and then click on View Image, it will then show you the url of the image.

2. Right Click on the broken image and then click on View Image Info, it will then show you the url of the image.

3. Right Click on the broken image and then click on Copy Image Location and then paste the link into your editor or something.

If you still cannot get the image to show then provide the url to your site also create a test account and post the details so that we can check it out, or PM me the details and I'll have a look.


All times are GMT +2. The time now is 18:38.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.