Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Zabezpieczanie prze SQL Injection
Raven1122
post
Post #1





Grupa: Zarejestrowani
Postów: 369
Pomógł: 2
Dołączył: 1.11.2010

Ostrzeżenie: (0%)
-----


Jak zabezpieczyc ten skrypt przed injection? chodzi mi o mysql_real_string_escape i o to zeby nie dalo sie dodac tagow html

  1. <?php header("location:../index.php?id=3"); ?>
  2. <?php
  3.  
  4. if($_POST['author'] != 'Wykonawca' and $_POST['title'] != 'Autor' and $_POST['link'] != 'Link do odsłuchu'){
  5. $name = $_POST['author'] . '-' . $_POST['title'];
  6. $id = 0;
  7. $votes = 0;
  8. $link = $_POST['link'];
  9.  
  10. $connect = mysql_connect('xxx', 'xxx', 'xxx') or die(mysql_error());
  11. mysql_select_db(bassplay_web);
  12.  
  13. $sql = "INSERT INTO pool_top10 (id, name, glosy, link) " .
  14. "VALUES ('$id', '$name', '$votes', '$link')";
  15. $result = mysql_query($sql) or die(mysql_error());
  16. echo ("Utwór dodany poprawnie");
  17. }
  18. else{
  19. echo ("Wypełnij wszystkie pola");
  20. }
  21. ?>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 01:29