In my country a great number of people who understand the PHP language, but none of these people, I do not advise.
I do not even answer
I have a server set up Nod32, a private server for updates
In the early stages of my work.
NOD32 I'll update and upload files to my server manually.
In a Google search and I was faced with the following code:
PHP Code:
#!/usr/bin/php
<?php
// recheck completion of every datafile each execution : false - faster - mimics NOD32; true - slower, safer - for unstable networks
$force_check = false;
// clean-up old unused *.nup files - saves disk space: false | true
$clean_unused = true;
// show individual downloaded files in log: false | true
$debug = false;
// unrar method - empty - use internal php mod_rar v2 or higher; use any string as an external command - 'unrar-free'
// - external command will be called eg. `unrar-free -x /tmp/file.rar /tmp/`
$unrar_method = '';
// list of update servers to use
$eset_server_list = '
update.eset.com
um10.eset.com
93.184.71.27
um12.eset.com
89.202.157.227
um14.eset.com
62.67.184.68
um16.eset.com
90.183.101.10
um18.eset.com
89.202.149.36
um10.eset.com
93.184.71.27
um12.eset.com
89.202.157.227
um14.eset.com
89.202.149.36
um16.eset.com
u47.eset.com
u48.eset.com
u49.eset.com
um10.eset.com
93.184.71.27
um12.eset.com
89.202.157.227
um14.eset.com
89.202.149.36
';
// local shared folder
$base_path = '/var/www/nod32';
// update path suffix
$base_suffix = '/3';
// eg. we can access `http://nod32.server.tld` to physical path `/var/www/nod32` [$base_path]
// if [base_suffix] = `/3`, it means we need to enter `http://nod32.server.tld/3` into NOD32 update path
// beware, you must use a rewrite or apache virtualhost if you don't want to mix your web with NOD32 files
// - NOD32 uses absolute path /download to get its data files
// temporary path, must exist and be writeable
$tmp = '/tmp';
// Username and password sent to you by e-mail from ESET
$user = '';
$pass = '';
///////////////////////////////////////////////
// DO NOT EDIT BELOW THIS LINE
///////////////////////////////////////////////
// check all files if last update was not successfull
if (is_file($tmp.'/nod32update.force-check.tmp'))
{
echo 'Note: Full forced check detected from previous unsuccessful run.'."\n";
$force_check = true;
unlink($tmp.'/nod32update.force-check.tmp');
}
// prepare list of eset update servers
$eset_server_list = explode("\n",trim($eset_server_list));
function SelectRandomServer()
{
global $eset_server_list, $eset_server;
$eset_server = trim($eset_server_list[mt_rand(0,count($eset_server_list)-1)]);
}
// download update.ver meta info
for ($i=3;$i>0;$i--)
{
SelectRandomServer();
if ($debug)
{echo ' - trying to download http://'.$eset_server.'/eset_upd/update.ver'."\n";}
curl_setopt($ch, CURLOPT_URL, 'http://'.$eset_server.'/eset_upd/update.ver');
$data = curl_exec($ch);
if (! $data)
{
echo 'Could not connect to server '.$eset_server.'.'."\n";
if ($i==1)
{die('Maximum tries reached. Bye.'."\n");}
} else {
echo 'Successfully connected to server '.$eset_server.'.'."\n";
break;
}
}
if ( (is_file($base_path.$base_suffix.'/update.ver')) &&
(md5_file($base_path.$base_suffix.'/update.ver', true) == md5($data,true)) )
{
if ($force_check)
{
echo 'Note: Update.ver checksum is the same, however force checking is enabled.'."\n";
} else {
die('Update.ver checksum is the same, update not needed. Bye.'."\n");
}
}
foreach ($update_files as $upd_file)
{
// download only file info
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // resets direct FILE output
curl_setopt($ch, CURLOPT_URL, 'http://'.$eset_server.$upd_file);
$data = curl_exec($ch);
$time_modified = 0;
if (preg_match('`\sLast\-Modified\: (.*)$`im', $data, $time))
{
$time_modified = strtotime(trim($time[1]));
} else {
echo 'Failed to receive modification time of from header of '.$upd_file.'. Downloading again.'."\n";
}
$size = -1;
if (preg_match('`\Content\-Length\: (.*)$`im', $data, $size))
{
$size = (float) (trim($size[1]));
} else {
echo 'Failed to receive filesize from header of '.$upd_file.'.'."\n";
}
if ($size_real == $size)
{
touch($base_path.$upd_file, $time_modified);
} else {
touch($base_path.$upd_file, ($time_modified-3600));
$all_ok = false;
echo 'Warning: Filesize of '.$upd_file.' is different than expected, will be retried on next run.'."\n";
}
$total_size += $size_real;
}
}
// update meta file
$dir = $base_path.$base_suffix;
if (! is_dir($dir))
{mkdir($dir, 0777, true);}
rename($tmp.'/nod32update.rar', $base_path.$base_suffix.'/update.ver');
foreach ($existing_files as $curfile)
{
$curfile = str_replace($base_path, '', $curfile);
if (! in_array($curfile, $update_files, true))
{
$size = filesize($base_path.$curfile);
if (unlink($base_path.$curfile))
{
$removed_files++;
$total_size += $size;
} else {
echo 'Could not remove unused file ('.$curfile.').'."\n";
}
}
}
echo 'Clean-up complete.'.(($removed_files>0)?' '.$removed_files.' files in size of '.bytes($total_size).' were removed.':' No files were removed.')."\n";
}
?>
This code is related to the year 2010
I need your help to complete and fix the problem with this code, I am
One other example:
PHP Code:
#Script settings
#User name and password
USER_NAME=YOUR_USER_NAME
PASSWORD=YOUR_PASS_WORD
#Language code to download (0 for all)
language=1033
#download components or not, 0 no , 1 yes.
component=1
#Server address (root), no trailing slash
SERVER="http://update.eset.com"
#Path to update.ver on server
UPDATE='eset_upd/update.ver'
#Path to save update into
SAVETO="/home/f0rud/upd"
I am entering the code requires a username and password to get the update file and folder on the server to save
All files updated to include 32-bit and 64 bit versions of NOD32 Antivirus or ESET Smart Security to download
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
I'm not familiar with PHP
I request help from people who are professionals
Your friends want to try this code if you have the problem solved.
PHP Code:
#!/usr/bin/php <?php
// recheck completion of every datafile each execution : false - faster - mimics NOD32; true - slower, safer - for unstable networks $force_check = false;
// clean-up old unused *.nup files - saves disk space: false | true $clean_unused = true;
// show individual downloaded files in log: false | true $debug = false;
// unrar method - empty - use internal php mod_rar v2 or higher; use any string as an external command - 'unrar-free' // - external command will be called eg. `unrar-free -x /tmp/file.rar /tmp/` $unrar_method = '';
// list of update servers to use $eset_server_list = ' update.eset.com um10.eset.com 93.184.71.27 um12.eset.com 89.202.157.227 um14.eset.com 62.67.184.68 um16.eset.com 90.183.101.10 um18.eset.com 89.202.149.36 um10.eset.com 93.184.71.27 um12.eset.com 89.202.157.227 um14.eset.com 89.202.149.36 um16.eset.com u47.eset.com u48.eset.com u49.eset.com um10.eset.com 93.184.71.27 um12.eset.com 89.202.157.227 um14.eset.com 89.202.149.36 ';
// local shared folder $base_path = '/var/www/nod32';
// update path suffix $base_suffix = '/3';
// eg. we can access `http://nod32.server.tld` to physical path `/var/www/nod32` [$base_path] // if [base_suffix] = `/3`, it means we need to enter `http://nod32.server.tld/3` into NOD32 update path // beware, you must use a rewrite or apache virtualhost if you don't want to mix your web with NOD32 files // - NOD32 uses absolute path /download to get its data files
// temporary path, must exist and be writeable $tmp = '/tmp';
// Username and password sent to you by e-mail from ESET $user = ''; $pass = '';
/////////////////////////////////////////////// // DO NOT EDIT BELOW THIS LINE ///////////////////////////////////////////////
// check all files if last update was not successfull if (is_file($tmp.'/nod32update.force-check.tmp')) { echo 'Note: Full forced check detected from previous unsuccessful run.'."\n"; $force_check = true; unlink($tmp.'/nod32update.force-check.tmp'); }
// prepare list of eset update servers $eset_server_list = explode("\n",trim($eset_server_list));
function SelectRandomServer() { global $eset_server_list, $eset_server; $eset_server = trim($eset_server_list[mt_rand(0,count($eset_server_list)-1)]); }
// download update.ver meta info for ($i=3;$i>0;$i--) { SelectRandomServer();
if ($debug) {echo ' - trying to download http://'.$eset_server.'/eset_upd/update.ver'."\n";}
curl_setopt($ch, CURLOPT_URL, 'http://'.$eset_server.'/eset_upd/update.ver'); $data = curl_exec($ch); if (! $data) { echo 'Could not connect to server '.$eset_server.'.'."\n"; if ($i==1) {die('Maximum tries reached. Bye.'."\n");} } else { echo 'Successfully connected to server '.$eset_server.'.'."\n"; break; } }
if ( (is_file($base_path.$base_suffix.'/update.ver')) && (md5_file($base_path.$base_suffix.'/update.ver', true) == md5($data,true)) ) { if ($force_check) { echo 'Note: Update.ver checksum is the same, however force checking is enabled.'."\n"; } else { die('Update.ver checksum is the same, update not needed. Bye.'."\n"); } }
foreach ($update_files as $upd_file) { // download only file info curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_NOBODY, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // resets direct FILE output curl_setopt($ch, CURLOPT_URL, 'http://'.$eset_server.$upd_file); $data = curl_exec($ch);
$time_modified = 0; if (preg_match('`\sLast\-Modified\: (.*)$`im', $data, $time)) { $time_modified = strtotime(trim($time[1])); } else { echo 'Failed to receive modification time of from header of '.$upd_file.'. Downloading again.'."\n"; }
$size = -1; if (preg_match('`\Content\-Length\: (.*)$`im', $data, $size)) { $size = (float) (trim($size[1])); } else { echo 'Failed to receive filesize from header of '.$upd_file.'.'."\n"; }
if ($size_real == $size) { touch($base_path.$upd_file, $time_modified); } else { touch($base_path.$upd_file, ($time_modified-3600)); $all_ok = false; echo 'Warning: Filesize of '.$upd_file.' is different than expected, will be retried on next run.'."\n"; }
$total_size += $size_real; } }
// update meta file $dir = $base_path.$base_suffix; if (! is_dir($dir)) {mkdir($dir, 0777, true);} rename($tmp.'/nod32update.rar', $base_path.$base_suffix.'/update.ver');
foreach ($existing_files as $curfile) { $curfile = str_replace($base_path, '', $curfile); if (! in_array($curfile, $update_files, true)) { $size = filesize($base_path.$curfile); if (unlink($base_path.$curfile)) { $removed_files++; $total_size += $size; } else { echo 'Could not remove unused file ('.$curfile.').'."\n"; } } }
echo 'Clean-up complete.'.(($removed_files>0)?' '.$removed_files.' files in size of '.bytes($total_size).' were removed.':' No files were removed.')."\n"; }
?>
I launched my private server updade NOD32
And at this rate I know that this script will download the files on the server node updates
I'm not familiar with PHP
I request help from people who are professionals
Your friends want to try this code if you have the problem solved.
PHP Code:
#!/usr/bin/php
<?php
// recheck completion of every datafile each execution : false - faster - mimics NOD32; true - slower, safer - for unstable networks
$force_check = false;
// clean-up old unused *.nup files - saves disk space: false | true
$clean_unused = true;
// show individual downloaded files in log: false | true
$debug = false;
// unrar method - empty - use internal php mod_rar v2 or higher; use any string as an external command - 'unrar-free'
// - external command will be called eg. `unrar-free -x /tmp/file.rar /tmp/`
$unrar_method = '';
// list of update servers to use
$eset_server_list = '
update.eset.com
um10.eset.com
93.184.71.27
um12.eset.com
89.202.157.227
um14.eset.com
62.67.184.68
um16.eset.com
90.183.101.10
um18.eset.com
89.202.149.36
um10.eset.com
93.184.71.27
um12.eset.com
89.202.157.227
um14.eset.com
89.202.149.36
um16.eset.com
u47.eset.com
u48.eset.com
u49.eset.com
um10.eset.com
93.184.71.27
um12.eset.com
89.202.157.227
um14.eset.com
89.202.149.36
';
// local shared folder
$base_path = '/var/www/nod32';
// update path suffix
$base_suffix = '/3';
// eg. we can access `http://nod32.server.tld` to physical path `/var/www/nod32` [$base_path]
// if [base_suffix] = `/3`, it means we need to enter `http://nod32.server.tld/3` into NOD32 update path
// beware, you must use a rewrite or apache virtualhost if you don't want to mix your web with NOD32 files
// - NOD32 uses absolute path /download to get its data files
// temporary path, must exist and be writeable
$tmp = '/tmp';
// Username and password sent to you by e-mail from ESET
$user = '';
$pass = '';
///////////////////////////////////////////////
// DO NOT EDIT BELOW THIS LINE
///////////////////////////////////////////////
// check all files if last update was not successfull
if (is_file($tmp.'/nod32update.force-check.tmp'))
{
echo 'Note: Full forced check detected from previous unsuccessful run.'."\n";
$force_check = true;
unlink($tmp.'/nod32update.force-check.tmp');
}
// prepare list of eset update servers
$eset_server_list = explode("\n",trim($eset_server_list));
function SelectRandomServer()
{
global $eset_server_list, $eset_server;
$eset_server = trim($eset_server_list[mt_rand(0,count($eset_server_list)-1)]);
}
// download update.ver meta info
for ($i=3;$i>0;$i--)
{
SelectRandomServer();
if ($debug)
{echo ' - trying to download http://'.$eset_server.'/eset_upd/update.ver'."\n";}
curl_setopt($ch, CURLOPT_URL, 'http://'.$eset_server.'/eset_upd/update.ver');
$data = curl_exec($ch);
if (! $data)
{
echo 'Could not connect to server '.$eset_server.'.'."\n";
if ($i==1)
{die('Maximum tries reached. Bye.'."\n");}
} else {
echo 'Successfully connected to server '.$eset_server.'.'."\n";
break;
}
}
if ( (is_file($base_path.$base_suffix.'/update.ver')) &&
(md5_file($base_path.$base_suffix.'/update.ver', true) == md5($data,true)) )
{
if ($force_check)
{
echo 'Note: Update.ver checksum is the same, however force checking is enabled.'."\n";
} else {
die('Update.ver checksum is the same, update not needed. Bye.'."\n");
}
}
foreach ($update_files as $upd_file)
{
// download only file info
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // resets direct FILE output
curl_setopt($ch, CURLOPT_URL, 'http://'.$eset_server.$upd_file);
$data = curl_exec($ch);
$time_modified = 0;
if (preg_match('`\sLast\-Modified\: (.*)$`im', $data, $time))
{
$time_modified = strtotime(trim($time[1]));
} else {
echo 'Failed to receive modification time of from header of '.$upd_file.'. Downloading again.'."\n";
}
$size = -1;
if (preg_match('`\Content\-Length\: (.*)$`im', $data, $size))
{
$size = (float) (trim($size[1]));
} else {
echo 'Failed to receive filesize from header of '.$upd_file.'.'."\n";
}
if ($size_real == $size)
{
touch($base_path.$upd_file, $time_modified);
} else {
touch($base_path.$upd_file, ($time_modified-3600));
$all_ok = false;
echo 'Warning: Filesize of '.$upd_file.' is different than expected, will be retried on next run.'."\n";
}
$total_size += $size_real;
}
}
// update meta file
$dir = $base_path.$base_suffix;
if (! is_dir($dir))
{mkdir($dir, 0777, true);}
rename($tmp.'/nod32update.rar', $base_path.$base_suffix.'/update.ver');
foreach ($existing_files as $curfile)
{
$curfile = str_replace($base_path, '', $curfile);
if (! in_array($curfile, $update_files, true))
{
$size = filesize($base_path.$curfile);
if (unlink($base_path.$curfile))
{
$removed_files++;
$total_size += $size;
} else {
echo 'Could not remove unused file ('.$curfile.').'."\n";
}
}
}
echo 'Clean-up complete.'.(($removed_files>0)?' '.$removed_files.' files in size of '.bytes($total_size).' were removed.':' No files were removed.')."\n";
}
?>
I launched my private server updade NOD32
And at this rate I know that this script will download the files on the server node updates
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
I am advising you to post your reply in public because someone else might be able to help you.
It doesn't mean I take sole responsibility for your issue and you should PM me. I don't want you to PM me with your answers, I want you to post them HERE in this thread.
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
ok please forward my mssages to me for shared here
What? - I am not your slave, personal assistant or translator.
Your PM didn't even answer my questions properly and most of it didn't even make sense either. You're the one asking for help, how about you stop being lazy and put in some effort?
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
According to wikipedia, ESET NOD32 (commonly referred to simply as "NOD32") is apparently a Slovakian antivirus software package. This seems to fit with the server list present in the code provided by the OP (lots of references to eset.com, which is the home site of ESET NOD32).
So, we can at least put that matter to rest. The OP is working with an antivirus update for his server - perhaps needing a cron job or similar to auto-update his virus definitions?
As for the specific problem being encountered and any relation to the year 2010, I have no idea so far...
Edit:Just noticed this bit of text tucked in at the bottom of the OP's first PHP script box:
Quote:
I launched my private server updade NOD32
And at this rate I know that this script will download the files on the server node updates
Sounds like maybe the definition update package will download properly but won't apply itself to the server's installation of NOD32? But then again maybe I'm just grasping at straws at this point.