Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [SQL][PHP]Nie zatwierdza zadania., problem, zadanie, sejf
Intex
post
Post #1





Grupa: Zarejestrowani
Postów: 14
Pomógł: 0
Dołączył: 8.07.2010

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


Witam

Mam mały problem, otóż po wpisaniu w specjalną rubryczkę nazyw nagrody powinna się dodać i wyswietlić i razem z tym powinien wylosować się 13 cyfrowy kod dostępu, który trzeba odgadnąć, jednak nic takiego się nie dzieje klikam zatwierdź i nic. Proszę o pomoc. Oto cały plik php odpowiedzialny za to, dodam że nie wyskakują żadne błędy.



  1. <?php
  2. ?>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
  5. <head>
  6. <title>Zarządzanie sejfem</title>
  7. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  8. <link rel="Stylesheet" type="text/css" href="default.css" />
  9. </head>
  10. <body>
  11. <div id="content">
  12. <?php
  13. require_once ("datbase.php");
  14.  
  15. $db = new datbase ('localhost', 'xxxxx', 'xxxx');
  16. $db -> selectdb ('xxxx');
  17.  
  18. if ($_SESSION['admin_login']) {
  19. if ($_POST['setprize'] AND $_POST['prize']) {
  20. $prize = addslashes(htmlspecialchars($_POST['prize']));
  21. $code = rand(1000000000000, 9999999999999);
  22. $db -> query ('INSERT INTO sejf (code, prize) VALUES ('.$code.', \''.$prize.'\')');
  23. }
  24. $last = $db -> results ('sejf', 'WHERE user != \'\' ORDER BY id DESC');
  25. echo '<a href="index.php?logout=1">[Wyloguj]</a><h4>Dodaj:</h4>';
  26. if (!$db -> results ('sejf', 'WHERE user = \'\'')) {
  27. echo '<form method="post">
  28. Nagroda:<br />
  29. <input type="text" name="prize" /><br />
  30. <input type="submit" value="Zatwierdź" name="setprize">
  31. </form>';
  32. }
  33. else {
  34. echo '<strong>Aktualnie nagroda została już przyznana!</strong>';
  35. }
  36. echo '<h4>Ostatnia wygrana:</h4>
  37. Ostatnio <strong>'.$last['user'].'</strong> wygrał '.$last['prize'].', kod: '.$last['code'].'';
  38. }
  39. else {
  40. if ($_POST['setlog']) {
  41. if ($_POST['login'] AND $_POST['pass']) {
  42. $login = addslashes(htmlspecialchars($_POST['login']));
  43. $pass = addslashes(htmlspecialchars($_POST['pass']));
  44. $user = $db -> results ('mybb_users', 'WHERE username = \''.$login.'\' AND usergroup = 4');
  45. if ($user) {
  46. if (md5(md5($user['salt']).md5($pass)) == $user['password']) {
  47. $_SESSION['admin_login'] = $login;
  48. echo '<script>window.location = \'admin.php\';</script>';
  49. }
  50. }
  51. }
  52. }
  53.  
  54. echo '<form method="post">
  55. Login:<br />
  56. <input type="text" name="login" /><br />
  57. Hasło:<br />
  58. <input type="password" name="pass" /><br />
  59. <input type="submit" value="Zaloguj" name="setlog" />
  60. </form>';
  61. }
  62. ?>
  63. </div>
  64. </body>
  65. </html>


Ten post edytował Intex 20.01.2012, 02:35:33
Go to the top of the page
+Quote Post
nikestylex7
post
Post #2





Grupa: Zarejestrowani
Postów: 386
Pomógł: 7
Dołączył: 22.04.2010
Skąd: Ziemia

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


zamiast if ($_POST['setprize'] AND $_POST['prize']) {
daj
if(isSet($_POST['setprize'])){

i napisz co jest grane dalej (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
Intex
post
Post #3





Grupa: Zarejestrowani
Postów: 14
Pomógł: 0
Dołączył: 8.07.2010

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


Niestety nadal to samo.
Go to the top of the page
+Quote Post

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: 19.12.2025 - 16:02