Asi to je otazka od veci, ale je možná keď mam napríklad v sůbore config.php spojenie so serverom a vybratie tabulky aby niekto iný z iného hostingu si tento sůbor pripojil a používal pripojenie? zda sa mi ze to ten script sa vygeneruje do html pri akejkolvek poziadavke ale niesom si isty. Chcem sa dalej spytat ci v php je mozne nejaku clensku fuknciu deklarovat ako konstantnu(v c++ take nieco je) viacmenej som take nieco nenasiel nikde taks a pytam tu.
Fórum › PHP
Spustenie skriptu s db

radypala píše:#
# zda sa mi ze to ten script sa vygeneruje do html pri akejkolvek poziadavke ale niesom si isty.
Ano, p?es http po?adavek skript v?dycky projde php parserem, tedy pokud s n?m nepracuje zrovna jin? skript na serveru, kde je ulo?en?. Tedy se nemus?te b?t p??padn? manipulace, ovšem pozor na k?d typu "include $_GET['page'].'.php';", plat? pravidlo ?e nikdy nesm?te v??it vstupn?m dat?m. Nap??klad ve star??ch verz?ch php je nebezpe?n? k?d "header('Location: '.$_GET['url']);", kv?li podstr?en? session. Abych byl kompletn?, nesm?m zapomenout, ?e tento k?d je taky nebezpe?n?: "(mysql|pg|...)_query('SELECT * FROM WHERE id = '.$_GET['id'])";. Lep?? ?e?en?:
function escape($str) {
if(get_magic_quotes_gpc())
$str = stripslashes($str);
if(function_exists('mysql_real_escape_string'))
$str = mysql_real_escape_string($str);
else
$str = addslashes($str);
return $str;
}
mysql_query(sprintf('SELECT * FROM tabulka
WHERE retezec = "%s" AND cislo = %d', escape($_GET['retezec']), $_GET['cislo']));
radypala píše:#
# Chcem sa dalej spytat ci v php je mozne nejaku clensku fuknciu deklarovat ako konstantnu(v c++ take nieco je) viacmenej som take nieco nenasiel nikde taks a pytam tu.
Nejsem si 100% jist?, ale tu??m, ?e php je jazyk interpretovan? n? kompilovan? a tam takov? p?est?vaj? m?t smysl.
Věřím, že můžete v životě získat všechno, co budete chtít, když budete pomáhat druhým lidem, aby dostali to, co si přejí oni. - Zig Ziglar

Přidej příspěvek
Toto téma je starší jak čtvrt roku – přidej svůj příspěvek jen tehdy, máš-li k tématu opravdu co říct!
Ano, opravdu chci reagovat → zobrazí formulář pro přidání příspěvku
×Vložení zdrojáku
×Vložení obrázku
×Vložení videa
Aktuálně jsou podporována videa ze serverů YouTube, Vimeo a Dailymotion.
×






























































Uživatelé prohlížející si toto vlákno
Uživatelé on-line: 0 registrovaných, 60 hostů
Podobná vlákna
Restart skriptu — založil Matej Zabsky
Kompilace skriptů — založil Prasklej Talíř
Zabezpečenie skriptu — založil Martin
Princip skriptu — založil MaxDJs
Spouštění bat skriptů — založil Taufic
Moderátoři diskuze