random quotes

preside2

New Member
Messages
29
Reaction score
1
Points
3
I'm trying to use the random quotes script free from scriptarchive.org, but it's not working. Are server side includes disabled? Reason I asked is several of the text counters I also tried used server side includes, and each one failed, while the only one I got to work used a java script call. I've used this same script on a previous hosting site with no trouble, so stumped as to what's happening.
 

Skizzerz

Contributors
Staff member
Contributors
Messages
2,929
Reaction score
118
Points
63
You will need to explicitly enable SSI via .htaccess. Do note that SSI is not officially supported, so if you run into an issue with it, do not expect to receive any staff help, and it is subject to be disabled/removed without notice. I recommend writing your script in PHP instead.
 

usama_rasab27

Member
Messages
208
Reaction score
15
Points
18
Hi, I can't seem to download the file, but you could use this script instead:
Code:
<?php
//Chooses a random number
$num = Rand (1,7);
//Based on the random number, gives a quote
switch ($num)
{
case 1:
echo "X10HOSTING HELPPPPPPP!";
break;
case 2:
echo "An apple a day keeps the doctor away";
break;
case 3:
echo "LLLLOOOOOOOOLLLLLLLLLL";
break;
case 4:
echo "Only  HELPPPPPIIINNNNGGGG!";
break;
case 5:
echo "Tomorrow is another day";
break;
case 6:
echo "PHP is cool!";
break;
case 7:
echo "You're Awesome!  NOT! HAHAHAHA!";
}

/*
Add another quote by adding
after the last echo and before the '}'.
Also, remember to change the case number to the number after the last case (quote).
case 8:
echo "YOUR QUOTE!";
break;
Also, remember to change
$num = Rand(1,7);
Change the second number to the amount of cases.
*/
?>
 

preside2

New Member
Messages
29
Reaction score
1
Points
3
How do I enable SSI? Thanks.
You will need to explicitly enable SSI via .htaccess. Do note that SSI is not officially supported, so if you run into an issue with it, do not expect to receive any staff help, and it is subject to be disabled/removed without notice. I recommend writing your script in PHP instead.
 

Skizzerz

Contributors
Staff member
Contributors
Messages
2,929
Reaction score
118
Points
63
There are various guides on the internet, alternatively another member will come along and assist. I cannot give you any further assistance on this or else it may be misconstrued as x10Hosting officially supporting it.
 

preside2

New Member
Messages
29
Reaction score
1
Points
3
Ok, thanks for the tip. I'll keep looking for a php script I can switch to, hopefully this will get me by until I find one that works for me. Thanks again.
 

usama_rasab27

Member
Messages
208
Reaction score
15
Points
18
You could just use a simple alternative, here's the code:

Code:
<?php
//Chooses a random number
$num = Rand (1,7);
//Based on the random number, gives a quote
switch ($num)
{
case 1:
echo "X10HOSTING HELPPPPPPP!";
break;
case 2:
echo "An apple a day keeps the doctor away";
break;
case 3:
echo "LLLLOOOOOOOOLLLLLLLLLL";
break;
case 4:
echo "Only  HELPPPPPIIINNNNGGGG!";
break;
case 5:
echo "Tomorrow is another day";
break;
case 6:
echo "PHP is cool!";
break;
case 7:
echo "You're Awesome!  NOT! HAHAHAHA!";
}

/*
Add another quote by adding
after the last echo and before the '}'.
Also, remember to change the case number to the number after the last case (quote).
case 8:
echo "YOUR QUOTE!";
break;
Also, remember to change
$num = Rand(1,7);
Change the second number to the amount of cases.
*/
?>

Thank You
 

preside2

New Member
Messages
29
Reaction score
1
Points
3
Thanks, but I found a php quotes script that allows me not to have to edit the script itself, if I want to add quotes in the future. It seems to be working plenty well, and I've already removed the ssi for my cgi script that did basically the same thing. I'll give it a few more days of testing, and if everything continues to progress smoothly, I'll completely turn off the ssi, since I won't apparently need it now.
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
PHP:
<?php

$quotes = array(
     "X10HOSTING HELPPPPPPP!",
     "An apple a day keeps the doctor away",
     "LLLLOOOOOOOOLLLLLLLLLL",
     "Only  HELPPPPPIIINNNNGGGG!" ,
     "Tomorrow is another day", 
     "PHP is cool!",
     "You're Awesome!  NOT! HAHAHAHA!" );

$number_of_entries = count( $quotes );

$random_entry_number = rand( 0, $number_of_entries - 1);

echo $quotes[ $random_entry_number ]  ;

?>

would be the way to code it in one file in PHP. You just edit the array list to add/delete/modify your quotes. No long case statement.

Another way would be to have it read in a separate file with the quotes.
 
Top