Advertisement
PrincessFumi

Untitled

May 24th, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. <?php
  2.  
  3. require_once 'mail.php';
  4. session_start();
  5. include "connect.php";
  6. $polaczenie = mysql_connect("$host","$db_user","$db_password");
  7. mysql_select_db("$db_name");
  8. if(!isset($_SESSION['zalogowany']))
  9. {
  10. header('Location: menu.php');
  11. exit();
  12. }
  13.  
  14. ?>
  15. <!DOCTYPE HTML>
  16. <html lang="pl">
  17. <head>
  18. <meta charset="utf-8" />
  19. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  20. <title>Zaproś znajomych</title>
  21. </head>
  22.  
  23. <body>
  24.  
  25. <?php
  26.  
  27.  
  28. $query="SELECT * FROM uzytkownicy";
  29. $result=mysql_query($query); // wyswietlanie uzytkowników w liście wyboru:
  30. $ilu_userow = mysql_numrows($result);
  31. $id=0;
  32.  
  33. $i=0;
  34.  
  35.  
  36. echo '<FORM METHOD="get">';
  37. echo ' <SELECT NAME="lista[]" MULTIPLE>';
  38.  
  39. for($i = 1; $i<=$ilu_userow; $i++)
  40. {
  41. $wiersz = mysql_fetch_assoc($result);
  42. $_SESSION['Login'] = $wiersz['Login'];
  43. $_SESSION['Adres_email'] = $wiersz['Adres_email'];
  44. // $maile= $wiersz['Adres_email'];
  45.  
  46. echo '<OPTION VALUE=',$i,'>',$wiersz['Login'], '</OPTION>';
  47.  
  48. }
  49.  
  50.  
  51. echo
  52. '<tr><td>Temat:</td>',
  53. ' <td><input type="text" name="Temat"/></td>
  54. </tr><tr>';
  55. echo '<tr>
  56. <td>Treść zaproszenia:</td>
  57. <td><textarea name="wiad"></textarea></td>
  58. </tr><tr>';
  59.  
  60. echo '</SELECT>';
  61. echo '<INPUT TYPE="SUBMIT" name "wyslij">',
  62. ' </form>',
  63. ' <pre>';
  64. $maile = $_GET['lista'];
  65.  
  66. foreach($maile as $id)
  67. {
  68. echo $id;
  69.  
  70. }
  71. if (isset($_REQUEST['SUBMIT'])) {
  72. $temat = $_GET['Temat'];
  73. $wiad = $_GET['wiad'];
  74. $query = mysql_query("Select 'Adres_email' From 'uzytkownicy' where 'idUsers' = '" . $id . "';");
  75. for($i=0;$i<ilu_userow;$i++){
  76. while ($row = mysql_fetch_row($query)) {
  77.  
  78. smpt_mail($query,$temat,$wiad);
  79.  
  80. }
  81. }
  82. }
  83. echo '</pre>';
  84. echo "Aby zaznaczyć kilku użytkowników przytrzymaj CTRL";
  85.  
  86.  
  87.  
  88. ?>
  89.  
  90.  
  91.  
  92. <?php
  93. //$ilu_userow = mysql_numrows($result);
  94.  
  95.  
  96. // for ($i=0;$i<3; $i++) {
  97.  
  98.  
  99. // foreach ($maile as $id){
  100. // smtp_mail($id, $temat, $wiad);
  101. // }
  102.  
  103. //}
  104. mysql_free_result($result);
  105. ?>
  106. </body>
  107. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement