Go to Post When you come down to it, FIRST is about people inspiring other people; STEM and the robots are just the subject matter. - RyanCahoon [more]
Home
Go Back   Chief Delphi > Technical > IT / Communications > Website Design/Showcase
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 25-01-2005, 17:30
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)
Unhappy PHP Coding HELP!!!

i'm kind of new to php coding and need some help working on my team's page.
I'd like to know some websites where i can find coding help. I'm also looking for someone that I could contact to ask specific questions. What i need help in specifically is, I'm working on profiles and i'd like to just create a template profile page, and then instead of using that page to make the profiles just include the profiles for each person from a text file. This way i only have one page that through the links will turn into many pages. I'm not sure if i'm helping describe my problem or just confusiong people. If anyone can help it will be appreciated.
__________________
Frank Bosak
Collegiate Mentor Association
Team 48 - Delphi E.L.I.T.E.
  #2   Spotlight this post!  
Unread 25-01-2005, 19:32
AIBob's Avatar
AIBob AIBob is offline
AI Programmer
AKA: Bob Frank DOT org
FRC #0358 (Hauppauge Robotic Eagles)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Long Island, NY (in Binghamton now)
Posts: 297
AIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to behold
Send a message via ICQ to AIBob Send a message via AIM to AIBob Send a message via MSN to AIBob Send a message via Yahoo to AIBob
Re: PHP Coding HELP!!!

http://www.php.net has everything on php in there... just search their documentation and function library on their website... Or if you need a script that is not on there:
http://www.programmersheaven.com/
http://www.sourceforge.net/
http://www.pscode.com/
just search through their code there.
__________________
- from B B frank

  #3   Spotlight this post!  
Unread 26-01-2005, 09:06
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!!!

