Advertisement
PrincessFumi

Untitled

May 24th, 2015
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.94 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. $maile = $_GET['lista'];
  65.  
  66. foreach($maile as $id)
  67. {
  68. $query = "Select 'Adres_email' From 'uzytkownicy' where 'idUsers' = '" .$id. "';";
  69. $result=mysql_query($result);
  70. echo $id;
  71.  
  72. }
  73. $go = $_GET['go'];
  74. if (isset($go)) {
  75. echo 'dziala';
  76. $temat = $_GET['Temat'];
  77. $wiad = $_GET['wiad'];
  78. echo $temat;
  79. echo $wiad;
  80.  
  81. while ($row = mysql_fetch_row($query)) {
  82. echo $row[0];
  83. echo $row[2];
  84.  
  85. smpt_mail($adres,$temat,$wiad);
  86. }
  87. }
  88.  
  89.  
  90. echo '</pre>';
  91. echo "Aby zaznaczyć kilku użytkowników przytrzymaj CTRL";
  92.  
  93.  
  94.  
  95. ?>
  96.  
  97.  
  98.  
  99. <?php
  100. //$ilu_userow = mysql_numrows($result);
  101.  
  102.  
  103. // for ($i=0;$i<3; $i++) {
  104.  
  105.  
  106. // foreach ($maile as $id){
  107. // smtp_mail($id, $temat, $wiad);
  108. // }
  109.  
  110. //}
  111. mysql_free_result($result);
  112. ?>
  113. </body>
  114. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement