Results 1 to 4 of 4
Thread: Code Confusion
Feb 7, 2001, 16:51 #1
This was a toss up between this forum and the Java forum...
I have a CGI script, and I want to execute it using the java script code:
This has worked before, but now its not. Here is the CGI file that I'm trying to "convert"
#!/usr/local/bin/perl $random_file = "/home/username/public_html/directory/random.txt"; $delimiter = "\n\%\%\%\%\n"; open(FILE,"$random_file") || &error('open->random_file',$random_file); @FILE = <FILE>; close(FILE); $phrases = join('',@FILE); @phrases = split(/$delimiter/,$phrases); srand(time ^ $$); $phrase = rand(@phrases); print "document.write(Content-type: text/html');\n\n"; print "document.write('$phrases[$phrase]');\n"; exit;
What seems to be the problem here?
Thanks in advance.
PS: If you know of a Java script file that randomly chooses information from an external file, please tell me.