I recognize that i wasn't really clear on what i want to do so here it is. I'd like to use one page and then be able to include a specific include file through the link like this:
(http://delphielite.com/profiles.php?show=fbosak)
this way all i need is to create one completely formated page and then have it include a text file for each team member that has all the profile information.
I hope that this is possible
__________________
Frank Bosak
Collegiate Mentor Association
Team 48 - Delphi E.L.I.T.E.
  #4   Spotlight this post!  
Unread 26-01-2005, 09:12
ahmad's Avatar
ahmad ahmad is offline
Registered User
#0909
 
Join Date: Jan 2005
Location: kansas
Posts: 20
ahmad is an unknown quantity at this point
Re: PHP Coding HELP!!!

Quote:
Originally Posted by FRANK(WGH)
I recognize that i wasn't really clear on what i want to do so here it is. I'd like to use one page and then be able to include a specific include file through the link like this:
(http://delphielite.com/profiles.php?show=fbosak)
this way all i need is to create one completely formated page and then have it include a text file for each team member that has all the profile information.
I hope that this is possible

see if this helps :


PHP Code:
<?php



 $fullname 
$_GET['name']; 
  
           
        



    
$query=mysql_query("SELECT * FROM $table where name='$fullname'") or die(mysql_error());

    
    
    while(
$row mysql_fetch_array($query)) {
     
$j mysql_num_fields($query);
        for(
$i=0;$i<$j;$i++) {
            
$k mysql_field_name($query,$i);
            $
$k $row[$k];
        }
    
    
$entry=stripslashes($entry);



Echo
" entry";


    
?>

to see somthing you just type : index.php?name=FRANK

Last edited by ahmad : 26-01-2005 at 10:09.
  #5   Spotlight this post!  
Unread 26-01-2005, 09:35
Brandon Martus's Avatar Unsung FIRST Hero
Brandon Martus Brandon Martus is offline
busy.
AKA: B. Slash Kamen
no team
 
Join Date: May 2001
Rookie Year: 1998
Location: Nevada, TX USA
Posts: 5,271
Brandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond repute
Send a message via ICQ to Brandon Martus Send a message via AIM to Brandon Martus Send a message via Yahoo to Brandon Martus
Re: PHP Coding HELP!!!

Be careful that you don't allow people to show any file on your system. Be sure to restrict it to a particular secure directory. I've heard of horror stories where the mechanism to include files allowed people to view password files and other system files.
__________________
Brandon Martus
e-mail
  #6   Spotlight this post!  
Unread 26-01-2005, 10:22
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 ahmad
see if this helps :


PHP Code:
<?php



 $fullname 
$_GET['name']; 
  
           
        



    
$query=mysql_query("SELECT * FROM $table where name='$fullname'") or die(mysql_error());

    
    
    while(
$row mysql_fetch_array($query)) {
     
$j mysql_num_fields($query);
        for(
$i=0;$i<$j;$i++) {
            
$k mysql_field_name($query,$i);
            $
$k $row[$k];
        }
    
    
$entry=stripslashes($entry);



Echo
" entry";


    
?>

to see somthing you just type : index.php?name=FRANK
Where would i specify what to direct frank to?? Is this in a my-sql database??
If so is there a way to do it in another form such as a text document or web site.
__________________
Frank Bosak
Collegiate Mentor Association
Team 48 - Delphi E.L.I.T.E.
  #7   Spotlight this post!  
Unread 26-01-2005, 13:35
ahmad's Avatar
ahmad ahmad is offline
Registered User
#0909
 
Join Date: Jan 2005
Location: kansas
Posts: 20
ahmad is an unknown quantity at this point
Re: PHP Coding HELP!!!

Quote:
Originally Posted by FRANK(WGH)
Where would i specify what to direct frank to?? Is this in a my-sql database??
If so is there a way to do it in another form such as a text document or web site.

that's right ... this is for my-sql databases ....
the other ones ... i'm not sure so i won't say anything ...
  #8   Spotlight this post!  
Unread 26-01-2005, 13:54
AIBob's Avatar
AIBob AIBob is offline
AI Programmer
AKA: Bob Frank DOT org
FRC #0358 (Hauppauge Robotic Eagles)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Long Island, NY (in Binghamton now)
Posts: 297
AIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to behold
Send a message via ICQ to AIBob Send a message via AIM to AIBob Send a message via MSN to AIBob Send a message via Yahoo to AIBob
Re: PHP Coding HELP!!!

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
__________________
- from B B frank


Last edited by AIBob : 26-01-2005 at 14:02. Reason: missed something in my code..
  #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.
  #10   Spotlight this post!  
Unread 26-01-2005, 17:18
cdawzrd's Avatar
cdawzrd cdawzrd is offline
Vice-President of Caffine
AKA: Jonathan
#0619 (CA Robotics)
Team Role: Programmer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Charlottesville, Virginia
Posts: 63
cdawzrd will become famous soon enough
Send a message via AIM to cdawzrd
Re: PHP Coding HELP!!!

Quote:
Originally Posted by FRANK(WGH)
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.
so basically you want to be able to have seperate files for different people?

make a directory on your server as a subdirectory of whereever your profile.php is. call it profiles. chmod it to read/write for the user (i dont know the code)

change the example code to somethign like this:

the code says the file is "profiles.txt"
make it
PHP Code:
$filename "profiles/" $name ".txt"
there are two ways to make your file. you can make them html, in which case you can just read in the whole file and print it out (get rid of the split by line statement)

the second way is to keep the split statement and have the file be like a flat database so you would have one line for name, grade, filepath to picture, etc.

then, just read it in with the example code you have, split it in to an array and print it out.

any questions, cdawzrd at gmail {do.t} com
__________________
Cdawzrd
>> www.cdawzrd.com <<
>> www.carobotics.org <<
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Speaking of PHP 5... Ryan M. IT / Communications 3 01-08-2004 16:46
openFIRST PHP 5 Compatibility Timothy D. Ginn FIRST-related Organizations 0 30-07-2004 13:45
PHP and Wiki Error Venkatesh Website Design/Showcase 2 24-07-2004 15:51
Coding / Style Standards for sharing C code Joe Johnson Programming 33 01-05-2004 15:15
What's better, PERL/cgi or PHP/my_sql? mikefrei Programming 10 27-05-2002 22:50


All times are GMT -5. The time now is 00:29.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi