Jump to content

jomla

Members
  • Posts

    39
  • Joined

  • Last visited

Everything posted by jomla

  1. It is not possible in an easy way with do while? I do not understand how work function cc
  2. Hi at all, please read this function: function cc(letters, comb, m, k) { var ret=[]; if (k == 0) { ret.push(comb); } else { for (var i=m; i<= letters.length-k; ++i) { cc(letters, comb+" "+letters+' ', i+1, k-1); } } return ret; } Function cc() calc combinations of numbers or letters or any other object like words, colors ........ . to call cc(): var c=new Array(1,2,3,4,5,6,7,8,9);// it can be an array of letters or of any other object var k=3;//size of any combination that can be 2 or 3 or 4 ...... or more var start=0; demo: var r=cc(c,"",start,k); It work very well but I do not love recursion call. How can I do to obtein the some result without recursion call? Thank you very much
  3. SOLVED Error was into the archives file name because I used prohibited character ":" during mysqldump. Script now work fine after changed sftp.class with a normal easy class <?php ini_set('error_reporting', E_ALL); ini_set('display_errors', 1); echo "<center><h1>Download SQL archives </h1></center>"; //Include configuration ftp_host, drp_user and ftp_pass include 'ftp_config.php'; $dir="backups"; $ftp_host=FTP_HOST; $ftp_user=FTP_USER; $ftp_pass=FTP_PASS; // *** Create the FTP object $ftpObj = new FTPClient($ftp_host,$ftp_user,$ftp_pass); // *** Connect if ($ftpObj -> connect()) { } else { echo 'Failed to connect'; } // *** Change to folder $ftpObj->cd('public_html/'.$dir.'/'); // *** Get folder contents $contentsArray = $ftpObj->ls('*.gzip'); // *** Output our array of folder contents echo '<pre>'; print_r($contentsArray); echo "</pre>"; $fileTo = dirname(__FILE__).'/backups/'; $fileFrom =$ftpObj->pwd(); // *** Download files for ($i=0;$i<count($contentsArray);$i++){ $ftpObj->get($fileFrom.'/'. $contentsArray[$i],$fileTo.$contentsArray[$i], FTP_BINARY); } $ftpObj->close(); echo "<h2>Download date-timw " . date("d-n-Y h:i:s") . "<br></h2>"; ?>
  4. I tryed to use ftp functions without to use class but now it make following error. Warning: ftp_get(): Prohibited file name: C:\xampp\htdocs\iomla\backups\dump.php in C:\xampp\htdocs\iomla\ftp0.php on line 40 $contentsArray=ftp_nlist($conn_id, "*.gzip"); Now $contentsArray return an array with all .sql.gzip files of the folder to download
  5. <?php ini_set('error_reporting', E_ALL); ini_set('display_errors', 1); ini_set('upload_max_filesize', '50M'); ini_set('post_max_size', '50M'); // *** Include the SFTP class include('sftp.class.php'); //include configuration $ftp_Host, $ftp_user and $ftp_password include('config.php'); $dir="backups"; $ftp_host=FTP_HOST; $ftp_user=FTP_USER; $ftp_pass=FTP_PASS; // *** Create the FTP object $ftpObj = new SFTP($ftp_host,$ftp_user,$ftp_pass); // *** Connect if ($ftpObj -> connect()) { echo 'connected <br>'; } else { echo 'Failed to connect'; } // *** Change to folder $ftpObj->cd('public_html/'.$dir.'/'); // *** Get folder contents $contentsArray = $ftpObj->ls($ftpObj->pwd()); $fileTo = dirname(__FILE__).'/backups/'; $fileFrom =$ftpObj->pwd(); // *** Download file for ($i=0;$i<count($contentsArray);$i++){ if (is_dir($contentsArray[$i])) {continue;} if (substr($contentsArray[$i],-5)!==".gzip") {continue;} if ($ftpObj->get($fileFrom.'/'. $contentsArray[$i],$fileTo.$contentsArray[$i], FTP_BINARY)) {echo "I download:".$fileTo.$contentsArray[$i]."<br>"; } } $ftpObj->close(); ?>
  6. He at all, I am trying sftp_class.php of Rachel baker It is easy to implemet and use but it do not download .sql.gzip archive that corrupt during download. Infact I tryed this class only to try to transfer my mysql dump backup from my web site to my local server XAMPP on windoes 10 PC. It do not make errors but filles transfered are empty (0 bytes) and with the name without extension therefore windows 10 not recognize them as gzip archive. By exemple if into web server file is named: backup-29-5-2017--17_50.sql.gzip locally after transfer its name is: backup-29-5-2017- Please, have you any idea to solve this problem? Thank you very much
  7. Hi at all I need a php script to set new date creation of a file. Thank you very much
  8. The session variable "me" represent my person that I am visiting my web site and its value with which I enter is "foo". So if the session variable $ _SESSION ['me'] !== 'foo' it can be inserted into file.log visitors because visitor I am not me. But I do not want even the search engines are put into visitors file.log so I added the second part of the function but some think do not work The session variable "me" I am visiting my site and its value with which I enter is "foo". So if the session variable $ _SESSION [ 'I'] == 'foo' and I must not be inserted into file.log visitors. But I do not want even the search engines are put in the logo file so I added the second part of the function
  9. Hi at all, I have to intercept search engines and my visits not to insert in the log files of my visits and countless search engine visits. I therefore made this function but it is not working and search engines continue to pass. Where is the mistake? Thank you very much <php code> function write_log() { if (!(isset($_SESSION['me']))||($_SESSION['me']!=="pippo") || (preg_match('/bot|bingbot|bing|robot|crawl|slurp|spider|yahoo|se arch/i', $_SERVER['HTTP_USER_AGENT'])==0)) {return true;}else{return false;} } if(write_log()===true) { require_once("log.php"); } </php code> I therefore I made this function but it is not working and search engines continue to pass. Where is the mistake? Thank you
  10. <code> $query="SELECT id,name FROM iml order by name"; $result = $mysqli->query($query); $_SESSION['iml']=$result; </code>
  11. Hi at all I tryed to insert full $result of a mysqli query into a session variable to can use it anyware. It work fine when I work into index.php but not into other pages that have always session_start called. Is there some thing to know about? thank you very much
  12. Hi at all, why Suddenly, after years of perfect work easter_days and easter date no longer work? Fatal error: Call to undefined function easter_date() in /public_html/ester.php on line 5 Fatal error: Call to undefined function easter_days() in /public_html/ester.php on line 6
  13. Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Host UNKNOW. in C:\xampp\htdocs\iml.phpon line 204 Warning: file_get_contents(http://www.sant.com/day.txt): failed to open stream: php_network_getaddresses: getaddrinfo failed: Host sconosciuto. in C:\xampp\htdocs\iml.php on line 204 Notice: Undefined offset: 0 in C:\xampp\htdocs\iml.php on line 211
  14. Hi at all I am using file_get_contents but if I work off line it falled (of course) How can I do to prevent fallure? Thank you very much
  15. Hi at all, please take a look to this my page: http://www.iomla.net/vocadiv/ It is a dictionary of an old dialect language. It work better into large screen and tablet also. Into smartphone it work like other devices but if you try to enter a characters into input fields keyboard cover suggestions. Please How can I transform page for little nobile layout? Thank you very much
  16. the script.php that I use now works well but at the beginning simply moved files from one directory and one of remoro server but not brought me the file locally. The mistake was that the script should be installed in a local server and not on a remote server. Now that I've installed the script in HTDOCS directory in my local XAMPP server the script works well but takes the files in the htdocs directory in the midst of the scripts .. In practice it is useless ahahahah So much work for nothing the script I use now works well at the beginning but simply moving files from one directory and one of remoro server but not brought me the file locally. The mistake was that the script should be installed in a local server and not on a remote server. Now that I've installed the script in HTDOCS directory in my local XAMPP server the script works well but takes the files in the htdocs directory in the midst of the script .. In practice it is useless ahahahah So much work for nothing
  17. Now error is this: Warning: ftp_get(C:/Users/Markus/Documents/web_sites/lands/backups/lands-20161105-1747.gz): failed to open stream: No such file or directory in /home/xyz/public_html/backups.php on line 38
  18. [10-Nov-2016 11:20:10 Europe/Berlin] PHP Warning: ftp_get(): Filename cannot be empty in /public_html/backup.php on line 28 [10-Nov-2016 11:20:10 Europe/Berlin] PHP Warning: ftp_get(): Error opening in public_html/backup.php on line 28 [10-Nov-2016 11:24:00 Europe/Berlin] PHP Warning: ftp_get(C:/Users/markus/Documents/web site/lands/backups//.): failed to open stream: No such file or directory in /public_html/backup.php on line 26 [10-Nov-2016 11:24:00 Europe/Berlin]
  19. Ok thankyou. Follow I report the new stram of my new php code that try to download files but that do not work still now: $local_dir = "C:/Users/markus/Documents/web sites/lands/backups"; $server_dir="/public_html/backups"; $contents = ftp_nlist($conn_id, $server_dir);//works fine still here foreach ($contents as $file) { if (ftp_get($conn_id, $local_dir."/".$file, $server_dir."/".$file, FTP_ASCII)) { echo " amd Successfully written to $local_file\n"; } else { echo " but There was a problem in download<br>".$server_dir."/".$file."<br>"; } } // please where is problem? is there in $local_dir name or $server_dir name?
  20. Hi at all When I make a nysql backup I memorize the files to a remote backup folder and only after I transfer them with FileZilla to my local PC. It is a long way therefore To send local files automatically I tryed a script that compresses my gz files and send the zip file to me, but after I must unzip it to an appropriate folder and it is always a long way . Therefore I am looking for a ftp script that works well. NOW I'm testing follow script but works well only until the login. but ftp_get function does not work, perhaps why the path of the local or remote file are wrong??? This is my ftp script <?php $local_file = 'C:\Users\bull\Documents\web site\town\backups'; $server_file = '/home/markus/public_html/backups'; $ftp_user="markus"; $ftp_pass="aaaaaaaaaaa"; $ftp_server="server.net.net"; // set up a connection or die $conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server"); // try to login if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) { echo "Connected as $ftp_user@$ftp_server<br> successfully"; } else { echo " connect falled as $ftp_user\n"; } //IT work very well still here only But the follow ftp_get function make error if (ftp_get($conn_id, $local_file, $server_file, FTP_ASCII)) { echo " amd Successfully written to $local_file\n"; } else { echo " but There was a problem in download<br>$conn_id<br>$local_file<br>$server_file"; } // close the connection ftp_close($conn_id); ?> IF error is remote and/or local folder name how can I do to discover right folder name because I tryed many name still now and all falled Program not display any warning
  21. Hi at all, I have a session variable called securty_level what is the best script to verify if exist and if is set to a certain value? I wrote: <?php session_start(); if (!isset($_SESSION['securty_level']) || $_SESSION['securty_level']<5) { header('Location: http:/www.goaway.com/'); exit; } ?> My script sufficiently protects?
  22. hello please take a look at this my page: http://www.iomla.net/vocadiv/ It is made with pure html. There are 2 input fields that when they receive fire waiting to be pressed a key. Every time a key is pressed is sent to the server with ajax the text and ajax returns suggestions if there are any. The page works fine on the PC desktop but works poorly on mobile devices because it is not going to wait for a key press. Why?
×
×
  • Create New...