# Help me please?

**URL:** <https://forum.kirupa.com/t/help-me-please/186496>\
**Category:** random\
**Created:** [April 21, 2006, 6:42pm UTC](https://forum.kirupa.com/t/help-me-please/186496 "2006-04-21T18:42:01Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phenex](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/phenex/32/686_2.png) [@Phenex](https://forum.kirupa.com/u/Phenex)\
**Post date:** [April 21, 2006, 6:42pm UTC](https://forum.kirupa.com/t/help-me-please/186496/1 "2006-04-21T18:42:01Z")

</div>

☹

I saw this code by Kirupa for loading random images. So I thought of having random images in my siggy. So I went ahead and made me some siggies with my fav artists in them. And then I upload the siggy images to my server. And then I destroy the world thrice over.

And then I go to the Edit Signature page and paste the code in there with the absolute paths to my images.

Doesn’t work.

Help please. ☹ ☹ ☹

---

<div class="post-metadata">

**Author:** ![upuaut](https://avatars.discourse-cdn.com/v4/letter/u/9fc348/32.png) [@upuaut](https://forum.kirupa.com/u/upuaut)\
**Post date:** [April 21, 2006, 7:58pm UTC](https://forum.kirupa.com/t/help-me-please/186496/2 "2006-04-21T19:58:42Z")

</div>

Please reference a link to kirupa’s code. We don’t have ESP, and alas I haven’t memorized K-man’s site. 🙂

---

<div class="post-metadata">

**Author:** ![Phenex](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/phenex/32/686_2.png) [@Phenex](https://forum.kirupa.com/u/Phenex)\
**Post date:** [April 21, 2006, 8:06pm UTC](https://forum.kirupa.com/t/help-me-please/186496/3 "2006-04-21T20:06:08Z")

</div>

```auto

<?php 
$file_array = array
('http://www.1am-media.com/Sigs/StaindSig01.jpg', 
'http://www.1am-media.com/Sigs/SlipKnoTSig01.jpg', 
'http://www.1am-media.com/Sigs/MansonSig01.jpg', 
'http://www.1am-media.com/Sigs/SeetherSig01.jpg'); 
$total = count($file_array); 
$random = (mt_rand()%$total); 
$file = "$file_array[$random]"; 
print("<img src=$file></a>"); 
?> 

```

This is the code. How do I make it work in my sig?

---

<div class="post-metadata">

**Author:** ![upuaut](https://avatars.discourse-cdn.com/v4/letter/u/9fc348/32.png) [@upuaut](https://forum.kirupa.com/u/upuaut)\
**Post date:** [April 21, 2006, 8:08pm UTC](https://forum.kirupa.com/t/help-me-please/186496/4 "2006-04-21T20:08:06Z")

</div>

I don’t know… but I’ll be sure to point some people to this thread who might.

---

<div class="post-metadata">

**Author:** ![Phenex](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/phenex/32/686_2.png) [@Phenex](https://forum.kirupa.com/u/Phenex)\
**Post date:** [April 21, 2006, 8:09pm UTC](https://forum.kirupa.com/t/help-me-please/186496/5 "2006-04-21T20:09:19Z")

</div>

Thank you 🙂

---

<div class="post-metadata">

**Author:** ![MTsoul](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@MTsoul](https://forum.kirupa.com/u/MTsoul)\
**Post date:** [April 21, 2006, 8:23pm UTC](https://forum.kirupa.com/t/help-me-please/186496/6 "2006-04-21T20:23:59Z")

</div>

You’d have to embed a img, that’s actually a php file that selects which image to output.

e.g. use [img] [http://your-url.com/image.php](http://your-url.com/image.php) [/url]

And for image.php

```auto
<? 
$file_array = array
('http://www.1am-media.com/Sigs/StaindSig01.jpg', 
'http://www.1am-media.com/Sigs/SlipKnoTSig01.jpg', 
'http://www.1am-media.com/Sigs/MansonSig01.jpg', 
'http://www.1am-media.com/Sigs/SeetherSig01.jpg'); 
$total = count($file_array); 
$random = (mt_rand()%$total); 
$file = "$file_array[$random]"; 

$file_pointer = fopen($file);
while(($read = fread($file_pointer)) != EOF) {
echo $read;
}
?> 

```

Something like that, although I’m not sure about all those file functions and parameters.

---

<div class="post-metadata">

**Author:** ![Phenex](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/phenex/32/686_2.png) [@Phenex](https://forum.kirupa.com/u/Phenex)\
**Post date:** [April 21, 2006, 8:32pm UTC](https://forum.kirupa.com/t/help-me-please/186496/7 "2006-04-21T20:32:41Z")

</div>

Thanks a lot… Lemme try that!

---

<div class="post-metadata">

**Author:** ![Phenex](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/phenex/32/686_2.png) [@Phenex](https://forum.kirupa.com/u/Phenex)\
**Post date:** [April 21, 2006, 9:14pm UTC](https://forum.kirupa.com/t/help-me-please/186496/8 "2006-04-21T21:14:13Z")

</div>

NOW it shows that ugly cross thingie…

What you posted in the code quotes, I copied exactly that and saved it as a .php file… Anything else I need to do?

---

<div class="post-metadata">

**Author:** ![MTsoul](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@MTsoul](https://forum.kirupa.com/u/MTsoul)\
**Post date:** [April 21, 2006, 9:16pm UTC](https://forum.kirupa.com/t/help-me-please/186496/9 "2006-04-21T21:16:55Z")

</div>

I said the functions aren’t used correctly. On [php.net](http://php.net), look up fopen and fread and write correct code.

---

<div class="post-metadata">

**Author:** ![Phenex](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/phenex/32/686_2.png) [@Phenex](https://forum.kirupa.com/u/Phenex)\
**Post date:** [April 21, 2006, 9:19pm UTC](https://forum.kirupa.com/t/help-me-please/186496/10 "2006-04-21T21:19:21Z")

</div>

OK… Will do :thumb:

---

<div class="post-metadata">

**Author:** ![Phenex](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/phenex/32/686_2.png) [@Phenex](https://forum.kirupa.com/u/Phenex)\
**Post date:** [April 21, 2006, 9:42pm UTC](https://forum.kirupa.com/t/help-me-please/186496/11 "2006-04-21T21:42:19Z")

</div>

Sorry but none of your codes worked… Thanks a million for the help though! :thumb2:

harish wrote the code for me on MSN… And it worked right away! Way ta go buddy!

```auto

<?
header('Content-type: image/jpg');
$list = "http://domain.com/image.jpg,http://www.domain.com/image2.jpg";
$array = explode(",", $list);
$rand = rand(0, sizeof($array)-1);
$image = file_get_contents($array[$rand]);
print $image;
?>

```

Thanks .harish! :thumb:

---

<div class="post-metadata">

**Author:** ![hl1](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/hl1/32/849_2.png) [@hl1](https://forum.kirupa.com/u/hl1)\
**Post date:** [April 21, 2006, 9:50pm UTC](https://forum.kirupa.com/t/help-me-please/186496/12 "2006-04-21T21:50:50Z")

</div>

The main reasons your original code wasn’t working was because first off, I don’t understand how a random number divided by the total number of entries in your array returns a remainder of a random number between 0 and the size of your array -1. The second reason it wasn’t working is the header was of a regular HTML file. You printed out an img tag. You were trying to have your footer be an html site 😛

Second code is as mentioned, incorrect parameters for functions.

edit:/ Kril explained the random thing 😛 My bad, didn’t realize a remainder must be less than the number you’re dividing by 😛 Woops!

---

<div class="post-metadata">

**Author:** ![Phenex](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/phenex/32/686_2.png) [@Phenex](https://forum.kirupa.com/u/Phenex)\
**Post date:** [April 21, 2006, 9:54pm UTC](https://forum.kirupa.com/t/help-me-please/186496/13 "2006-04-21T21:54:01Z")

</div>

Dude! I dunno a crap about PHP! And I guess I could have relied on Kirupa’s code at least… But my beliefs are now gone… 😛

---

<div class="post-metadata">

**Author:** ![hl1](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/hl1/32/849_2.png) [@hl1](https://forum.kirupa.com/u/hl1)\
**Post date:** [April 21, 2006, 9:55pm UTC](https://forum.kirupa.com/t/help-me-please/186496/14 "2006-04-21T21:55:08Z")

</div>

Give me a link to the code.

---

<div class="post-metadata">

**Author:** ![Phenex](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/phenex/32/686_2.png) [@Phenex](https://forum.kirupa.com/u/Phenex)\
**Post date:** [April 21, 2006, 9:56pm UTC](https://forum.kirupa.com/t/help-me-please/186496/15 "2006-04-21T21:56:16Z")

</div>

It’s the same code you commented on in your previous post Mr. Crpyto! 😛 :lol:

---

<div class="post-metadata">

**Author:** ![hl1](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/hl1/32/849_2.png) [@hl1](https://forum.kirupa.com/u/hl1)\
**Post date:** [April 21, 2006, 9:58pm UTC](https://forum.kirupa.com/t/help-me-please/186496/16 "2006-04-21T21:58:12Z")

</div>

> [@thelonephoenix](#):
>
> It’s the same code you commented on in your previous post Mr. Crpyto! 😛 :lol:

Yeah, but give me a link to the thread to prove you stupid in some way 😉 😛

---

<div class="post-metadata">

**Author:** ![Phenex](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/phenex/32/686_2.png) [@Phenex](https://forum.kirupa.com/u/Phenex)\
**Post date:** [April 21, 2006, 10:49pm UTC](https://forum.kirupa.com/t/help-me-please/186496/17 "2006-04-21T22:49:29Z")

</div>

Hush! Don’t say that!

Kirupa will be offended! :lol:

---

<div class="post-metadata">

**Author:** ![hl1](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/hl1/32/849_2.png) [@hl1](https://forum.kirupa.com/u/hl1)\
**Post date:** [April 22, 2006, 2:18am UTC](https://forum.kirupa.com/t/help-me-please/186496/18 "2006-04-22T02:18:25Z")

</div>

> [@thelonephoenix](#):
>
> Hush! Don’t say that!
> 
> Kirupa will be offended! :lol:

You probably misinterpreted Kirupa’s post. Artificial intelligence v.Kirupa doesn’t make mistakes! Smart butt. 🙂

---

<div class="post-metadata">

**Author:** ![footsie](https://avatars.discourse-cdn.com/v4/letter/f/7c8e57/32.png) [@footsie](https://forum.kirupa.com/u/footsie)\
**Post date:** [April 22, 2006, 5:01am UTC](https://forum.kirupa.com/t/help-me-please/186496/19 "2006-04-22T05:01:35Z")

</div>

> [@.harish](#):
>
> You probably misinterpreted Kirupa’s post. Artificial intelligence v.Kirupa doesn’t make mistakes! Smart butt. 🙂

BUAHAHAHAAHA I hereby announce that thelonephoenix has been officially PWND. Case closed.  
[whisper] hehe am getting back at ya for the hi5 thread 😛 [/whisper]

---

<div class="post-metadata">

**Author:** ![Phenex](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/phenex/32/686_2.png) [@Phenex](https://forum.kirupa.com/u/Phenex)\
**Post date:** [April 22, 2006, 8:09am UTC](https://forum.kirupa.com/t/help-me-please/186496/20 "2006-04-22T08:09:55Z")

</div>

No I haven’t been PWND, you ever-PWND-alien-of-all-BUHAHAness!

harish and I were talkin on MSN when he decided to take cheap shots at me on the site just for funny fun.

So by misinterpreting the vibe here, you have PWND yourself once again! :lol:

[Next page](https://forum.kirupa.com/t/help-me-please/186496.md?page=2)
