To use this website completely, it is necessary to store cookies on your computer.

* Navigator

Expand - Collapse

* Statistic

  • *Total Posts: 16403
  • *Total Topics: 2518
  • *Online Today: 8
  • *Most Online: 292
(12. Nov 2016, 09:37:31)
  • *Users: 0
  • *Guests: 0
  • *Spiders: 1
  • *Total: 1

  • *Yahoo!

Ran Quotes + Submit + PW

Started by Demon Slushy, 15. Dec 2008, 10:33:41

previous topic - next topic

0 Members and 0 Guests are viewing this topic.

Go Down

Demon Slushy

15. Dec 2008, 10:33:41

This is a random quote script for a side block. Displays a random quote with each page refresh.
Bellow the quotes is a button to submit new quotes so you don't have to manually edit the flat file db where the quotes are stored (however you will if you want to remove a quote).  When you click the add quote button a popup window will appear prompting you to add a password which you defined in the addquote.php file. After you add the password you will see a simple form to add your new quote. That's it!


Installation is simple download the attached file and extract it. In side the folder should be three files:

-addquote.php <---You will need to edit this file with a text editor to define your password and change the background color and font colors for the popup window to suit your site.

-senddatshit.php <--- You won't need to edit this unless you want to change the "Thank you, your quote has been added!" message.

-quotes.txt <--- This is where your actual quotes are stored.

Upload those three files to your severs root. (Just the files not the folder!)

Goto your PortaMX block manager and create a new php block and add the following code:

Code Select


$quotetitle="Random Quote";



//No need to change anything below here except your sites url where the addquote.php is located.
if (file_exists($dir."/".$quotefile)) {
  $rand_key=array_rand($quote, 1);
list($qtext, $qauthor) = explode("|", trim($quote[$rand_key]));

  echo '<div>';
  if (isset($qtext) && $qtext!="") { echo '<p>'.$qtext.'</p>'; }
  if (isset($qauthor) && $qauthor!="") { echo '<p style="color:#707070; font: normal 7pt Arial, Helvetica, sans-serif; margin: 5px 0 0 20px; padding: 0;">'.$qauthor.'</p>'; }
  echo '</div><hr />';

echo '<br /><center><form>
<INPUT type="button" value="Add Quote" onClick="'; echo "'http://www.yoursite/addquote.php','mywindow','width=200,height=200')"; echo '">

and you are done :) You can change the directory where your files are stored just make sure you do so in the above block code.

Missed something you will need to also change the

Code Select

<INPUT type="button" value="Add Quote" onClick="'; echo "'http://www.yoursite/addquote.php','mywindow','width=200,height=200')"; echo '">

to your url ;p

[attachment deleted by admin]


22. Feb 2009, 19:08:00
EXCELLENT code.  Just what I was looking for!

01. Apr 2009, 20:58:41
nice one dude!!!

Keep up the good work!! O0
DOn't BeLiEve tHat yOu kNow EverYthiNg!!


20. Dec 2010, 07:47:58
This is a wonderful coding and I am totally using it.  But is there anyway that we can do this with images and links?


19. Aug 2011, 22:16:26

I have just installed this on my site and after submitting a quote i get this message and no quote is visible

QuoteThank You!
Your quote has been added!
Warning: fputs() expects parameter 3 to be long, string given in /MYSITE/senddatshit.php on line 10

any idea what the problem is please, i am using latest version of the portal and the random quote block appears on my site i changed the password and i was able to add a quote but got this message



23. Aug 2011, 13:42:56
Anyone for the above post please


23. Aug 2011, 19:32:56
Seems like a bug in the file .. call the author.
Many are stubborn in relation to the path, a few in relation to the target.


30. Dec 2012, 02:00:57
Quote from: mmarak524 on 20. Dec 2010, 07:47:58
This is a wonderful coding and I am totally using it.  But is there anyway that we can do this with images and links?

Indeed! I'd love to have another input value to link to the location from which the quote came (on my site, a thread) so that people can go and read it in context.

How would one go about this?

Go Up