FutureQuest, Inc. FutureQuest, Inc. FutureQuest, Inc.

FutureQuest, Inc.
Go Back   FutureQuest Community > General Site Owner Support (All may read/respond) > Utilities / Scripts / Software
User Name
Password  Lost PW

Reply
 
Thread Tools Search this Thread Display Modes
Old 03-14-2000, 06:57 PM   Postid: 37406
2kewl
Visitor

Forum Notability:
0 pts:
[Post Feedback]
 
Join Date: Mar 2000
Location: United Kingdom
Posts: 2
Searching for Perl script

Hi,
I'm searching for a Perl script which will display the contents of a character &quot;|&quot; delimited database file. Something like a guestbook without the ability to add entries, just simply to display on a HTML page. Help please.<!-- NO_AUTO_LINK -->
2kewl is offline   Reply With Quote
Old 03-15-2000, 02:44 PM   Postid: 37407
urban
Site Owner

Forum Notability:
10 pts: User-friendly
[Post Feedback]
 
Join Date: Feb 1999
Posts: 97
You describe a script that is (in all likelihood) fairly easy to develop.  I doubt you'll find a completely 'generalized' script that will just automatically work with your file.  However, if you post more details, someone will most likely be able to assist you.

What are the fields separated by the '|'?  How many fields are there?  How do you want to display each field?  Etc...


Code Sample:

open(FH,'/big/dom/x-whatever/somedir/myflatfile.txt);
while(<FH>) {
 ($field1,$field2,$field3,$field4) = split(/\|/);
 print &quot;FieldOne = &quot;.$field1.&quot;
\n&quot;;
 print &quot;FieldFour = &quot;.$field4.&quot;
\n&quot;;
}




urban is offline   Reply With Quote
Old 03-15-2000, 05:32 PM   Postid: 37408
2kewl
Visitor

Forum Notability:
0 pts:
[Post Feedback]
 
Join Date: Mar 2000
Location: United Kingdom
Posts: 2
Easy for some maybe for not for me. I'm looking for a ready-made script. There must be one somewhere!

The database file is written by my form mailer (ennyforms) from fields entered into a form and also emails me the form. Here's a sample of the database:

|xxxxx@xxxxx.com|Sandra|USA|Female|22|epals|English||I look forward to making epals from all over the world, especially from Asia and Europe. I like learning about different cultures and languages. Friendship only. Age and gender doesn't matter. Hope to hear from you soon.|

There are lots of scripts which record in a database but none, it seems, which will simply write it to a HTML page. Lots of DBMs of course, but they all include adding to the database and searching which I don't want.

As I said just a simple centre-stacked page maybe just like a guestbook.

The purpose is to display latest pen pal ads.

ANDY

<!-- NO_AUTO_LINK -->
[This message has been edited by 2kewl (edited 03-15-00@5:34 pm)]
2kewl is offline   Reply With Quote
Old 03-16-2000, 12:40 AM   Postid: 37409
Dan Kaplan
Registered User

Forum Notability:
10 pts: User-friendly
[Post Feedback]
 
Join Date: Oct 1999
Location: Salem, Oregon
Posts: 1,416
A possible solution would be using Gossamer Thread's DBMan with no login and a &quot;list all&quot; by default.  That would effectively be the same as just listing all the database info on one page.  You can format the output pretty much however you want.

The challenge might lie in syncing the ennyforms and DBMan database formats...

http://www.gossamer-threads.com

Dan
Dan Kaplan is offline   Reply With Quote
Old 03-23-2000, 07:25 AM   Postid: 37410
sumengen
Visitor
 
sumengen's Avatar

Forum Notability:
0 pts:
[Post Feedback]
 
Join Date: Mar 2000
Posts: 127
Hi,
If you save the code below to a file and run it in your cgi dir, it will be creating a table with the information in your data file. You should edit the $data_path and $data_file variables.


Code Sample:

#!/usr/bin/perl -w

my $data_path = &quot;/path/to/your/data/directory&quot;;
my $data_file = &quot;data.txt&quot;;

open(FILE, &quot;$data_path/$data_file&quot or die &quot;Can't open $data_file&quot;;
flock(FILE, 2);
my @records = <FILE>;
flock(FILE, 8);
close(FILE);
chomp(@records);

my ($html);
for (@records){
   $html .= &quot;<tr><td>&quot; . join(&quot;</td><td>&quot;, map {s#^$#\&amp;nbsp;#g;$_} eval{my @temp = split /\|/; shift(@temp) unless($temp[0]); @temp} ) . &quot;</td></tr>&quot;;
}
$html = '<table border=&quot;1&quot; width=&quot;100%&quot;>' . $html . '</table>';

print &quot;Content-type: text/html\n\n&quot;;

print $html;



------------------
*****************
Baris Sumengen
*****************
sumengen is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 visitors)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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


All times are GMT -4. The time now is 10:39 AM.


Running on vBulletin®
Copyright © 2000 - 2013, Jelsoft Enterprises Ltd.
Hosted & Administrated by FutureQuest, Inc.
Images & content copyright © 1998-2013 FutureQuest, Inc.
FutureQuest, Inc.