🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.php
Article #169611

Re: metoda GET - insert

#169611
From: the_foe
Date: Wed, 22 Feb 2006 19:23
42 lines
2405 bytes
Użytkownik "Miki" <Mikiiiiiiiiiiiiiiiiiii@poczta.onet.pl> napisał w wiadomości 
news:dti893$hto$1@news.onet.pl...
> Witam. Jestem początkującym więc proszę o wyrozumiałość. Napisałem sobie coś
> tam żeby wyświetlało mi dane i bym powiedział że dziła ale mam problem ze
> zrobieniem insertu. Poniżej przedtswaim taki tam kawalek kodu. Sorki za mały
> spam ale nie wiem co tu jest źle ??? Jeżeli mozna prosic to proszę kogos o 
> kawalek kodu który ładnie wszystko dadaje. Wersja serwera: 4.0.24 Wersja PHP:
> 4.3.10-16
>
> <html>
> <head>
> <title>--</title>
> </head>
> <body>
> <?php
> if($send=='Wyslij') {
> mysql_connect ("localhost","haslo","haslo");
> mysql_select_db (daneosobowe);
> $zapytanie = "INSERT INTO dane SET imie='$imie', nazwisko='$nazwisko'";

  $win="\xA5\xC6\xCA\xA3\xD1\xD3\x8C\x8F\xAF\xB9\xE6\xEA\xB3\xF1\xF3\x9C\x9F\xBF";
  $iso="\xA1\xA6\xAC\xB1\xB6\xBC";
$preg="/[^".$win.$iso."A-Za-z0-9_ -]/s";

//ograniczamy userowi wpisywanie wylacznie znakow, cyfr, myslnika, podkreslnika 
i spacji

foreach ($_GET as $k=>$v){
    $_GET[$k]=preg_replace($preg,"\\1",$v);
}
foreach ($_POST as $k=>$v){
    $_POST[$k]=preg_replace($preg,"\\1",$v);
}
foreach ($_COOKIE as $k=>$v){
    $_COOKIE[$k]=preg_replace($preg,"\\1",$v);
}

//input
$zap=sprintf("INSERT INTO dane 
(`imie`,`nazwisko`)VALUES('%s','%s')",$_GET['imie'],$_GET['nazwisko']);
mysql_query($zap); 
Technical Details
Message-ID: <dtidpp$ogo$1@nemesis.news.tpi.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail
References: <dti893$hto$1@news.onet.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail
From: "the_foe" <the_foeWYTNIJ@WYTNIJwp.pl>
Newsgroups: pl.comp.lang.php
Subject: Re: metoda GET - insert
Date: Wed, 22 Feb 2006 20:23:06 +0100
Organization: tp.internet - http://www.tpi.pl/
Lines: 44
Message-ID: <dtidpp$ogo$1@nemesis.news.tpi.pl>
References: <dti893$hto$1@news.onet.pl>
NNTP-Posting-Host: bcq209.neoplus.adsl.tpnet.pl
X-Trace: nemesis.news.tpi.pl 1140636281 25112 83.27.232.209 (22 Feb 2006 19:24:41 GMT)
X-Complaints-To: usenet@tpi.pl
NNTP-Posting-Date: Wed, 22 Feb 2006 19:24:41 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Response
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit