From f3d465e9e43f5417f81f8988e12ec9466f0e46be Mon Sep 17 00:00:00 2001 From: Banana Date: Fri, 10 Jun 2011 16:36:21 +0200 Subject: [PATCH] updated the bookmark script --- bookmarks/createMirror.php | 37 ++++++++++++++++++++++++++++++++ bookmarks/index.php | 43 ++++++++++++++++++++++++++++++++------ 2 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 bookmarks/createMirror.php diff --git a/bookmarks/createMirror.php b/bookmarks/createMirror.php new file mode 100644 index 0000000..a294d51 --- /dev/null +++ b/bookmarks/createMirror.php @@ -0,0 +1,37 @@ +&2 > /dev/null &'; + $run = exec($command); +} +?> \ No newline at end of file diff --git a/bookmarks/index.php b/bookmarks/index.php index 4348c63..5580afb 100644 --- a/bookmarks/index.php +++ b/bookmarks/index.php @@ -28,12 +28,37 @@ if(isset($_POST['sub']['submitNew'])) { $title = trim($_POST['new']['title']); $cat = trim($_POST['new']['category']); if(!empty($link) && !empty($title) && !empty($cat)) { - $query = mysql_query("INSERT INTO `bookmarks` - SET `category` = '".mysql_escape_string($cat)."', - `title` = '".mysql_escape_string($title)."', - `link` = '".mysql_escape_string($link)."', - `date_added` = '".time()."'"); + $mir = '0'; + if(isset($_POST['new']['mirror']) && $_POST['new']['mirror'] == "yes") { + $mir = '1'; + } + $query = mysql_query("INSERT INTO `bookmarks` + SET `category` = '".mysql_real_escape_string($cat)."', + `title` = '".mysql_real_escape_string($title)."', + `link` = '".mysql_real_escape_string($link)."', + `date_added` = '".time()."', + `mirror` = '".mysql_real_escape_string($mir)."'"); if($query !== false) { + if($mir === "1") { + // we want a mirror + $insertID = mysql_insert_id(); + if(!empty($insertID)) { + $postfields['link'] = $link; + $postfields['saveTo'] = $insertID; + // do the curl call to trigger the mirror creation + # this way "avaoid" any wayting time + $ch = curl_init("http://www.tld.de/createMirror.php"); + curl_setopt($ch, CURLOPT_POST, 1); // we use POST + curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); + curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0"); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + # use this if you protect the script with htaccess + curl_setopt($ch, CURLOPT_USERPWD, 'username:password'); + $cResult = curl_exec($ch); + curl_close($ch); + } + } + header("Location: index.php"); } else { @@ -100,6 +125,8 @@ if(mysql_num_rows($query) > 0) {
Kategorie:

+
+ Httrack Mirror anlegen.
0) { echo ''; } -- 2.39.5