Advertisement
Guest User

Untitled

a guest
May 7th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.31 KB | None | 0 0
  1. <?php
  2.     ini_set('display_errors','on');
  3.     error_reporting(32767);
  4.    
  5.     // Set your database information here
  6.     $db_host = 'localhost';
  7.     $db_user = 'user';
  8.     $db_pass = 'pass';
  9.     $db_name = 'name';
  10. ?>
  11. <html>
  12.     <head>
  13.         <title>Bulk Add</title>
  14.         <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  15.         <script language=javascript>
  16.             //self.moveTo(0,0);self.resizeTo(screen.availWidth,screen.availHeight)
  17.         </script>
  18.         <style type="text/css">
  19.             td      {font-family: Verdana; font-size:12px}
  20.             a       {color:#000000; text-decoration:underline}
  21.             a:hover {color:#FF0000; text-decoration:underline}
  22.             .style1 {color: #FF0000}
  23.         </style>
  24.     </head>
  25.     <body>
  26.     <div align="center">
  27.         <?php include ("/top.php"); ?>
  28.     </div>
  29.     <div align="center">
  30.         <?php
  31.             @mysql_connect($db_host,$db_user,$db_pass) or die(mysql_error());
  32.             @mysql_select_db($db_name) or die(mysql_error());
  33.             if(isset($_POST['submit1'])) {
  34.                 if(isset($_POST['links'])) {
  35.                     $links = explode("\n",$_POST['links']);
  36.             ?>
  37.                 <form action="" method="post">
  38.                     <?php
  39.                         setlocale(LC_TIME,'nl_NL');
  40.                         ini_set('date.timezone','nl_NL');
  41.                         $datum = strftime("%D");
  42.                         foreach($links as $linki => $link) {
  43.                     ?>
  44.                         <div align="center" style="width: 800px;">
  45.                             <strong>Datum</strong><br />
  46.                             <input type="text" name="links[<?php print $linki; ?>][datum]" size="150" value="<?php print $datum ?>" /><br /><br />
  47.                             <strong>Soort</strong><br />
  48.                             <select name="links[<?php print $linki; ?>][soort]">
  49.                                 <option value="films">films</option>
  50.                                 <option value="fotoserie">fotoserie</option>
  51.                                 <option value="aanrader">aanrader</option>
  52.                             </select><br /><br />
  53.                             <strong>Niche</strong><br />
  54.                             <input type="text" name="links[<?php print $linki; ?>][niche]" size="150" /><br /><br />
  55.                             <strong>Link</strong><br />
  56.                             <input type="text" name="links[<?php print $linki; ?>][link]" size="150" value="<?php print $link; ?>" /><br /><br />
  57.                             <strong>tekst</strong><br />
  58.                             <input type="text" name="links[<?php print $linki; ?>][tekst]" size="150" maxlength="150" />
  59.                         </div>
  60.                         <hr />
  61.                     <?php
  62.                         }
  63.                         print '<input type="submit" name="submit2" value="Finish >>"';
  64.                     ?>
  65.                 </form>
  66.             <?php
  67.                 }
  68.                 else {
  69.                     print 'Wtf?';
  70.                 }
  71.             }
  72.             elseif(isset($_POST['submit2'])) {
  73.                 if(isset($_POST['links'])) {
  74.                     foreach($_POST['links'] as $link_arrayi => $link_array) {
  75.                         foreach($link_array as $key => $value) {
  76.                             $link_array[$key] = mysql_real_escape_string($value);
  77.                         }
  78.                         $link = mysql_real_escape_string($link_array['link']);
  79.                         $datum = mysql_real_escape_string($link_array['datum']);
  80.                         $soort = mysql_real_escape_string($link_array['soort']);
  81.                         $niche = mysql_real_escape_string($link_array['niche']);
  82.                         $tekst = mysql_real_escape_string($link_array['tekst']);
  83.                         $query = 'INSERT INTO bertus (datum,soort,niche,link,tekst) VALUES("' . $datum . '","' . $soort . '","' . $niche . '","' . $link . '","' . $tekst . '")';
  84.                         if(@mysql_query($query)) {
  85.                     ?>
  86.                         <form action="" method="post">
  87.                             <div align="center" style="width: 800px;">
  88.                                 <strong>Links</strong><br />
  89.                                 <span style="font-size: 7;">Separate links with a new line</span><br />
  90.                                 <textarea width="600px" height="200px" name="links"></textarea>
  91.                             </div>
  92.                             <div align="right">
  93.                                 <input type="submit" name="submit1" value="Next >>" />
  94.                             </div>
  95.                         </form>
  96.                         <hr />
  97.                     <?php
  98.                             print '<hr /><h4>' . $datum . '<br />';
  99.                             print $soort . '<br />';
  100.                             print $niche . '<br />';
  101.                             print $link . '<br />';
  102.                             print $tekst . '<br /></h4>';
  103.                         }
  104.                         else {
  105.                             print mysql_error();
  106.                         }
  107.                     }
  108.                 }
  109.                 else {
  110.                     print 'Wtf?';
  111.                 }
  112.             }
  113.             else {
  114.         ?>
  115.             <form action="" method="post">
  116.                 <div align="center" style="width: 800px;">
  117.                     <strong>Links</strong><br />
  118.                     <span style="font-size: 7;">Separate links with a new line</span><br />
  119.                     <textarea width="600px" height="200px" name="links"></textarea>
  120.                 </div>
  121.                 <div align="right">
  122.                     <input type="submit" name="submit1" value="Next >>" />
  123.                 </div>
  124.             </form>
  125.         <?php
  126.             }
  127.         ?>
  128.     </div>
  129.     <div align="center">
  130.         <?php include("/under.php"); ?>
  131.     </div>
  132. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement