Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. <?php
  2. header('Content-type: application/xml');
  3.  
  4. include('../index/sql.php'); // connect stb
  5. require_once('../index/eleje.php'); //munkamenet indítás
  6. $firstarray = explode(',',$_GET['products']);
  7. $secondarray = array();
  8. foreach ($firstarray as $one){
  9.   $secondarray[] = '"'.mysql_real_escape_string($one).'"'; // sql injection kivedes
  10. }
  11. $part = implode(',',$secondarray);
  12. $q = mysql_query('SELECT * FROM termek WHERE kod IN ('.$part.')');
  13. print "<?xml version=\"1.0\"?>\n";
  14. print "<products>\n";
  15. while($r = mysql_fetch_array($q)){
  16.   print "\t<product>\n";
  17.   print "\t\t<productid>".$r['kod']."</productid>\n";
  18.   print "\t\t<productname>".($r['rnev']?$r['rnev']:$r['nev'])."</productname>\n";
  19.   print "\t\t<productprice>".($r['euro']?$r['ar']*305:$r['ar'])."</productprice>\n";
  20.   print "\t</product>\n";
  21. }
  22. print "</products>\n";
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement