Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2014-05-14, 12:59 AM   #1
jollyhumper
That's what she said
 
jollyhumper's Avatar
 
Join Date: Feb 2012
Location: Norway
Posts: 2,559
Send a message via ICQ to jollyhumper
Script reading a text-file

Hi

Is there a way for a script to import text/embed-code into an existing html/php page based on dates?

This way I could prepare a bunch of txt-files named by date or something for a while and let the script do the rest? maybe?

I tried to google around, but since there is an answer to anything somewhere I'm probably not searching correctly.

(You know they say that if you have a hobby and make a search for it in google and doesn't get any hit, you're pretty weird :-p)

Jolly

edit: It just struck me that it doesn't need to be dates, it could possibly have a string function import number+1. But that sounds a bit more complicated maybe?
I never been a strong coder outside of html/css unfortunately.
jollyhumper is offline   Reply With Quote
Old 2014-05-14, 10:41 AM   #2
HowlingWulf
Me fail English? That's unpossible!
 
HowlingWulf's Avatar
 
Join Date: Dec 2003
Location: FL
Posts: 1,381
Send a message via ICQ to HowlingWulf
Here you go. Just work off this.

Code:
<?php
$todayfile = date("d-m-y") . ".txt";            // 14-05-14 = 14th of May, 2014
$text = @file_get_contents($todayfile);
echo $text;
?>
__________________
WordPress Porn directory theme => Maddos
Create a Porn Tube => Video Pornster
HowlingWulf is offline   Reply With Quote
Old 2014-05-14, 02:04 PM   #3
jollyhumper
That's what she said
 
jollyhumper's Avatar
 
Join Date: Feb 2012
Location: Norway
Posts: 2,559
Send a message via ICQ to jollyhumper
Rock'n'roll!

Thank you, very appreciated

Jolly

Update: It works perfectly Now you've put me on the track, the small tweaks I need I can figure out myself. Again,

Last edited by jollyhumper; 2014-05-14 at 02:39 PM..
jollyhumper is offline   Reply With Quote
Old 2023-09-14, 08:57 PM   #4
jollyhumper
That's what she said
 
jollyhumper's Avatar
 
Join Date: Feb 2012
Location: Norway
Posts: 2,559
Send a message via ICQ to jollyhumper
Quote:
Originally Posted by HowlingWulf View Post
Here you go. Just work off this.

Code:
<?php
$todayfile = date("d-m-y") . ".txt";            // 14-05-14 = 14th of May, 2014
$text = @file_get_contents($todayfile);
echo $text;
?>
I've messed around with this one, but I can't make it work.
What I want it to do:
Let's say I have 3 files named:
01.txt
02.txt
03.txt

Can I make php pull one of them by random?

J
jollyhumper is offline   Reply With Quote
Old 2023-09-15, 05:54 AM   #5
Greenguy
The Original Greenguy (Est'd 1996) & AVN HOF Member - I Crop Pics For Thumbs In My Sleep
 
Greenguy's Avatar
 
Join Date: Feb 2003
Location: Blasdell, NY (shithole suburb south of Buffalo)
Posts: 41,915
Send a message via ICQ to Greenguy
Quote:
Originally Posted by jollyhumper View Post
I've messed around with this one, but I can't make it work.
What I want it to do:
Let's say I have 3 files named:
01.txt
02.txt
03.txt

Can I make php pull one of them by random?

J
I KNOW THIS!!!

Create a text file with what you want pulled randomly - for example:
https://www.link-o-rama.com/greenguy...nks-header.txt
(simple banner rotator)

Make sure there is no extra empty line or return at the end.

Then put this coding on your page:

Code:
<?php
$file = "/home/greenguy/domains/link-o-rama.com/public_html/greenguy/includes/mlinks-header.txt";
$banners = file($file);
srand((float) microtime() * 1235689);
$selected = array_rand($banners);
$SelBanner = trim($banners[$selected]);
if ($SelBanner=="") {
$SelBanner = trim($banners[0]);
};
echo $SelBanner;
?>
Change /home/greenguy/domains/link-o-rama.com/public_html/greenguy/includes/mlinks-header.txt to the location on your server.

That's running the top banner on here.

(thank you cd34)
__________________

Promote POV Porn Cash By Building & Submitting Galleries to the Porn Luv Network
Greenguy is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:42 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc