Guest User

Untitled

a guest
Jan 16th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. <script>
  2.     var title = '&';
  3.     window.location.href = "process_article_selection.php?&title=" + encodeURIComponent(title);
  4. </script>
  5.  
  6. <?php
  7.  
  8.     $passed_title = htmlspecialchars(isset($_GET['title']) ? $_GET['title'] : '', ENT_QUOTES);
  9.     $string = substr($passed_title,0,64);
  10.    
  11.     if ( $string == false || $string == '' ) $string = $error[24];
  12.    
  13.     $checkIfEmpty = "SELECT title FROM content WHERE title='{$string}'";
  14.     $checkIfEmpty2 = mysql_query($checkIfEmpty);
  15.    
  16.     if (mysql_num_rows($checkIfEmpty2 ) == 0) {
  17.        
  18.         $addArticle = "INSERT INTO content (title) VALUES ('{$string}')";
  19.         $addArticle2 = mysql_query($addArticle) or die($error[5]);
  20.         echo $string;
  21.        
  22.     } else { echo 'Niepowodzenie: podstrona o takim tytule już istnieje: "' . $string . '"'; }
  23.  
  24.  
  25. ?>
Add Comment
Please, Sign In to add comment