diff --git a/php_scripts/b64img.php b/php_scripts/b64img.php new file mode 100644 index 0000000..5875c10 --- /dev/null +++ b/php_scripts/b64img.php @@ -0,0 +1,179 @@ +reasons = $reasons; + } + public function getReasons() + { + return $this->reasons; + } +} + +if (!empty($_POST['base64'])) +{ + $contents = array(); + $errors = array(); + $inputs = array(); + + $count = count($_POST['base64']); + + for ($i = 0; $i < $count; $i++) + { + $inputs[$i] = array("base64" => $_POST['base64'][$i], "name" => $_POST['names'][$i]); + } + + try + { + foreach($inputs as $input) + { + try + { + $img_decoded = base64_decode($input['base64']); + + if(empty($img_decoded)) + { + throw new DecodeException("Could not get base64 string"); + } + + if (!@imagecreatefromstring($img_decoded)) + { + throw new ImageCreateException(); + } + + $contents[] = array("decoded" => $img_decoded, "name" => $input["name"]); + } + catch (Exception $e) + { + $errors[] = $e; + } + } + + if(!empty($contents)) + { + $count = count($contents); + + if($count == 1) + { + $im = imagecreatefromstring($contents[0]["decoded"]); + + header("Content-Type: image/png"); + header("Cache-Control: no-cache, must-revalidate"); + header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); + imagepng($im); + + } + else + { + $file = tempnam("tmp", "zip"); + + $zip = new ZipArchive(); + $zip->open($file, ZipArchive::OVERWRITE); + + for($i = 0; $i < $count; $i++) + { + $filename = empty($contents[$i]["name"]) ? "image_{$i}" : $contents[$i]["name"]; + $zip->addFromString($filename . ".png", $contents[$i]["decoded"]); + } + + if(!empty($errors)) + { + $errorstring = print_r($errors, true); + + $info = "In total, " . count($errors) . " errors occurred:\r\n\r\n"; + + $info .= "- " . substr_count($errorstring, "DecodeException") . " times, decoding the string didnt work\r\n"; + $info .= "- " . substr_count($errorstring, "ImageCreateException") . " times, creating the image didnt work"; + + $zip->addFromString("errors.txt", $info); + } + + $zip->close(); + + header("Cache-Control: no-cache, must-revalidate"); + header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); + header("Content-Type: application/zip"); + header("Content-Length: " . filesize($file)); + header("Content-Disposition: attachment; filename=\"images.zip\""); + readfile($file); + + unlink($file); + } + } + else + { + throw new NoImagesException($errors); + } + } + catch (DecodeException $e) + { + echo "Could not decode the given string."; + } + catch (ImageCreateException $e) + { + echo "Could not create an image from the decoded string. The base64 string is invalid or does not contain an image."; + } + catch (NoImagesException $e) + { + echo "No images found. The following errors occurred:"; + echo "
" . print_r($e->getReasons(), true) . "
"; + } + catch (Exception $e) + { + print_r($e); + } +} +else +{ + + +echo ''; +?> + + + + + /dev/nulll - Base 64 to Image Converter + + + + + + + + +
+ +
+ 0l +

Base 64 to Image Converter

+
+ +
" method="post"> + +
+
Name (optional): +

+ +Add another input field +

+ + +
+ + + + +
+ + + + + + + + + + Keygen for CKFinder + + + + + + + +
+ +
+ 0l +

Keygen for CKFinder

+
+ +

tested successfully with version 1.4.1.1

+ +
+
+';
 }
-?>
\ No newline at end of file
+?>
+
+
+
+ + diff --git a/php_scripts/contactimg.php b/php_scripts/contactimg.php new file mode 100644 index 0000000..bdb8ff2 --- /dev/null +++ b/php_scripts/contactimg.php @@ -0,0 +1,159 @@ + array(), + "vcf" => array(), + "contact" => array()); + + for($i = 0; $i < $count; $i++) + { + $extension = getExtension($_FILES["contacts"]["name"][$i]); + + if($extension == "zip") + $files["zip"][] = $i; + elseif($extension == "contact") + $files["contact"] = $i; + elseif($extension == "vcf") + $files["vcf"][] = $i; + } + + $contents["contact"] = array(); + $contents["vcf"] = array(); + + foreach($files["contact"] as $contactfile) + { + $contents["contact"][] = file_get_contents($_FILES["contacts"]["tmp_name"][$contactfile]); + } + + foreach($files["vcf"] as $contactfile) + { + $contents["vcf"][] = file_get_contents($_FILES["contacts"]["tmp_name"][$contactfile]); + } + + + foreach($files["zip"] as $zipfile) + { + $zip = new ZipArchive(); + $zip->open($_FILES["contacts"]["tmp_name"][$zipfile]); + + for ($i = 0; $i < $zip->numFiles; $i++) + { + $extension = getExtension($zip->getNameIndex($i)); + + if($extension == "contact") + $contents["contact"][] = $zip->getFromIndex($i); + elseif($extension == "vcf") + $contents["vcf"][] = $zip->getFromIndex($i); + } + + $zip->close(); + } + + $images = array(); + + foreach($contents["contact"] as $contact) + { + $image = array(); + $image["name"] = preg_replace('=.*?(.*?).*=si',"\\1", $contact); + $image["imgb64"] = preg_replace('=.*?(.*?).*=si',"\\1", $contact); + + $images[] = $image; + } + + foreach($contents["vcf"] as $vcf) + { + preg_match_all('=FN:(.*?)\n=si', $vcf, $names); + $count = preg_match_all('=PHOTO.*?:(.*?)\n[A-Z]=si', $vcf, $imgb64s); + + for ($i = 0; $i < $count; $i++) { + $images[] = array("name" => $names[1][$i], "imgb64" => $imgb64s[1][$i]); + } + } + +?> + + + Windows Contact to Image Converter + + +
+

Windows Contact to Image Converter

+ +
+

Alright, we extracted the images from the files as base64. We now need to convert them to images. +If you do not have JavaScript, please click "Convert!" again.

+ + + + " /> + + + +
+ + + + +'; +?> + + + + + /dev/nulll - Windows Contact to Image Converter + + + + + + + +
+ +
+ 0l +

Windows Contact to Image Converter

+
+ +
" name="base" method="post" target="ifr" enctype="multipart/form-data"> +

You can either choose contact files or a zip file containing contact files.

+ +
+ +

+Add another upload field +

+ +
+ + + + + + + +
+ + +'); + + var inputs = document.getElementsByTagName('input'); + inputs[inputs.length-2].focus(); +} + +function addTextArea() +{ + addHtmlProperly(document.getElementById("basestrings"),'


Name (optional): '); + + var inputs = document.getElementsByTagName('textarea'); + inputs[inputs.length-1].focus(); +} + +function addHtmlProperly(element, html) +{ + var htmlarea = document.createElement("div"); + htmlarea.setAttribute('name', 'htmlarea'); + + element.appendChild(htmlarea); + + var areas = document.getElementsByName('htmlarea'); + areas[areas.length-1].innerHTML = html; +} + +window.onload = function() +{ + document.getElementById('focus').focus(); + + document.getElementsByTagName('iframe')[0].style.height = 0; + document.forms.base.onsubmit = checkFormFinished; +} + +var ie = (navigator.appName.indexOf("Explorer") != -1) ? true : false; +var mousemoved = 0; +var fadestep = ie ? 5 : 0.05; +var destOpacity = ie ? 100 : 1; + +window.onmousemove = function() +{ + mousemoved++; + + if (mousemoved > 5) + { + window.onmousemove = function() { }; + fadeIn(document.getElementsByTagName("footer")[0], 0); + } +} + +function fadeIn(element, opacity) +{ + if (opacity < destOpacity) + { + opacity += fadestep; + ie ? element.style.filter = "alpha(opacity=" + opacity + ")" : element.style.opacity = opacity; + + window.setTimeout(function() { fadeIn(element, opacity); }, 50); + } +} + +function checkFormFinished() +{ + imgs = parent.ifr.document.getElementsByTagName('img'); + + if (imgs.length == 0) + { + window.setTimeout("checkFormFinished()", 100); + } + else + { + document.getElementsByTagName('iframe')[0].style.height = imgs[0].clientHeight + 'px'; + } +} \ No newline at end of file diff --git a/php_scripts/style.css b/php_scripts/style.css new file mode 100644 index 0000000..b4658aa --- /dev/null +++ b/php_scripts/style.css @@ -0,0 +1,61 @@ +body { + margin: 80px 0; + font-family: sans-serif; +} + +input, select, textarea { + border: 1px solid #C3C3C3; +} + +h1 { + margin-top: 5px; + margin-bottom: 15px; +} + +#content { + margin: auto; + width: 800px; + text-align: center +} + +dl { + width: 300px; + margin: auto; +} +dt { + float: left; +} +dt a { + color: #555 +} +dd { + text-align: right; + padding-bottom: 4px +} + +table { + border-collapse: collapse; + empty-cells: show; +} + +td, th { + padding: 2px 5px 2px 5px; + border: 1px solid grey; +} + +a img { + border: 0px; +} + +footer { + opacity: 0; + alpha(opacity=0); + display: block; + margin-top: 50px; +} +iframe{ + border: 0; + height: 300px; + width: 700px; + margin: 0; +} \ No newline at end of file diff --git a/php_scripts/wake_on_lan.php b/php_scripts/wake_on_lan.php old mode 100755 new mode 100644