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:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* 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
Go Back   Tech Support Forum > Design Forum > Web Design & Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read

Web Design & Programming Discussion of web design, and server-side & client-side scripting

Reply
 
Thread Tools
Old 10-21-2006, 08:38 PM   #1 (permalink)
Registered User
 
Join Date: Jun 2006
Location: Queensland, Australia
Posts: 23
OS: Windows Vista Ultimate

My System

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"); ?>
Now what it does is this it displays the picture like it should but the PHP code it does not parse. when i click view source i can see the PHP code that i have written.

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]; 
?>
So yeah thanks for any help here guys much appreciated
Extraction is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 10-21-2006, 08:59 PM   #2 (permalink)
Design Team
 
DJ-Zep's Avatar
 
Join Date: Mar 2006
Location: Philadelphia
Posts: 1,496
OS: Windows Server 2003

My System

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."
DJ-Zep is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 10-21-2006, 11:46 PM   #3 (permalink)
Registered User
 
Join Date: Jun 2006
Location: Queensland, Australia
Posts: 23
OS: Windows Vista Ultimate

My System

I dont think that will work becuase it only reads one line ( the quote script ) and not to mention the file is quite long and im going to have more then 1 line added.
Extraction is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 10-22-2006, 07:47 AM   #4 (permalink)
Design Team
 
DJ-Zep's Avatar
 
Join Date: Mar 2006
Location: Philadelphia
Posts: 1,496
OS: Windows Server 2003

My System

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."
DJ-Zep is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 10-23-2006, 12:05 AM   #5 (permalink)
Manager Emeritus
 
v-six's Avatar
 
Join Date: Sep 2004
Location: High Falls, NY
Posts: 2,064
OS: OS X for mac, XP Pro for PC


Send a message via AIM to v-six
is the .txt file being called into an shtml or php page?
__________________
mysql> --i-am-a-dummy
Brewing up something good at vervesix...

v-six is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 10-23-2006, 06:46 PM   #6 (permalink)
Registered User
 
Join Date: Jun 2006
Location: Queensland, Australia
Posts: 23
OS: Windows Vista Ultimate

My System

in a php file

i renamed the extension to a .shtml but none of my PHP code works at all then
Extraction is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -7. The time now is 06:57 PM.



Copyright 2001 - 2008, Tech Support Forum

Search Engine Friendly URLs by vBSEO

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82