Jump to content

ballhogjoni

Members
  • Posts

    1,026
  • Joined

  • Last visited

Everything posted by ballhogjoni

  1. thanks but the key can be either p, q or qt or a combination of the three.
  2. I have this regex /http:\/\/(.*?)\/.*?\?.*?&?(?|q|qt)=([^&=]{2,}?)(?:&|$)/ I am trying to get the keyword from the url like http://search.yahoo.com/search;_ylt=A0WTfYQKqWlO.FYA2CibvZx4?fr=yfp-t-701-s&toggle=1&cop=mss&ei=UTF8&p=keyword my problem is that its getting the value for the key cop. I need to get the value of the key p. Any ideas? thanks
  3. I think the better question is, what is your ultimate goal with this process? Browsers choose not to display output buffer on their own and hold it to the end in an attempt to cache. Chrome is crazy with caching, I have not worked with FF5 much but I am sure it is heading that way as well. If you let us know what your goal is, I think we will be able to help more. I am on mac osx and my goal is to display to the user (my self) where I'm at within the script. My script runs for about 10 seconds do many things IE installing file, unzipping them, creating mysql tables, adding data to those tables, etc... I would like to see that the script is uploading a file, then when it unzips it, I would like to see that. I would like to see when the script install the tables and then see when it adds data to the tables. I hope that made sense.
  4. requinix, that doesn't work for me, i tried it in chrome and ff 5
  5. I have looked at ob_start, ob_get_contents, etc.. but I can't get it to work. My code looks like this: ob_start(); echo "starting"; ob_flush(); //do some stuff echo "something else" ob_flush(); //do some stuff echo "something else" ob_flush(); The echoes are only shown at the end of the script execution.
  6. I got it...first i was trying to copy a php file...thats a no no or atleast with the <?php tag. my fix and what is working: $output=""; $file = fopen($create_mysql_db_url, "r"); while(!feof($file)) { //read file line by line into variable $output = $output . fgets($file, 4096); } fclose ($file); $userFileName = $_POST['mysqluser'] . time() . ".php.txt"; $file = fopen($userFileName, "w+"); $output = preg_replace("/###USERNAME###/", $_POST['mysqluser'], $output); $output = preg_replace("/###PASSWORD###/", $_POST['mysqlpass'], $output); fputs($file, "<?php" . $output); fclose ($file);
  7. saving the contents to the var. its like the file pointer is at the end of the file or something weird.
  8. I need some help...I want to read the contents of a file into a variable and then insert/write that content into another file. $handle = fopen($create_mysql_db_url, "rb"); $contents = fread($handle, filesize($create_mysql_db_url)); fclose($handle); $userFileName = $_POST['mysqluser'] . time() . ".php.txt"; $fhandle = fopen($userFileName,"wb"); fwrite($fhandle, $contents); fclose($fhandle); $fh = fopen($userFileName,"wb"); $contents = fread($fh, filesize($userFileName)); $content = preg_replace("/###USERNAME###/", $_POST['mysqluser'], $contents); $content = preg_replace("/###PASSWORD###/", $_POST['mysqlpass'], $content); fwrite($fh, $content); fclose($fh); please help :-\
  9. ok nevermind the problem was me. I was ftping the zip as ascii instead of binary. Once i made this change all worked just fine. final script: <?php require('pclzip.lib.php'); $archive = new PclZip('wordpress-3.2.1.zip'); if ($archive->extract() == 0) { die("Error : ".$archive->errorInfo(true)); } else { unlink('wordpress-3.2.1.zip'); }
  10. I need a script that will unzip a file. I can't use ziparchive class because its not installed. ive tried the pclzip.lib.php. I am trying to unzip wordpress-3.2.1.zip using php.
  11. I found this class online that looks like it should work. I have googled quite a bit on how to get this to work, but I can't find anything. All the discussions on google are a couple years old. <?php class cPanel { var $cPanelUser = ""; var $cPanelPass = ""; var $cPanelDomain = ""; var $cPanelPort = 0; var $cPanelRel = ""; var $cPanelRoot = ""; function cPanel($cPanelDomain, $cPanelPort, $authUser, $authPass) { $this->cPanelDomain = $cPanelDomain; $this->cPanelPort = $cPanelPort; $this->cPanelUser = $authUser; $this->cPanelPass = $authPass; //Root path of cPanel to load pages begining with / $this->cPanelRoot = "http".($this->cPanelPort==2083 ? "s" : "")."://".$this->cPanelDomain.":".$this->cPanelPort."/"; //Relative path of cPanel to load pages not begining with / $this->cPanelRel = $this->cPanelRoot.""; } function fetchPage($cPanelPage, $sPostVars = "") { $ch = curl_init(); $loginf = sprintf("%s:%s", $this->cPanelUser, $this->cPanelPass); //Build the path. If it begins with / we go and paste at root if ($cPanelPage[0] == '/') { $url = $this->cPanelRoot.substr($cPanelPage, 1); } else { //Build the path - if begins with / we go and paste relative $url = $this->cPanelRel.$cPanelPage; } curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_POST, true); curl_setopt ($ch, CURLOPT_POSTFIELDS, $sPostVars); // curl_setopt ($curl, CURLOPT_TIMEOUT, 30); // curl_setopt ($curl, CURLOPT_USERAGENT, sprintf("Mozilla/%d.0",rand(4,5))); // curl_setopt ($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0); // curl_setopt ($curl, CURLOPT_SSL_VERIFYHOST, 0); // curl_setopt ($curl, CURLOPT_FAILONERROR, 0); echo $loginf; echo $url."?".$sPostVars; curl_setopt ($ch, CURLOPT_USERPWD, $loginf); curl_setopt ($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); $result = curl_exec ($ch); echo 'Errors: ' . curl_errno($ch) . ' ' . curl_error($ch) . '<br><br>'; curl_close ($ch); return $result; } }
  12. more looking into it, i was looking at one of my sitemaps and it produced the following output: Fatal Error (hide) The theme has encountered a problem that it cannot recover from. Please use the following information to try to resolve the problem. Error Code: php_code_error:1:/home/name/public_html/wp-content/plugins/w3-total-cache/lib/W3/Cache/Memcached.php:75:Allowed memory size of 67108864 bytes exhausted (tried to allocate 44 bytes) Message: A fatal code error occurred. If you are unable to fix this problem, please copy all the text on this screen and send it to support@ithemes.com. Debug Data: Array ( [0] => Array ( [file] => /home/name/public_html/wp-content/plugins/tabber-widget/lib/classes/it-error.php [line] => 123 [function] => fatal [class] => ITError [type] => :: [args] => Array ( [0] => php_code_error:1:/home/name/public_html/wp-content/plugins/w3-total-cache/lib/W3/Cache/Memcached.php:75:Allowed memory size of 67108864 bytes exhausted (tried to allocate 44 bytes) [1] => A fatal code error occurred. ) ) [1] => Array ( [file] => /home/name/public_html/wp-content/plugins/tabber-widget/lib/classes/it-error.php [line] => 150 [function] => handle_error [class] => ITError [type] => :: [args] => Array ( [0] => 1 [1] => Allowed memory size of 67108864 bytes exhausted (tried to allocate 44 bytes) [2] => /home/name/public_html/wp-content/plugins/w3-total-cache/lib/W3/Cache/Memcached.php [3] => 75 ) ) [2] => Array ( [function] => it_error_shutdown [args] => Array ( ) ) ) so now I don't know if its w3 total cache, tabber widget, or memcached what pisses me off is that i changed the php.ini file to accept 256M for memory limit.
  13. I looked into mysql_unbuffered_query, can't find a way to integrate that into the script without modifying the wordpress database class. don't really want to do that, because if wordpress pushes an update, then my changes could be overwritten.
  14. I echoed out the table being used in the query and I get three table, or atleast the ones i saw on the page. when I go to a post i see these tables being used: wp_commentmeta, wp_postmeta, wp_usermeta They seem to be used quite a bit because I see them all over the page. FYI the size of the tables: wp_commentmeta = 134.3 MiB, wp_postmeta = 8.7 MiB, wp_usermeta = 72.5 KiB Also all the tables in my db are myisam, should I change them to innodb?
  15. These are all very good questions, this is wordpress, i didn't write the code so I don't really know the answer unless I annoy my users with echoing out errors. That being said should I just raise the memory limit or is that just a band-aid?
  16. I see that in the notes section now, just didn't scroll down.
  17. I have a wordpress site that has this error in my error logs and seems to be causing the site to load very slow: PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 64 bytes) in /home/name/public_html/wp-includes/meta.php on line 339 this is line 339: $cache[$mpid][$mkey] = array(); a couple line above and below: if ( !empty($meta_list) ) { foreach ( $meta_list as $metarow) { $mpid = intval($metarow[$column]); $mkey = $metarow['meta_key']; $mval = $metarow['meta_value']; // Force subkeys to be array type: if ( !isset($cache[$mpid]) || !is_array($cache[$mpid]) ) $cache[$mpid] = array(); if ( !isset($cache[$mpid][$mkey]) || !is_array($cache[$mpid][$mkey]) ) $cache[$mpid][$mkey] = array(); // Add a value to the current pid/key: $cache[$mpid][$mkey][] = $mval; } } Can some please help this is causing major issues.
  18. I noticed eregi is deprecated, what would I use instead?
  19. I noticed that if I remove the s in files both in the url and the rewrite rule it works. is that all about?
  20. I used to be able to download files like this one, but as you can see i get a 403 forbidden. http://uploadshack.us/files/OThkMy4E1312990602.html My .htaccess file looks like this: RewriteEngine On RewriteRule ^files/(.*).html$ /download.php?file_id=$1 [L] Permissions on download.php is 644. What is wrong with that?
  21. I did write some of it. It used to work as of Sunday (a few days ago). The problem is this line if (eregi('fmt_url_map',$file_contents)) it no longer finds the match. This leads me to believe that Youtube changed something on their site. I am not looking for a rewrite of the class, I am looking to see if anyone has knowledge of the change and how to fix this line/function in the class to make it work again.
  22. Hey all I was using this class to download and convert my youtube videos. <?php // Conversion Class class YouTubeToMp3Converter { // Private Fields private $_songFileName = ''; private $_flvUrl = ''; private $_audioQualities = array(64, 128, 320); private $_tempVidFileName; private $_vidSrcTypes = array('source_code', 'url'); // Constants const _TEMPVIDDIR = 'videos/'; const _SONGFILEDIR = 'mp3/'; //const _FFMPEG = 'nice -n 20 /usr/bin/ffmpeg'; const _FFMPEG = '/usr/bin/ffmpeg'; #region Public Methods function __construct() { } function CheckDownloadCount(){ require("../get_video_ads/Database.class.php"); $db = new Database(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE); $db->connect(); $ip = addslashes($_SERVER['REMOTE_ADDR']); $sql = sprintf("SELECT count(*) c FROM downloaded WHERE ipadress = '%s' and last_access between '".date('Y-m-d')." 00:00:00' and '".date('Y-m-d')." 23:59:59' ORDER BY last_access DESC", $ip); $count = $db->query_first($sql); if ($count[c] > 7) { $db->close(); return false; }else{ $db->query_insert('downloaded', array("ipadress" => $ip)); $db->close(); } return true; } function DownloadVideo($youTubeUrl) { $file_contents = file_get_contents($youTubeUrl); if ($file_contents !== false && !empty($file_contents)) { $this->SetSongFileName($file_contents); if( file_exists( $this->_songFileName ) ) { return true; }else{ $this->SetFlvUrl($file_contents); if ($this->GetSongFileName() != '' && $this->GetFlvUrl() != '') { echo $this->GetFlvUrl(); return $this->SaveVideo($this->GetFlvUrl()); } } } return false; } function GenerateMP3($audioQuality) { $qualities = $this->GetAudioQualities(); $quality = (in_array($audioQuality, $qualities)) ? $audioQuality : $qualities[1]; $exec_string = self::_FFMPEG.' -i '.$this->GetTempVidFileName().' -ab '.$quality.'k '.$this->GetSongFileName(); exec($exec_string); $this->DeleteTempVid(); return is_file($this->GetSongFileName()); } function ExtractSongTrackName($vidSrc, $srcType) { $name = ''; $vidSrcTypes = $this->GetVidSrcTypes(); if (in_array($srcType, $vidSrcTypes) && !empty($vidSrc)) { $vidSrc = ($srcType == $vidSrcTypes[1]) ? file_get_contents($vidSrc) : $vidSrc; if ($vidSrc !== false && eregi('eow-title',$vidSrc)) { $name = end(explode('eow-title',$vidSrc)); $name = current(explode('">',$name)); $name = ereg_replace('[^-_a-zA-Z,"\' :0-9]',"",end(explode('title="',$name))); } } return $name; } #endregion #region Private "Helper" Methods private function SaveVideo($url) { $this->SetTempVidFileName(time()); $file = fopen($this->GetTempVidFileName(), 'w'); $ch = curl_init(); curl_setopt($ch, CURLOPT_FILE, $file); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIE); curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE); curl_exec($ch); curl_close($ch); fclose($file); return is_file($this->GetTempVidFileName()); } private function DeleteTempVid() { if (is_file($this->GetTempVidFileName())) { unlink($this->GetTempVidFileName()); } } #endregion #region Properties public function GetSongFileName() { return $this->_songFileName; } private function SetSongFileName($file_contents) { $vidSrcTypes = $this->GetVidSrcTypes(); $trackName = $this->ExtractSongTrackName($file_contents, $vidSrcTypes[0]); $this->_songFileName = (!empty($trackName)) ? self::_SONGFILEDIR . preg_replace('/_{2,}/','_',preg_replace('/ /','_',preg_replace('/[^A-Za-z0-9 _-]/','',$trackName))) . '.mp3' : ''; } public function GetFlvUrl() { return $this->_flvUrl; } private function SetFlvUrl($file_contents) { $vidUrl = ''; if (eregi('fmt_url_map',$file_contents)) { echo "HERE"; $vidUrl = end(explode('fmt_url_map=',$file_contents)); $vidUrl = current(explode('&',$vidUrl)); $vidUrl = current(explode('%2C',$vidUrl)); $vidUrl = urldecode(end(explode('%7C',$vidUrl))); } $this->_flvUrl = $vidUrl."&hd=0"; } public function GetAudioQualities() { return $this->_audioQualities; } private function GetTempVidFileName() { return $this->_tempVidFileName; } private function SetTempVidFileName($timestamp) { $this->_tempVidFileName = self::_TEMPVIDDIR . $timestamp .'.flv'; } public function GetVidSrcTypes() { return $this->_vidSrcTypes; } #endregion } It seems as though youtube changed something, so now I can't download the videos anymore. It has something to do with the SetFlvUrl function. I think they changed the embed code or something that grabs the actual video url. Any ideas?
  23. I have this wonderful php class that used to let me login into cpanel and call any path I wanted. Now its broken: <?php class cPanel { var $cPanelUser = ""; var $cPanelPass = ""; var $cPanelDomain = ""; var $cPanelPort = 0; var $cPanelRel = ""; var $cPanelRoot = ""; function cPanel($cPanelDomain, $cPanelPort, $authUser, $authPass) { $this->cPanelDomain = $cPanelDomain; $this->cPanelPort = $cPanelPort; $this->cPanelUser = $authUser; $this->cPanelPass = $authPass; //Root path of cPanel to load pages begining with / $this->cPanelRoot = "http".($this->cPanelPort==2083 ? "s" : "")."://".$this->cPanelDomain.":".$this->cPanelPort."/frontend/x3/"; //Relative path of cPanel to load pages not begining with / $this->cPanelRel = $this->cPanelRoot.""; } function fetchPage($cPanelPage, $sPostVars = "") { $curl = curl_init(); $loginf = sprintf("%s:%s", $this->cPanelUser, $this->cPanelPass); //Build the path. If it begins with / we go and paste at root if ($cPanelPage[0] == '/') { $url = $this->cPanelRoot.substr($cPanelPage, 1); } else { //Build the path - if begins with / we go and paste relative $url = $this->cPanelRel.$cPanelPage; } curl_setopt ($curl, CURLOPT_URL, $url."?".$sPostVars); curl_setopt ($curl, CURLOPT_TIMEOUT, 30); curl_setopt ($curl, CURLOPT_USERAGENT, sprintf("Mozilla/%d.0",rand(4,5))); curl_setopt ($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt ($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt ($curl, CURLOPT_FAILONERROR, 0); curl_setopt ($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt ($curl, CURLOPT_USERPWD, $loginf); $html = curl_exec ($curl); echo 'Errors: ' . curl_errno($curl) . ' ' . curl_error($curl) . '<br><br>'; echo $html; curl_close ($curl); //print_r($url); return $html; } } I am using this script on one server and calling trying to login on another server and run a fastastico script. This is the error output: Errors: 7 couldn't connect to host I've checked the username and password multiple times. Any ideas why this wouldn't work?
  24. Im not looking for any services I have to pay for, I just want to know the algorithm and how to decode them by hand. This is for my own learning, not to steal anybodies code.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.