View Single Post
  #9   Spotlight this post!  
Unread 26-01-2005, 17:01
FRANK(WGH) FRANK(WGH) is offline
Webmaster - delphielite.com
AKA: Frank
FRC #0048 (Delphi E.L.I.T.E.)
Team Role: Webmaster
 
Join Date: Nov 2001
Rookie Year: 2001
Location: Warren, OHIO
Posts: 88
FRANK(WGH) will become famous soon enough
Send a message via AIM to FRANK(WGH)
Re: PHP Coding HELP!!!

Quote:
Originally Posted by AIBob
Try this:
profile.php
PHP Code:
<?php
$name
=strtolower($_GET["name"]);
$fname="profiles.txt";
if((
$fp=fopen($fname,"r")))
{
   
$lines=split("
"
,fread($fp,filesize($fname)));
   
$done=0;
   foreach(
$lines as $line)
   {
      if(!
$done)
      {
         
$prof=split("///",$line);
         if(
strtolower($prof[0])==$name)
         {
            echo 
$prof[1];
            
$done=1;
         }
      }
   }
   if(!
$done) echo "User profile not found";
   
fclose($fp);
}
else
{
   echo 
"There was an error in opening the profiles file";
}
?>
profiles.txt:
Code:
bob///this is the first line of the profile<br>this is the second.<br>etc...
frank///this is the first line of the profile<br>this is the second.<br>etc...
then just go to:
profile.php?name=bob

This script is just what i'm looking for. I do have one more question though.
Is there a way, that i can in the one line of text that i must contain all the information in, that i can tell it to include a file with the profile. This solution works if all i want to say is conatianed it one line but i need multiple lines and some tables. Take a look at this example:
http://www.delphielite.com/modules/profiles/example.php
i'd like this to be able to be shown on the page.
__________________
Frank Bosak
Collegiate Mentor Association
Team 48 - Delphi E.L.I.T.E.