I need some idea how to random pic+txt...

Started on the old forum in July 2010 · view the original in the archive · old links redirect here

1 reply · 492 views · started 16 years ago · 1 min read

2 participants
metulj Super moderator Principal · 1,726 posts #1

let's say i got pics marked from 1 to 50 and i also hav txt files marked from 1 to 50

how would i display randomly on each refresh pic+txt matching the number of both files ? (i know how to display random things... but how to match number of both files?)

like.. if is random pic 1.jpg then at same time i need to display 1.txt... this might be easy to code but right now im really without idea lol

btw... i dont need this for lava 😌 just general code or at least tip

It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt. ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ ! ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.

キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

something else Fellow · 2,296 posts #2
<?php
$rand = rand(1,50);
?>
<img src="images/<?=$rand?>.png" alt=""/><br/>
<?
$tx = fopen("txts/$rand.txt", 'r');
$dat = fread($tx,  filesize("txts/$rand.txt"));
fclose($tx);
echo $dat;
?>

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close