Advertisement
Guest User

Francis

a guest
Dec 23rd, 2009
1,314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.26 KB | None | 0 0
  1. <?php
  2. /*
  3. /* Auteur : Mr Xhark
  4. /* URL : http://blogmotion.fr
  5. /* Contact : blogmotion@gmail.com
  6. /* Version : 1.1, rel. 21/12/2009
  7. /* Licence : Creative Commons
  8. /* http://creativecommons.org/licenses/by-nc-sa/2.0/fr/
  9. */
  10. ?>
  11. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  12. <html xmlns="http://www.w3.org/1999/xhtml">
  13. <head>
  14. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  15. <title>Goo.gl generator</title>
  16. <style type="text/css">
  17. <!--
  18. body { font-family:'Lucida Grande',Verdana,'Lucida Sans Regular','Lucida Sans Unicode','Arial','sans-serif'; }
  19. .bloc { margin-left:auto;margin-right:auto; }
  20. -->
  21. </style>
  22. </head>
  23. <body>
  24. <div class="bloc">
  25. <form id="blogmotion.fr" name="blogmotion.fr" method="post" action="">
  26.   <label>
  27.     URL :
  28.     <input name="url" type="text" id="url" value="<?php if ( !empty($_POST['url']) ) echo htmlspecialchars($_POST['url'], ENT_QUOTES); ?>" style="width:258px" />
  29.   </label>
  30.   <?php
  31. require_once('recaptchalib.php');
  32. $publickey  = 'votre_cle_publique_ici';
  33. $privatekey = 'votre_cle_privee_ici';
  34. echo recaptcha_get_html($publickey); ?>
  35.   <label>
  36.     <input type="submit" name="button" id="button" value="Goo.gliser" style="width:315px" />
  37.   </label>
  38. </form>
  39. <?php
  40. if ( isset($_POST["recaptcha_response_field"]) ) {
  41.     $resp = recaptcha_check_answer ($privatekey,
  42.                                     $_SERVER["REMOTE_ADDR"],
  43.                                     $_POST["recaptcha_challenge_field"],
  44.                                     $_POST["recaptcha_response_field"]);
  45.     # captcha incorrect
  46.     if (!$resp->is_valid) {
  47.       die ("<strong>Le code de scurit est invalide. Merci d'essayer nouveau" .
  48.            "<br />(reCAPTCHA dit: " . $resp->error . ")</strong>");
  49.     }
  50.     # captcha correct
  51.     $obj = json_decode(file_get_contents('http://ggl-shortener.appspot.com/?url=' . urlencode($_POST['url'])));
  52.     $url_goo = $obj->{'short_url'};
  53.     echo '<br />' . htmlspecialchars($_POST['url'], ENT_QUOTES) . ' (url source)';
  54.     echo '<br /><input type="text" value="' . $url_goo . '"/> (url compresse)';
  55. } // POST
  56. ?>
  57. <br  /><br  />
  58. Script by Mr Xhark : <a href="http://blogmotion.fr" title="Blogmotion">Blogmotion.fr</a><br />
  59. Modified by Francis Besset : <a href="http://www.apercite.fr" title="Apercite">Apercite.fr</a>
  60. </div>
  61. </body>
  62. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement