Thread: Random Images
View Single Post
  #2  
Old 10-25-2011, 01:02 PM
mapleblade mapleblade is offline
Epicness sausage
 
Join Date: May 2009
Posts: 180
Gender: Male
Credits: 29,633
mapleblade
Default

you can try this

PHP Code:

<?php

$treat 
secure($_GET['treat']);

if(!empty(
$_GET['treat'])){

$success 0;

if(
$treat == 0){

// query for adopt?
$success 1;
}
elseif(
$treat == 1){

// query for adopt?
$success 1;
}
elseif(
$treat == 2){

// query for adopt?
$success 1;
}
elseif(
$treat == 3){

// query for adopt?
$success 1;
}
elseif(
$treat == 4){

// query for adopt?
$success 1;
}
elseif(
$treat == 5){

// query for adopt?

$success 1;
}

if(
$success == 1){
echo 
"You have successfully collected this treat!";

}
}else{

$show rand(0,100);

$random rand(0,5);

// 1 on 100 chance to show an image

if($show == 1){

//random image, modify the $random etc, and add more if ya want
if($random == 0){

$image "http://image.com/lol.png";
$link "http://lol.com/adopt.php?id=bl1a";
}elseif(
$random == 1){

$image "http://image.com/lol1.png";
$link "http://lol.com/adopt.php?id=bla";
}
elseif(
$random == 2){

$image "http://image.com/lol1.png";
$link "http://lol.com/adopt.php?id=bla";
}
elseif(
$random == 3){

$image "http://image.com/lol1.png";
$link "http://lol.com/adopt.php?id=bla";
}
elseif(
$random == 4){

$image "http://image.com/lol1.png";
$link "http://lol.com/adopt.php?id=bla";
}
elseif(
$random == 5){

$image "http://image.com/lol1.png";
$link "http://lol.com/adopt.php?id=bla";
}




// now actually paste it

echo "<a href='".$link."'><img src='".$image."' /></a> <font color='red'>YOU FOUND A TREAT! CLICK HERE TO COLLECT IT!</font>";

}
}

?>
all i worry about is spamming treats, you could put some security on it, so it can only be gotten once a time or something :)
__________________
Need coding help? send me a PM! :)

Last edited by mapleblade; 10-25-2011 at 01:26 PM.
Reply With Quote