Advertisement
PrincessFumi

Untitled

May 24th, 2015
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 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" action = "" >';
  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.  
  45. echo '<OPTION VALUE=',$i,'>',$wiersz['Login'], '</OPTION>';
  46.  
  47. }
  48.  
  49.  
  50. echo
  51. '<tr><td>Temat:</td>',
  52. ' <td><input type="text" name="Temat"/></td>
  53. </tr><tr>';
  54. echo '<tr>
  55. <td>Treść zaproszenia:</td>
  56. <td><textarea name="wiad"></textarea></td>
  57. </tr><tr>';
  58.  
  59. echo '</SELECT>';
  60. echo '<INPUT TYPE="SUBMIT" name = "go">',
  61. ' </form>',
  62. ' <pre>';
  63. mysql_free_result($result);
  64. $go = $_GET['go'];
  65. if (isset($go)) {
  66. echo 'dziala';
  67. $temat = $_GET['Temat'];
  68. $wiad = $_GET['wiad'];
  69. echo $temat;
  70. echo $wiad;
  71.  
  72. }
  73. $maile = $_GET['lista'];
  74.  
  75. foreach($maile as $id)
  76. {
  77. $query = "Select 'Adres_email' From 'uzytkownicy' where 'idUsers' = '" .$id. "';";
  78. $result=mysql_query($query);
  79. echo $id;
  80.  
  81. while ($row = mysql_fetch_row($result)) {
  82. echo $row[0];
  83. echo $row[2];
  84.  
  85. smpt_mail($adres,$temat,$wiad);
  86.  
  87. }
  88. }
  89.  
  90.  
  91.  
  92. echo '</pre>';
  93. echo "Aby zaznaczyć kilku użytkowników przytrzymaj CTRL";
  94.  
  95.  
  96.  
  97. ?>
  98.  
  99.  
  100.  
  101. <?php
  102. //$ilu_userow = mysql_numrows($result);
  103.  
  104.  
  105. // for ($i=0;$i<3; $i++) {
  106.  
  107.  
  108. // foreach ($maile as $id){
  109. // smtp_mail($id, $temat, $wiad);
  110. // }
  111.  
  112. //}
  113. mysql_free_result($result);
  114. ?>
  115. </body>
  116. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement