Home Forums Gamescan Chat42 About
* Login   * Register * FAQ    * Search
It is currently Fri 03-29-2024 2:01AM

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: CGI script help
PostPosted: Thu 06-24-2004 9:09PM 


Source: Somewhere
I too need some help, but with CGI script programming. Here is the problem. I am making a message board script, very basic for now, but if you have ever been to the tj3nw.com web page you know I like to make scripts…

Anyway I get a message from the user and save it to the hard drive as a file. If I open the file (on the server) ALL hard returns are there, but when I go to display the post it runs every thing together…

Does anyone have any ideas on how to fix this?

I would like to use perl / cgi… I thought about loading the message into an array, but I cannot get the script to ‘see’ the returns…

I sincerely thank any one that has an idea.

You can play with the script at:

http://www.jasonholm.com/cgi-bin/topics/topics.cgi

Jason


Top
  
    
 Post subject:
PostPosted: Thu 06-24-2004 10:12PM 
Offline
Major

Joined: Wed 03-19-2003 12:40AM
Posts: 343

Source: Delta Tau Delta
Hmm, are you doing any chomps to each line which might cut the \n off?

If you post the code that reads from the file, I could figure it out.


Top
 Profile  
    
 Post subject:
PostPosted: Thu 06-24-2004 10:26PM 


Source: Somewhere
open (COMMENT, "data/t$topic_number/C$post_number.dat") or die "Could not open comment file!";
$comment = <COMMENT>;
close (COMMENT);

.
.
.

# print "$comment";


$current_message_len = length($comment);

for ($chars_to_print = 1; $chars_to_print < $current_message_len; $chars_to_print++)
{
$chr_to_print = mid($comment,$chars_to_print,1);

print "$chr_to_print";
}


This is just the first step in what I was trying... When I got this to work I was going to have it print a br if it found a hard return...

Thanks for you help.

-Jason


Top
  
    
 Post subject:
PostPosted: Thu 06-24-2004 10:30PM 
Offline
Major

Joined: Wed 03-19-2003 12:40AM
Posts: 343

Source: Delta Tau Delta
Some of the stuff is confusing, but remember $comment = <COMMENT>; only grabs until and including the first line break.

To get the whole file into a single string which includes newlines, I do:

while(<COMMENT>) {
$comment = $comment + $_;
}

or whatever. Maybe a . instead of +.


Top
 Profile  
    
 Post subject:
PostPosted: Thu 06-24-2004 10:37PM 


Source: Somewhere
Hmmm...

O-Kay, did not know that. I'll look into other ways to get the info from the file. Thanks again!


Top
  
    
 Post subject:
PostPosted: Fri 06-25-2004 9:35AM 
Offline
Penis Hater
User avatar

Joined: Mon 02-16-2004 1:47PM
Posts: 2106

Source: Off Campus
What exactly are you trying to separate? Put a newline after each sentence? Try putting in <br> instead of the endline. I made a nice little php script that does it before putting it into my oracle database... (mine being umr's)

AND FORMAT YOUR SOURCE CODE TO BE READABLE!!!!


Top
 Profile  
    
 Post subject:
PostPosted: Sat 06-26-2004 12:04AM 


Source: Somewhere
Thank you to everyone who helped.

Found the answer I needed, and it is working well.


--I guess its o-kay to delete this thread now--


-Jason Holm


Top
  
    
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group