Jump to content

ballhogjoni

Members
  • Posts

    1,026
  • Joined

  • Last visited

Everything posted by ballhogjoni

  1. im sorry to post back, I forgot about this. I figured it out a while ago. The problem was how I was creating the array. I was using an html form to create the array. So I had something like: <input name="site[0]['domain']" /> <input name="site[1]['domain']" /> etc... So apparently this is wrong, I changed the html inputs to this: <input name="site[0][domain]" /> <input name="site[1][domain]" /> etc... notice no more single quotes around domain. This change fixed my problem.
  2. ya sorry just copied and pasted the array I was outputting to the screen via print_r
  3. Did you scroll to the bottom of the code snippet?
  4. what am I doing wrong? I have an assoc array, but I can't seem to access it. $var = Array ( 'domain' => asdfasdf.com 'port' => 2082 'adminuser' => admin 'INST_password' => adsfasdf 'adminnickname' => admin 'adminemail' => admin@asdfasdf.com 'sitename' => Play Bingo Online Austrailia 'description' => How to play bingo online in Australia 'site_root_path' => /home/chris/public_html/ 'theme' => default 'anchor_one' => How to play bingo online in Australia 'anchor_two' => play bingo 'anchor_three' => bingo online ) if( empty($var['domain']) ) exit; the code exits everytime. What am I missing?
  5. ok i figured it out...it was the timeout from curl_setopt($ch, CURLOPT_TIMEOUT, 10); I set it to 60 and now it works.
  6. Sure thing... $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://".$_POST['domain']."/wp-admin/install.php?step=2&sitename=".urlencode($_POST['sitename']) ."&adminuser=".urlencode($_POST['adminuser'])."&adminemail=".urlencode($_POST['adminemail'])."&INST_password=".urlencode($_POST['INST_password']) ."&anchor_one=".urlencode($_POST['anchor_one'])."&anchor_two=".urlencode($_POST['anchor_two']) ."&anchor_three=".urlencode($_POST['anchor_three'])."&akismet=".urlencode($_POST['akismet']) ."&theme=".urlencode($_POST['theme'])); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $resp = curl_exec($ch); This calls the second script which is over 1200 lines of code. Don't know if you need to see that or not. Here is the code when the scripts stops running. $plugins = array( array("google-sitemap-generator","google-sitemap-generator/sitemap.php"), array("xml-sitemaps-for-videos","xml-sitemaps-for-videos/video-sitemap.php"), array("si-captcha-for-wordpress","si-captcha-for-wordpress/si-captcha.php"), array("ps-auto-sitemap","ps-auto-sitemap/ps_auto_sitemap.php"), array("wp-super-cache","wp-super-cache/wp-cache.php"), array("no-self-ping","no-self-ping/no-self-pings.php"), array("login-lockdown","login-lockdown/loginlockdown.php"), array("kb-robotstxt","kb-robotstxt/kb-robots-txt.php"), array("all-in-one-seo-pack","all-in-one-seo-pack/all_in_one_seo_pack.php"), array("searchterms-tagging-2","searchterms-tagging-2/searchterms-tagging2.php"), array("seo-automatic-links","seo-automatic-links/seo-links.php"), array("si-contact-form","si-contact-form/si-contact-form.php"), array("simple-tags","simple-tags/simple-tags.php"), array("wp-minify","wp-minify/wp-minify.php"), array("jetpack","jetpack/jetpack.php"), array("wordpress-google-seo-positioner","wordpress-google-seo-positioner/position_yourself.php"), array("akismet","akismet/akismet.php"), array("redirection","redirection/redirection.php"), array("wp-missed-schedule","wp-missed-schedule/wp-missed-schedule.php"), array("better-blogroll","better-blogroll/better_blogroll.php") ); include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; //for plugins_api.. foreach($plugins as $plugin) { $api = plugins_api('plugin_information', array('slug' => $plugin[0], 'fields' => array('sections' => false) ) ); //Save on a bit of bandwidth. if ( is_wp_error($api) ) wp_die($api); $title = __('Plugin Install'); $parent_file = 'plugins.php'; $submenu_file = 'plugin-install.php'; $title = sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version ); $nonce = 'install-plugin_' . $plugin; $url = 'update.php?action=install-plugin&plugin=' . $plugin[0]; if ( isset($_GET['from']) ) $url .= '&from=' . urlencode(stripslashes($_GET['from'])); $type = 'web'; //Install plugin type, From Web or an Upload. $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) ); $upgrader->install($api->download_link); } this loop gets all the way to the akismet array and then stops. This code is lines 423-468.
  7. I have a php script that calls another script. It seems that the 2nd script times out or something. I have tried setting max_execution_time to 120 seconds. how can I fix this? I open to anything. Thanks
  8. couldn't find a fix for this and it seems as though nobody else knows. I just used curl to download the files instead of uploading them from one server to the other server. here's my code if anybody else has this problem. $newFile = "fileNameNew.php"; echo "<br>Starting<br>Target_url: http://url.com<br><br>"; // make the cURL request to $package $ch = curl_init(); $fp = fopen("$newFile", "w"); curl_setopt($ch, CURLOPT_USERAGENT,'Googlebot/2.1 (http://www.googlebot.com/bot.html)'); curl_setopt($ch, CURLOPT_URL,"http://url.com"); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_BINARYTRANSFER,true); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_FILE, $fp); $page = curl_exec($ch); if (!$page) { echo "<br />cURL error number:" .curl_errno($ch); echo "<br />cURL error:" . curl_error($ch); die(); } curl_close($ch); echo "<br>Downloaded file: $newFile"; echo "<br>Saved as file: $newFile";
  9. I am getting this error Warning: ftp_put() [function.ftp-put]: Can't open that file: Permission denied in /home/chris/public_html/site-name/wp-content/setup.php on line 62 $conn_id = ftp_connect($host, 21) or die ("Cannot connect to host"); ftp_login($conn_id, $usr, $pwd) or die("Cannot login"); // turn on passive mode transfers (some servers need this) // ftp_pasv ($conn_id, true); $upload = ftp_put($conn_id, $file[0], $file[1], FTP_ASCII); print (!$upload) ? die('Cannot upload') : 'Upload complete'; print "\n"; The permissions to the file is 0644, if I change it to 0777 ftp_put complains and says the file is not found. How can I ftp this file? What is going on? Thanks, Chris
  10. got it figured out <input(?:\s*type='hidden')?(?:\s*type='submit')?\s*name='(.*)'\s*value='(.*)'.*>
  11. I want to search the html for all the input fields in a form. I have preg_match_all("/<input\s[^>]*name=(\"??)([^\" >]*)\s[^>]*value=(\"??)([^\" >]*)\\1[^>]*>/i", $html, $matches, PREG_SET_ORDER) which somewhat works, but if the value has a space in it, preg_match_all only returns the first word. For example: <input type="hidden" name="description" value="Hello World"> preg_match_all will just return "Hello" instead of "Hello World" I hope that makes since. Thanks
  12. I am having so much trouble with this. I want to create a html table that looks like this: <table id="datatable"> <thead> <tr> <th></th> <th>test</th> <th>test 2</th> </tr> </thead> <tbody> <tr> <th>2011-03-17</th><td>1</td><td>0</td> </tr> <tr> <th>2011-03-18</th><td>3</td><td>2</td> </tr> <tr> <th>2011-03-19</th><td>1</td><td>0</td> </tr> </tbody> </table> out of this mysql result: opens | name | date 1 | test | 2011-03-17 3 | test | 2011-03-18 2 | test 2 | 2011-03-18 1 | test 2 | 2011-03-19 Here is my mysql code: SELECT count( o.campaign_id ) AS opens, c.name, date(o.created_at) as date FROM opens o LEFT JOIN campaigns c ON c.id = o.campaign_id WHERE (o.created_at between '2011-03-17 00:00:00' and '2011-03-19 23:59:59') GROUP BY date,c.name I also attached a sql dump of my database. [attachment deleted by admin]
  13. How do I skip to the next index in a foreach loop? I've tried the following: foreach($c as $val){ if(1==1){ next; } echo "HI" } In the code above it still echos HI How do I fix this?
  14. Array ( [game] => Array ( [id] => 2011012593950636050 [name] => Array ( [us] => Castlevania II: Belmont's Revenge [uk] => Castlevania II: Belmont's Revenge ) echo print_r($this->game[0]['name']) but undefined offset error. I don't want to loop through the first array either. Thanks
  15. I have this code that compares date times but im not sure if its correct. if("2008-08-10 00:00:00.0" > strtotime("now")) { echo "here"; } The code echo's here, but it shouldn't because the time is less than the current time. Any ideas?
  16. I have this SimpleXMLElement Object and I can't echo out any attribute. In this example I am only showing you one SimpleXMLElement Object of the entire result set just for brevity. Here is the code that loops through the results: foreach($oXML->links->link as $o){ echo "<pre>";print_r($o);echo "</pre>"; } SimpleXMLElement Object ( [advertiser-id] => 2860239 [advertiser-name] => Amber Alert GPS [category] => Array ( [0] => children [1] => children ) [click-commission] => Array ( [0] => 0.0 [1] => 0.0 ) [creative-height] => Array ( [0] => 0 [1] => 0 ) [creative-width] => Array ( [0] => 0 [1] => 0 ) [language] => en [lead-commission] => SimpleXMLElement Object ( ) [link-code-html] => "Hey Mom! Please Don't Lose Me Again." Use Promo Code "Amber2" To Get 20% Off New GPS Child Tracking Device! [link-code-javascript] => "Hey Mom! Please Don't Lose Me Again." Use Promo Code "Amber2" To Get 20% Off New GPS Child Tracking Device! [description] => 20% discount of Amber Alert GPS Child Locator Device when using "Amber2" Promo Code. [destination] => http://www.amberalertgps.com [link-id] => 10745524 [link-name] => "Hey Mom! Please Don't Lose Me Again." Use Promo Code "Amber2" To Get 20% Off New GPS Child Tracking Device! [link-type] => Text Link [performance-incentive] => false [promotion-end-date] => SimpleXMLElement Object ( ) [promotion-start-date] => SimpleXMLElement Object ( ) [promotion-type] => coupon [relationship-status] => joined [sale-commission] => 30.00% [seven-day-epc] => N/A [three-month-epc] => 2.66 ) I try to do this but it doesn't work: foreach($oXML->links->link as $o){ echo $o['advertiser-id']; } # I also tried this: foreach($oXML->links->link as $o){ echo $o->advertiser-id; } How do you echo the values?
  17. ya i figured out what is going on...$this->Component is an instance of another class hidden in another library. I didn't check how $this was created. Thanks
  18. i can't I went to the class and looked. I guess my statement is misleading. sorry
  19. I have this line of code in a function but I can't figure out what its doing. $this->Component->init($this); when I print_r($this->Component); i get Component Object ( [__controllerVars] => Array ( [plugin] => [name] => [base] => ) [_loaded] => Array ( ) [_primary] => Array ( ) [__settings] => Array ( ) [_log] => ) There is no init method or object in the Component Object as you can see, so I am lost. Any ideas? Thanks
  20. Thanks, thats what I thougt, this solves it!
  21. I am running php 5.3.2 on my local dev and on the server I am running php 5.2.5. In my log files I keep getting deprecated messages like: PHP Deprecated: Assigning the return value of new by reference is deprecated in /Users/xxx/dev/git/xxx/cake/dispatcher.php on line 677 Can I just delete & to get rid of this message or will that hose the script locally and on the server? I believe that php 5+ passes all objects as reference. Thanks
  22. thanks for the help thehippy I saw this $this->log("Hello World."); in the docs but couldn't ever get it to log. This is on of the major reasons for this thread. I add this on the first line of the __construct function to the dispatcher class, I tail app/tmp/logs/*.log (error.log and debug.log) and I don't get any output. What am I missing? Thanks
  23. how do you use it? I've read the docs and have implemented it or so I thought. Also, will you show me how to enable both?
×
×
  • 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.