pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

PHP pastebin - collaborative debugging tool View Help


Posted by Julien - Cahri on Mon 13 Oct 12:47
report abuse | download | new post

  1. <?php echo '<'.'?xml version="1.0" encoding="UTF-8"?'.'>'; ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr"
  5. lang="fr">
  6. <head>
  7.         <title>i974^6 : Démo</title>
  8.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  9.         <style type="text/css">
  10.                 @import url(style.css);
  11.         </style>
  12. </head>
  13. <body>
  14.  
  15. <?php
  16.  
  17.         if (count($_POST)) {
  18.  
  19.                 /* Constantes à modifier */
  20.                 define('GOOGLE_ACCT', 'user@gmail.com'); // e-mail
  21.                 define('GOOGLE_PASS', 'password'); // mot de passe
  22.                 define('GOOGLE_SPREADSHEET_KEY', 'pNbF52sa_1RqDqKkHnUHbQA'); // clé du document
  23.                 define('GOOGLE_WORKSHEET_ID', 'od6'); // id de la feuille
  24.                
  25.                 require_once 'Zend/Loader.php';
  26.                
  27.                 Zend_Loader::loadClass('Zend_Gdata');
  28.                 Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
  29.                 Zend_Loader::loadClass('Zend_Gdata_Docs');
  30.                 Zend_Loader::loadClass('Zend_Gdata_Spreadsheets');
  31.                
  32.                 try {
  33.                         $service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
  34.                         $client = Zend_Gdata_ClientLogin::getHttpClient(GOOGLE_ACCT, GOOGLE_PASS, $service);
  35.                 } catch (Exception $e) {
  36.                         $error = '<p><strong>Erreur :</strong> Connexion à Google Spreadsheets.</p>';
  37.                 }
  38.                
  39.                 if ($client) {
  40.                         $spreadsheetService = new Zend_Gdata_Spreadsheets($client);
  41.                        
  42.                         try {
  43.                                 /* Insertion des données */
  44.                                 $data = array(
  45.                                         'prenom' => $_POST['prenom'],
  46.                                         'nom' => $_POST['nom'],
  47.                                         'adresse' => $_POST['adresse'],
  48.                                         'codepostal' => $_POST['codepostal'],
  49.                                         'ville' => $_POST['ville'],
  50.                                         'commentaires' => 'Inscription Internet le '.date('d/m/Y')
  51.                                 );
  52.                                 $spreadsheetService->insertRow($data, GOOGLE_SPREADSHEET_KEY, GOOGLE_WORKSHEET_ID);
  53.                         } catch (Exception $e) {
  54.                                 $error = '<p><strong>Erreur :</strong> Insertion impossible.</p>';
  55.                 }
  56.                 }
  57.                
  58.                 if (isset($error))
  59.                         echo $error;
  60.                 else
  61.                 echo '<p>Vos données ont bien été ajoutées.</p>';
  62.        
  63.         } else {
  64.        
  65. ?>
  66.  
  67. <p>Veuillez remplir le formulaire ci-dessous :</p>
  68.  
  69. <form method="post" action="index.php">
  70.  
  71.         <p><label>Nom</label> <input type="text" name="nom" /></p>
  72.        
  73.         <p><label>Prénom</label> <input type="text" name="prenom" /></p>
  74.        
  75.         <p><label>Adresse</label> <input type="text" name="adresse" /></p>
  76.        
  77.         <p><label>Code postal</label> <input type="text" name="codepostal" /></p>
  78.        
  79.         <p><label>Ville</label> <input type="text" name="ville" /></p>
  80.        
  81.         <p><input type="submit" value="Enregistrer" /></p>
  82.  
  83. </form>
  84.  
  85. <?php } ?>
  86. </body>
  87. </html>

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post