Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Zdrapka
kurczak610
post
Post #1





Grupa: Zarejestrowani
Postów: 87
Pomógł: 2
Dołączył: 3.05.2009

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


Witam mam taki skrypt zdrapki:
  1. <?php
  2. // Zapytanie o partie
  3. $query  = sprintf
  4.   (
  5.       "SELECT `partie` FROM `users1` WHERE `id` = '%s'",
  6.       $_SESSION['userid']
  7.   );
  8. $query  = mysql_query($query) or exit(mysql_error());
  9. $result = mysql_fetch_assoc($query);
  10. // Komunikat przy braku partii
  11. if ($result['partie'] == 0) {
  12.   echo("Nie masz partii!");
  13. }else{
  14.  
  15. // Losowanie zdrapki
  16. $zdrapki = array
  17.   (
  18.       array('points' => 10, 'filename' => 'moon.swf'),
  19.       array('points' => 10, 'filename' => 'moon.swf'),
  20.       array('points' => 30, 'filename' => 'moon_30.swf'),
  21.       array('points' => 10, 'filename' => 'moon.swf'),
  22.       array('points' => 10, 'filename' => 'moon.swf'),
  23.       array('points' => 30, 'filename' => 'moon_30.swf'),
  24.       array('points' => 10, 'filename' => 'moon.swf'),
  25.       array('points' => 30, 'filename' => 'moon_30.swf'),
  26.       array('points' => 10, 'filename' => 'moon.swf'),
  27.       array('points' => 30, 'filename' => 'moon_30.swf'),
  28.       array('points' => 10, 'filename' => 'moon.swf'),
  29.       array('points' => 30, 'filename' => 'moon_30.swf'),
  30.       array('points' => 10, 'filename' => 'moon.swf'),
  31.       array('points' => 50, 'filename' => 'moon_50.swf')
  32.   );
  33. $count = count($zdrapki)-1;
  34. $los   = rand(0, $count);
  35. // Aktualizacja punktów
  36. $query = sprintf
  37.   (
  38.       "UPDATE `users1` SET `points` = `points`+%d WHERE `id` = '%s'",
  39.       $zdrapki[$los]['points'],
  40.       $_SESSION['userid']
  41.   );
  42. // Aktualizacja partii
  43. $query = sprintf
  44.   (
  45.       "UPDATE `users1` SET `partie` = `partie`-1 WHERE `id` = '%s'",
  46.       $_SESSION['userid']
  47.   );
  48. // Wyświetlenie zdrapki
  49. printf('<embed src="%s" width="250" height="100"></embed>', $zdrapki[$los]['filename']);
  50. }
  51. ?>


I mam też:
  1. <?php
  2. $query=mysql_query("SELECT * FROM codes ORDER BY rand() LIMIT 1") or die("BŁĄD BAZY DANYCH");
  3. if(mysql_num_rows($query)>0)
  4. {
  5.    $row=mysql_fetch_array($query);
  6.    mysql_query("INSERT INTO zamowienia VALUES ('NULL','$_SESSION[username]','$row[name]','Event','$row[code]','".date("Y-m-d", time())."','".date("H:i:s", time())."')");
  7.    mysql_query("DELETE FROM codes WHERE id='".$row['id']."'") or die("BŁĄD BAZY DANYCH");
  8. echo '<object type="application/x-shockwave-flash" data="KATALOG ZE ZDRAPKA/'.$rowgame['link'].'" width="400" height="250"><param name="movie" value="KATALOG ZE ZDRAPKĄ/'.$rowgame['link'].'" /></object>';
  9. }
  10. ?>


Jak to połączyć aby raz byly do wygrania pkty a raz kody?
Go to the top of the page
+Quote Post
kurczak610
post
Post #2





Grupa: Zarejestrowani
Postów: 87
Pomógł: 2
Dołączył: 3.05.2009

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


Jeżeli chcesz mozesz napisać całe od nowa tylko zeby wygrane byly w 3 kategoriach:
Punkty - Dodaje do tabeli users1 np. 10 pktow
Kody - Dodaje do tabeli zamowienia kod
Nagrody - Dodaje do tabeli znagrody nagrode

(IMG:http://forum.php.pl/style_emoticons/default/tongue.gif)
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: 23.08.2025 - 18:28