It is currently Fri Mar 29, 2024 12:50 am


The forum is READ ONLY. Please direct any future discussions to our Facebook page


 Page 1 of 1 [ 2 posts ] 
Author Message
 Post subject: joke of the day
PostPosted: Wed Jun 06, 2007 7:32 am 
Trial
Trial

Joined: Sun Mar 04, 2007 5:02 am
Posts: 7
Hi !
I invent a script of joke of the day. Every Day, a phrase choose by chance, is show in FNN.

You can use this script to do joke of the day or show every day easy way :)

Before all Make a backup :!:

Let's go :D
In root game, create a new file : "joke.php" and paste this code in this file :
<?php
include ("config/config.php");
include ("languages/$langdir/lang_translate_news.inc");


if (isset($_GET['admin_password']))
{
$admin_password = $_GET['admin_password'];
}
else
{
$admin_password = "";
}

if ($admin_password == $adminpass)
{

srand();
$rand = rand(0,$total_joke);

$nbjoke = "joke".$rand;

if (isset($nbjoke))
{

$stamp = date("Y-m-d H:i:s");

$debug_query = $db->Execute("INSERT INTO {$db_prefix}news (data, total, user_id, date, news_type) VALUES ('$rand', '1', '1', '$stamp', 'joke')");
db_op_result($debug_query,__LINE__,__FILE__);
}


echo "Update Joke : OK";
}
else
{

echo "Bad Password";
}
?>




Then Open globals/translate_news.inc

After this :
        case "targetdies":
         $playerdatas = explode("|", $entry['data']);
            $data = str_replace("[name]", $playerdatas[0], $l_news_targetdies_short);
            $retvalue['headline']  = str_replace("[owner]", $playerdatas[1], $data);
            $data = str_replace("[name]", $playerdatas[0], $l_news_targetdies);
            $retvalue['newstext'] = str_replace("[owner]", $playerdatas[1], $data);
          break;


Add :
       
case "joke":
$retvalue['headline']  = $jokeh;
$retvalue['newstext'] = ${"joke".$entry['data']};

break;


Save file then Open globals/translate_news_headline.inc

After this :
        case "targetdies":
         $playerdatas = explode("|", $entry['data']);
            $data = str_replace("[name]", $playerdatas[0], $l_news_targetdies_short);
            $retvalue = str_replace("[owner]", $playerdatas[1], $data);
        break; 


Add :
        case "joke":

   $retvalue = ${"joke".$entry['data']};

        break; 




Now you must repeat this in all languages repertory

Open languages/.../lang_translate_news.inc
Add before
?>


Add :

// joke of the day

$total_joke = 3; //it is the total number of jokes
$jokeh = "joke of the day";
$joke1 = "Text of the joke1";
$joke2 = "Text of the joke2";
$joke3 = "Text of the joke3";

There can have as many jokes as you want :lol: But don't forget to complet $total_joke

Now The Task Cron :wink:
* */24 * * * /usr/bin/lynx --dump http://mygameaatrade/joke.php?admin_password=writeyourpass> /dev/null


You may need to alter the URL to point to your exact domain name and path. You will also need to change the password to your admin password


Finish :D
If you have a problem ask me :)
+


Last edited by Artis on Sun Dec 09, 2007 12:35 pm, edited 1 time in total.


_________________
Aatrade France :
Offline
 Profile  
 
 Post subject: Re: joke of the day
PostPosted: Thu Aug 23, 2007 12:32 am 
Forum Roamer
Forum Roamer

Joined: Sat Dec 23, 2006 1:34 pm
Posts: 85
cant u just add some thing to the cron file... ill look in to this... Btw im back :)


Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 2 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

cron