|
|
|
|
|
|
| |
This script reads two type of files and updates a sales table. First it executes the shell script file. After that it reads the .out files and then i updates one of the table in a database.
| <?php
$ftps = array( host => "localhost",user => "ftp",psswd => "");
//Openning an ftp connection
$conn = ftp_connect( $ftps["host"] );
if( !$conn ){
echo "FTP server connection error" . "<BR>";
exit;
}
else{
echo "Connected to FTP Server" . "<BR>";
//Login to the FTP server.
@$result = ftp_login( $conn, $ftps["user"], $ftps["psswd"] );
if( !$result){
echo "The page couldn't log in as : " . $ftps["user"] . "<BR>";
ftp_quit( $conn );
exit;
}
echo "You are user: " . $ftps["user"] . "<BR>";
//Getting the file's time from the FTP_Server.
$time = ftp_mdtm( $conn, "/alex/hola.txt" );
echo date("D d-M-Y -- H:i:s", $time) . "<BR>";
//Executing a shell script.
//my_script is a shell script which only has an echo statement.
$res = ftp_exec($conn, "/src/shell_scripts/my_script");
echo "Script Shell result: " . $res;
$readfile = file("var/www/html/rt.out");
for ($k=0; $k<=count($readfile)-1; $k++) {
$fields = split("\t",$readfile[$k]);
$rt = "UPDATE sales set date ='$fields[0]', downloads='$fields[2]' where type = 'rt'";
}
$readfile1 = file("var/www/html/rbt.out");
for ($k=0; $k<=count($readfile1)-1; $k++) {
$fields = split("\t",$readfile1[$k]);
$rbt = "UPDATE sales set date ='$fields[0]', downloads='$fields[2]' where type = 'rbt'";
}
ftp_quit( $conn );
}
?> | |
|
|
| Checks Date-Input from HTML-Forms and converts to YYYY-MM-DD Format for MySQL Date-Fields Categories : MySQL, Date Time, PHP, Databases | | | Save and restore files into postgresql database (PHP SCRIPT) PHP CLASS Categories : PHP, Databases, PostgreSQL, Filesystem | | | Count how many weeks in the month have a specified day, such as Mon, Tue, etc. Var avail - number of days - first day name of the month, occurrences of Sun, occurrences of Mon, etc. Allows you to calculate number of working hours exclude Holidays. Categories : Calendar, Date Time, PHP, Databases, MySQL | | | Phorum, MySQL, Language, UK date format, MySQL UK Date format Categories : PHP, Date Time, Strings, MySQL, Databases | | | How to Insert a Date Format Into MySQL from PHP Categories : PHP, Databases, MySQL, Date Time, Beginner Guides | | | PHP Transfer data from text file to Mysql Table Categories : PHP, PHP Classes, Filesystem, Databases, MySQL | | | mysql date/time converters Categories : PHP, MySQL, Databases, Date Time | | | Remote Archive (Zip, Tar, Gzip) downloader with FTP and local extration support Categories : PHP, FTP, Filesystem, PHP Classes, Compression | | | Monthly and Daily Upcoming Events calendar. Categories : Date Time, PostgreSQL, PHP, Calendar, Databases | | | Simple pipe delimited file export program that downloads to a local machine Categories : PHP, Filesystem, Databases, MySQL, HTTP | | | Convert a File database into MySQL Categories : PHP, Filesystem, Databases, MySQL, Beginner Guides | | | Moving folder hierarchy b/w server Categories : PHP, FTP, Filesystem | | | How to Convert a MySQL Timestamp to a USA Date & Time Categories : PHP, MySQL, Databases, Date Time | | | Directory TreeView - File Manager & Explorer - FTP - Utility - PHP/HTML - Categories : PHP, Directories, FTP, Filesystem, HTML and PHP | | | A wrapper function to format dates coming from a databases with the
same syntax as PHP's date() function. Categories : Date Time, Databases, PHP | |
|
|
|