![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Web Design & Programming Discussion of web design, and server-side & client-side scripting |
![]() |
|
|
Thread Tools |
|
|
#1 (permalink) |
|
Registered User
|
PHP Problem
So what i have is a script that reads a .txt file and randomly chooses a line and displays the msg on my website. (a random quote generator)
This works fine the script until i try and do something else. in the .txt file i have done this Code:
<img src="/pictures/1.jpg" width="549" height="327" /> <?php include("rater.php"); ?>
So im not sure if the random quote script is doing something so that the php code wont be parsed. Here it is: Code:
<?php
// Name of your quote file
$quote_file = "pictures/pic.txt";
// Open the quote file
$fp = fopen($quote_file, "r");
// Read the contents and tokenize the file to individual quotes
$quotes = fread($fp, filesize($quote_file));
$array = explode("\n",$quotes);
fclose($fp);
// Find a random quote
srand((double)microtime()*1000000);
$array_index = (rand(1, sizeof($array)) - 1);
// Show the random quote
echo $array[$array_index];
?>
|
|
|
|
|
|
#2 (permalink) |
|
Design Team
|
Instead of using a php includes function, try copy and pasting the content in the php file directly into the text file.
__________________
![]() Nvu || Notepad++ || Apache || PHP || Keep TSF Alive "The great thing about a computer notebook is that no matter how much you stuff into it, it doesn't get bigger or heavier." |
|
|
|
|
|
#4 (permalink) |
|
Design Team
|
Have you tried adding the image to the php file and removing it from the text file?
__________________
![]() Nvu || Notepad++ || Apache || PHP || Keep TSF Alive "The great thing about a computer notebook is that no matter how much you stuff into it, it doesn't get bigger or heavier." |
|
|
|
![]() |
| Thread Tools | |
|
|