Exemplo n.º 1
0
<?php

session_start();
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$mailDestinataire = "*****@*****.**";
$from = "From: <" . $email . "> \nMime-Version:\n";
$from .= " 1.0\nContent-Type: text/html; charset=UTF-8\n";
$header = "Formulaire de contact";
$messageMail = "\n\n\t\tNom :   " . $name . "\n\t\tEmail :   " . $email . "\n\t\tMessage: " . Stripslashes($message) . "";
mail($mailDestinataire, $subject, $messageMail, $from);
header("Refresh: 0.005;URL=mailEnvoye.html");
Exemplo n.º 2
0
 function message_center_fetch($switch)
 {
     global $sql;
     global $database;
     switch ($switch) {
         case 1:
             $fetch = $sql->select(array('db' => $database, 'table' => 'messages', 'where' => array('rec_id =' . $_COOKIE['user']), 'orderby' => array('date', 'DESC')));
             if ($_GET['d'] != NULL) {
                 if ($fetch != NULL) {
                     $sql->delete(array('db' => $database, 'table' => 'messages', 'where' => array('id = ' . $_GET['d'])));
                     echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL=./?page=message_center">';
                 }
             }
             foreach ($fetch as $key => $fetch) {
                 $id = $fetch['id'];
                 if ($fetch['read'] == 1) {
                     $subject = $fetch['subject'];
                 } else {
                     $subject = "* <em>" . $fetch['subject'] . "</em>";
                 }
                 $date = date($this->date_format, $fetch['date']);
                 $sender = $sql->select(array('db' => $database, 'table' => 'users', 'where' => array('id =' . $fetch['sender_id'])));
                 $sender = $sender[0]['username_f'];
                 echo "\r\n\t\t\t\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t[ <a href='?page=message_center&d={$id}'>X</a> ] <a href='?page=message_center&read=read&id={$id}'> {$subject} </a>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t{$sender}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t{$date}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\r\n\t\t\t\t\t</tr>\r\n\t\t\t\r\n\t\t\t\t";
             }
             break;
         case 2:
             $fetch = $sql->select(array('db' => $database, 'table' => 'messages', 'where' => array('id = ' . $_GET['id'])));
             if ($fetch[0]['rec_id'] != $_COOKIE['user']) {
                 echo "<center> Error: You are not able to view this message.</center>";
             } else {
                 $id = $_GET['id'];
                 $sql->update(array('db' => $database, 'table' => 'messages', 'where' => array('id = ' . $_GET['id']), 'values' => array('read' => '1')));
                 echo "<a href='?page=message_center'> <strong> Back </strong> </a> | <a href='?page=message_center&read=reply&id={$id}'> <strong >Reply </strong> </a> <br> <br> Subject: " . $fetch[0]['subject'] . " <br> Date: " . date($this->date_format, $fetch[0]['date']) . " <br> <div id='message_body'>" . $fetch[0]['body'] . "</div>";
             }
             break;
         case 3:
             $fetch = $sql->select(array('db' => $database, 'table' => 'messages', 'where' => array('id = ' . $_GET['id'])));
             $subject = $fetch[0]['subject'];
             $body = nl2br(stripslashes($fetch[0]['body']));
             $send = $fetch[0]['sender_id'];
             if ($_POST) {
                 $sender = $_COOKIE['user'];
                 $rec = $send;
                 $sub = strip_tags(Stripslashes($_POST['subject']));
                 $bod = stripslashes($_POST['body']);
                 $send = array('read' => 0, 'sender_id' => $sender, 'rec_id' => $rec, 'subject' => $sub, 'body' => $bod);
                 if (!$sql->insert(array('db' => $database, 'table' => 'messages', 'values' => $send))) {
                     die('Unable to add new Link to Database');
                 }
                 echo "<center>Message Sent.</center>";
             } else {
                 $body = strip_tags($body);
                 echo "\r\n\t\t\t\t\r\n\t\t\t\t\t<form action='?page=message_center&read=reply&id=2' method='post'>\r\n\t\t\t\r\n\t\t\t\t\t<table border='0' cellpadding='0' cellspacing='1' width='100%'>\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<td width='100px'>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tSubject:\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<input type='text' name='subject' value='Re: {$subject}' class='login_box'>\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<td width='100px' valign='top'>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tBody:\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<textarea class='textarea_full' name='body'>\r\n\r\n---ORIGINAL MESSAGE---\r\n\r\n{$body}</textarea>\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<td colspan='2' align='center'>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<input type='submit' value='Send Message' class='submit'>\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\r\n\t\t\t\t\t</table>\r\n\t\t\t\t\t\r\n\t\t\t\t\t</form>\r\n\t\t\t\r\n\t\t\t\t";
             }
             break;
         case 4:
             if ($_POST) {
                 $body = nl2br(stripslashes(strip_tags($_POST['body'])));
                 $subject = strip_tags(stripslashes($_POST['subject']));
                 $rec = $_POST['rec'];
                 $sender = $_COOKIE['user'];
                 $read = 0;
                 $send = array('subject' => $subject, 'body' => $body, 'sender_id' => $sender, 'rec_id' => $rec, 'read' => $read);
                 if (!$sql->insert(array('db' => $database, 'table' => 'messages', 'values' => $send))) {
                     die('Unable to add news to Database');
                 }
                 echo "<center>Message Sent.</center>";
             } else {
                 $user_list = $sql->select(array('db' => $database, 'table' => 'users', 'where' => array('active = 1'), 'orderby' => array('username', 'ASC')));
                 echo "\r\n\t\t\t\r\n\t\t\t\t<form action='?page=message_center&read=write' method='post'>\r\n\t\t\t\r\n\t\t\t\t<table border='0' cellpadding='0' cellspacing='1' width='100%'>\r\n\t\t\t\t\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t<td width='100px' valign='top'>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tRecipient:\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<select name='rec' style='width:100%;'> \n";
                 foreach ($user_list as $key => $list) {
                     $username = $list['username_f'];
                     $u_id = $list['id'];
                     echo "<option value='{$u_id}'>{$username}</option> \n";
                 }
                 echo "</select>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t<td width='100px'>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tSubject:\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<input type='text' name='subject' class='login_box'>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t<td width='100px' valign='top'>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tBody:\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<textarea name='body' class='textarea_full'></textarea>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t<td colspan='2' align='center'>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<input type='submit' value='Send Message' class='submit'>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\r\n\t\t\t\t</table>\r\n\t\t\t\t\r\n\t\t\t\t</form>\r\n\t\t\t\r\n\t\t\t";
             }
             break;
     }
 }