php javascript causing blink on clicking any link in site

705

I am using a random quotes script on my site which shows random quotes on every click on any site link. Example: random quote 1 on index, if i click login, it shows random quote 2, 3 or 4 and so on. But the problem is that, If this script is on, Whenever i click on any other page of site, such as login, register etc. page does not load normally but instead it loads with a blink.

Here is the script i am using, with the filename quotes.php in my site.

<?php
$quotes = 'Random Text 01
Random Text 02
Random Text 03
Random Text 04
Random Text 05
Random Text 06';
$split_array = explode("\n", $quotes);
$rand_keys = array_rand($split_array, 1);

header("content-type: application/x-javascript");
echo "<!--\n
document.write('{$split_array[$rand_keys]}');\n
//-->";

?>

And it shows up on overall_header.html These are the edits which i made in html file

<ul >
<!-- IF not S_IS_BOT and S_USER_LOGGED_IN -->
<li><script type="text/javascript" src="quotes.php"></script></li><!-- ELSE --><li >Important Information from the Administrators --</li><li >Thank you for visiting our forum. Please login to enjoy the full features of our site.</li><!-- ENDIF -->
</ul>

Please tell me what bug in this script is causing blink on every page load.

Regards

People are also looking for solutions to the problem: php - my dropdown displays only one first alphabet of the data from the database

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.