Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Server date & time stamp??????

Status
Not open for further replies.

kickinpretty

Technical User
Jul 26, 2002
17
GB
Hi

i need to be able to save a text file as the server time and date ie...2008100902.txt

how do i get the server time and date and convert them into variables that i can use, im running win98se and apache!

thanx in advance for any help offered:)
 
use something simple like this:

Code:
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);

$filename = sprintf("%4d%02d%02d%02d%02d%02d.txt", $year+1900, $mon+1, $mday, $hour, $min, $sec);

print $filename;

--
san.
 
Hi thanx for the reply...

Im very new to perl/cgi so please be patient with me,just how would that fit in with this existing script, i tried just adding bits where i thought they may need to go but it didnt work, can you please point me in the right direction, also if i wanted to send a confirmation email upon success how would i do this if for example v1 was the email variable?

many thanx :)

my script....


#!\Perl\bin\perl

require "subparseform.lib";
&Parse_Form;

$pw = $formdata{'pw'};
$an = $formdata{'an'};
$un = $formdata{'un'};
$v1 = $formdata{'v1'};
$v2 = $formdata{'v2'};
$v3 = $formdata{'v3'};
$v4 = $formdata{'v4'};
$v5 = $formdata{'v5'};
$v6 = $formdata{'v6'};
$v7 = $formdata{'v7'};
$v8 = $formdata{'v8'};
$v9 = $formdata{'v9'};
$v10 = $formdata{'v10'};
$v11 = $formdata{'v11'};
$v12 = $formdata{'v12'};
$v13 = $formdata{'v13'};
$v14 = $formdata{'v14'};
$v15 = $formdata{'v15'};

@New
= "pw=$pw&an=$an&un=$un&v1=$v1&v2=$v2&v3=$v3&v4=$v4&v5=$v5&v
6=$v6&v7=$v7&v8=$v8&v9=$v9&v10=$v10&v11=$v11&v12=$v12&v13=$v
13&v14=$v14&v15=$v15");

open (LOG, ">/Program Files/Abria
Merlin/Apache/htdocs/login/$an$pw.txt") || &ErrorMessage;
print LOG "@New";
close (LOG);


print "Content-type: text/html\n\n";
print "status= Successfull";

sub ErrorMessage {
print "Content-type: text/html\n\n";
print "status=failed - please try again!";
exit;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top