Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Dlaczego nie widzi zmiennej pobranej z tablicy $_GET, zmienna pobrana z GET - wysyłana w POST
shpaque
post
Post #1





Grupa: Zarejestrowani
Postów: 651
Pomógł: 3
Dołączył: 31.01.2011
Skąd: Warszawa

Ostrzeżenie: (10%)
X----


Witam, mam problem z odnalezieniem babola. Może Wam się uda? (wskakuje mi ciągle error page) "$akod" zdefiniowany jest dalej jako "$akod = $_GET['akod'];"

  1. <?php
  2. if ($_SERVER['REQUEST_METHOD'] == 'POST' && strlen($_POST['nowa']))
  3. {
  4. $xnowa = addslashes($_POST['nowa']);
  5. $xusername = $_SESSION['username'];
  6. $found = false;
  7. $logtimes = array();
  8. $xtimes = array();
  9. $ximages = array();
  10. $xcodes = array();
  11. $xnames = array();
  12. $xsizes = array();
  13. $xfirmas = array();
  14. $xsquads = array();
  15. $xopiss = array();
  16. $xcenas = array();
  17. $xusers = array();
  18. $activeaccounts = array();
  19. $count = 0;
  20. $success_page = './aukcje.php';
  21. $error_page = './aerror.php';
  22. $database = './db/aukcje.csv';
  23.  
  24. if (filesize($database) == 0)
  25. {
  26. header('Location: '.$error_page);
  27. }
  28. else
  29. {
  30. $items = file($database);
  31. foreach($items as $line)
  32. {
  33. list($logtime, $xtime, $ximage, $xcode, $xname, $xsize, $xfirma, $xsquad, $xopis, $xcena, $xuser, $active) = explode('|', trim($line));
  34. $logtimes[$count] = $logtime;
  35. $xtimes[$count] = $xtime;
  36. $ximages[$count] = $ximage;
  37. $xcodes[$count] = $xcode;
  38. $xnames[$count] = $xname;
  39. $xsizes[$count] = $xsize;
  40. $xfirmas[$count] = $xfirma;
  41. $xsquads[$count] = $xsquad;
  42. $xopiss[$count] = $xopis;
  43. $xcenas[$count] = $xcena;
  44. $xusers[$count] = $xuser;
  45. $activeaccounts[$count] = $active;
  46. if ($akod == $xcode)
  47. {
  48. $found = true;
  49. }
  50. $count++;
  51. }
  52. }
  53. if ($found == true)
  54. {
  55. $file = fopen($database, 'w');
  56. for ($i=0; $i < $count; $i++)
  57. {
  58. fwrite($file, $logtimes[$i]);
  59. fwrite($file, '|');
  60. fwrite($file, $xtimes[$i]);
  61. fwrite($file, '|');
  62. fwrite($file, $ximages[$i]);
  63. fwrite($file, '|');
  64. fwrite($file, $xcodes[$i]);
  65. fwrite($file, '|');
  66. fwrite($file, $xnames[$i]);
  67. fwrite($file, '|');
  68. fwrite($file, $xsizes[$i]);
  69. fwrite($file, '|');
  70. fwrite($file, $xfirmas[$i]);
  71. fwrite($file, '|');
  72. fwrite($file, $xsquads[$i]);
  73. fwrite($file, '|');
  74. fwrite($file, $xopiss[$i]);
  75. fwrite($file, '|');
  76. if ($xcodes[$i] == $xcode)
  77. {
  78. fwrite($file, $xnowa);
  79. fwrite($file, '|');
  80. fwrite($file, $xusername);
  81. }
  82. else
  83. {
  84. fwrite($file, $xcenas[$i]);
  85. fwrite($file, '|');
  86. fwrite($file, $xusers[$i]);
  87. }
  88. fwrite($file, '|');
  89. fwrite($file, $activeaccounts[$i]);
  90. fwrite($file, "\r\n");
  91. }
  92. fclose($file);
  93. header('Location: '.$success_page);
  94. }
  95. else
  96. {
  97. header('Location: '.$error_page);
  98. }
  99. }
  100. ?>


Ten post edytował shpaque 16.08.2011, 22:27:26
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
CuteOne
post
Post #2





Grupa: Zarejestrowani
Postów: 2 958
Pomógł: 574
Dołączył: 23.09.2008
Skąd: wiesz, że tu jestem?

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


  1. <?php
  2. if (!empty($_GET))
  3. {
  4. $adata = $_GET['adata'];
  5. $aimg = $_GET['aimg'];
  6. $akod = $_GET['akod'];
  7. $anazwa = $_GET['anazwa'];
  8. $arozmiar = $_GET['arozmiar'];
  9. $afirma = $_GET['afirma'];
  10. $amaterial = $_GET['amaterial'];
  11. $aopis = $_GET['aopis'];
  12. $acena = $_GET['acena'];
  13. $awinner = $_GET['awinner'];
  14. $anowa = ($acena + 0.5);
  15. $przebij = $anowa;
  16. }
  17. if (!empty($_POST) && strlen($_POST['nowa']))
  18. {
  19. $xnowa = addslashes($_POST['nowa']);
  20. $xusername = addslashes($_SESSION['username']);
  21. $found = false;
  22. $logtimes = array();
  23. $xtimes = array();
  24. $ximages = array();
  25. $xcodes = array();
  26. $xnames = array();
  27. $xsizes = array();
  28. $xfirmas = array();
  29. $xsquads = array();
  30. $xopiss = array();
  31. $xcenas = array();
  32. $xusers = array();
  33. $activeaccounts = array();
  34. $count = 0;
  35. $success_page = './aukcje.php';
  36. $error_page = './aerror.php';
  37. $database = './db/aukcje.csv';
  38.  
  39. if (filesize($database) == 0)
  40. {
  41. header('Location: '.$error_page);
  42. }
  43. else
  44. {
  45. $items = file($database);
  46. foreach($items as $line)
  47. {
  48. list($logtime, $xtime, $ximage, $xcode, $xname, $xsize, $xfirma, $xsquad, $xopis, $xcena, $xuser, $active) = explode('|', trim($line));
  49.  
  50. $logtimes[$count] = $logtime;
  51. $xtimes[$count] = $xtime;
  52. $ximages[$count] = $ximage;
  53. $xcodes[$count] = $xcode;
  54. $xnames[$count] = $xname;
  55. $xsizes[$count] = $xsize;
  56. $xfirmas[$count] = $xfirma;
  57. $xsquads[$count] = $xsquad;
  58. $xopiss[$count] = $xopis;
  59. $xcenas[$count] = $xcena;
  60. $xusers[$count] = $xuser;
  61. $activeaccounts[$count] = $active;
  62. if ($akod == $xcode)
  63. {
  64. $found = true;
  65. }
  66. $count++;
  67. }
  68. }
  69. if ($found == true)
  70. {
  71. $file = fopen($database, 'w');
  72. for ($i=0; $i < $count; $i++)
  73. {
  74. fwrite($file, $logtimes[$i]);
  75. fwrite($file, '|');
  76. fwrite($file, $xtimes[$i]);
  77. fwrite($file, '|');
  78. fwrite($file, $ximages[$i]);
  79. fwrite($file, '|');
  80. fwrite($file, $xcodes[$i]);
  81. fwrite($file, '|');
  82. fwrite($file, $xnames[$i]);
  83. fwrite($file, '|');
  84. fwrite($file, $xsizes[$i]);
  85. fwrite($file, '|');
  86. fwrite($file, $xfirmas[$i]);
  87. fwrite($file, '|');
  88. fwrite($file, $xsquads[$i]);
  89. fwrite($file, '|');
  90. fwrite($file, $xopiss[$i]);
  91. fwrite($file, '|');
  92. if ($xcodes[$i] == $akod)
  93. {
  94. fwrite($file, $xnowa);
  95. fwrite($file, '|');
  96. fwrite($file, $xusername);
  97. }
  98. else
  99. {
  100. fwrite($file, $xcenas[$i]);
  101. fwrite($file, '|');
  102. fwrite($file, $xusers[$i]);
  103. }
  104. fwrite($file, '|');
  105. fwrite($file, $activeaccounts[$i]);
  106. fwrite($file, "\r\n");
  107. }
  108. fclose($file);
  109. header('Location: '.$success_page);
  110. }
  111. else
  112. {
  113. header('Location: '.$error_page);
  114. }
  115. }
  116. ?>
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: 24.12.2025 - 10:13