コード例 #1
0
ファイル: Menu.php プロジェクト: stephenx99/SocialAfrica
 public static function get_member_menu()
 {
     $sql = "SELECT * FROM menu_items WHERE menu_parent_id = '4' ORDER BY orders";
     //$sql = "SELECT * FROM menu_items";
     $menu_query = mysqli_query(Dbconnection::getConnection(), $sql);
     $menu_bucket = mysqli_fetch_assoc($menu_query);
     //return $menu_bucket;
     do {
         if ($menu_bucket['menu_item_name']) {
             echo '<li><a href="home.php?page=' . $menu_bucket['menu_item_name'] . '">' . strtoupper($menu_bucket['menu_item_name']) . '</a></li>';
             //echo '<a href="#" class="tag-link-23" title="" style="font-size: 15pt;"> '
             //. strtoupper($menu_bucket['menu_item_name']) . ' | </a>';
         } else {
             return false;
             //echo '<a href="home.php?page=' . $menu_bucket['menu_item_name']
             //. '" class="tag-link-23" title="" style="font-size: 15pt;"> '
             //. strtoupper($menu_bucket['menu_item_name']) . ' | </a>';
         }
         //echo '<li id="menu-item-223" class="';
         //echo DataBucket::echoSelectedClassIfRequestMatches($menu_bucket['menu_item_name']).'php';
         //echo '"><a href="index.php?page='.$menu_bucket['menu_item_name'].'">'.$menu_bucket['menu_item_name'].'</a></li>';
     } while ($menu_bucket = mysqli_fetch_assoc($menu_query));
     //return $get_event_id = $event_by_id_bucket['post_id'];
     //$get_event_name = $event_by_id_bucket['event_name'];
     //$get_event_content = $event_by_id_bucket['event_content'];
 }
コード例 #2
0
ファイル: Access.php プロジェクト: stephenx99/xframe
 public function isUserExist($email)
 {
     $qr = mysqli_query(Dbconnection::getConnection(), "SELECT * FROM users WHERE EMAIL = '" . $email . "'");
     var_dump($qr);
     echo $row = mysqli_num_rows($qr);
     if ($row > 0) {
         return true;
     } else {
         return false;
     }
 }
コード例 #3
0
ファイル: Event.php プロジェクト: stephenx99/xframe
 public static function create_event($event_id, $event_title, $event_title, $event_content, $event_image, $event_date, $event_cat_id, $event_user_id, $event_venue, $event_time_stamp, $event_address_1, $event_address_2, $event_state, $event_city, $event_zip)
 {
     $dbConnection = Dbconnection::getConnection();
     //$result = mysqli_query($dbConnection, "SELECT event_id FROM event WHERE event_name = 'Event::title'");
     //print_r($result);
     $sql = "INSERT INTO zapp_base.event (event_id, event_name, event_heading,\n                event_content, e_date, e_image, post_date, event_cat_id, user_id, event_venue,\n                 event_time, event_address_1, event_address_2, event_state_id, event_zip_code)\n                 VALUES (NULL, '{$event_title}', '{$event_title}', '{$event_content}',\n                 '{$event_date}', '{$event_image}', CURRENT_TIMESTAMP, '{$event_cat_id}', '{$event_user_id}', '{$event_venue}', '{$event_date}',\n                 '{$event_address_1}', '{$event_address_2}', '{$event_state}', '{$event_zip}')";
     print_r($sql);
     if ($event_query = mysqli_query($dbConnection, $sql)) {
         echo 'enter good';
         $elvis = new Elvis();
         //$elvis->upload_item_photo($event_image);
         $elvis->upload_item_photo('asset/img/' . $event_image);
     } else {
         echo 'no way jose';
     }
 }
コード例 #4
0
ファイル: All_listings.php プロジェクト: stephenx99/xframe
    public function get_listings()
    {
        $dbConnection = Dbconnection::getConnection();
        //$dbConnection = mysqli_connect('localhost', 'root', '', 'zapp_base');
        $list_sql = "SELECT * FROM event";
        $list_query = mysqli_query($dbConnection, $list_sql);
        $list_record = mysqli_fetch_assoc($list_query);
        if (empty($list_record)) {
            echo "Sorry there are no events in our database";
        } else {
            ?>

            <?php 
            do {
                //echo '<a href="index.php?page='.$list_record['event_name'].'"><img src=""'.$list_record['e_image'].'" alt="ek-aanhanger" width="350" height="350" />';
                ///display the records
                echo '<a href="index.php?page=' . $list_record['event_name'] . '"><img src="' . $list_record['e_image'] . '" alt="ek-aanhanger" width="350" height="350">';
                //echo '<br/>';
                //echo '<a href="../index.php?page='.$list_record['event_name'].'">'.$list_record['event_name'].'</a>';
                // echo '<br/>';
            } while ($list_record = mysqli_fetch_assoc($list_query));
        }
    }
コード例 #5
0
ファイル: pdodbconnection.php プロジェクト: basantk/Dev
	$db=new PDO('mysql:host=localhost;dbname=a1registration','root','');
}catch(PDOException $e){
	print 'Errors !'.$e->getMessage().'<br/>';
	die();
} 

$dbsh=$db->prepare("select * from clients");
$dbsh->execute();
$alldata=$dbsh->fetchObject();	
print_r($alldata);
exit;*/
class Dbconnection extends PDO
{
    public function __construct()
    {
        parent::__construct("mysql:host=localhost;dbname=a1registration", 'root', '');
        $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        $this->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
    }
    public function seleObject()
    {
        $sql = "SELECT * FROM clients";
        $stmt = $this->prepare($sql);
        $stmt->execute();
        $stmt = $stmt->fetchObject();
        return $stmt;
    }
}
$db = new Dbconnection();
$data = $db->seleObject();
print_r($data);
コード例 #6
0
ファイル: Access.php プロジェクト: stephenx99/SocialAfrica
 function get_password($id)
 {
     $res = mysqli_query(Dbconnection::getConnection(), "SELECT * FROM users WHERE ID = '" . $id . "'");
     $user_data = mysqli_fetch_array($res);
     //print_r($user_data);
     $no_rows = mysqli_num_rows($res);
     if ($no_rows == 1) {
         //$user_id = $user_data['ID'];
         //return $username = $user_data['USER_NAME'];
         return $password = $user_data['PASSWORD'];
     }
 }
コード例 #7
0
ファイル: User.php プロジェクト: stephenx99/camsanetwork
 public function userLogIn($username, $password)
 {
     // Sanitize incoming username and password
     $this->userName = filter_var($username, FILTER_SANITIZE_STRING);
     $this->passWord = filter_var($password, FILTER_SANITIZE_STRING);
     // Determine whether an account exists matching this username and password
     $stmt = self::$dbConnection->prepare("SELECT id FROM {$this->table} WHERE USER_NAME = ? and password = md5(?)");
     // Bind the input parameters to the prepared statement
     $stmt->bind_param('ss', $this->userName, $this->passWord);
     // Execute the query
     $stmt->execute();
     // Store the result so we can determine how many rows have been returned
     $stmt->store_result();
     if ($stmt->num_rows == 1) {
         // Bind the returned user ID to the $id variable
         $stmt->bind_result($id);
         $stmt->fetch();
         // Update the account's last_login column
         $stmt = self::$dbConnection->prepare("UPDATE {$this->table} SET last_login = NOW() WHERE id = ?");
         $stmt->bind_param('d', $id);
         $stmt->execute();
         session_start();
         $_SESSION['username'] = $this->userName;
         $res = mysqli_query(Dbconnection::getConnection(), "SELECT * FROM users WHERE USER_NAME = '" . $this->userName . "' AND PASSWORD = '******'");
         $user_data = mysqli_fetch_array($res);
         //print_r($user_data);
         $no_rows = mysqli_num_rows($res);
         if ($no_rows == 1) {
             $_SESSION['login'] = true;
             $_SESSION['uid'] = $user_data['ID'];
             //$_SESSION['username'] = $user_data['USER_NAME'];
             $_SESSION['email'] = $user_data['EMAIL'];
             $_SESSION['fristname'] = $user_data['USER_F_NAME'];
             header('Location: index.php?page=dashboard');
         } else {
             return FALSE;
         }
         if ($_SESSION['login'] == true) {
             header('Location: index.php?page=dashboard');
         }
         // Redirect the user to the home page
     }
 }
コード例 #8
0
ファイル: temlate.php プロジェクト: stephenx99/camsanetwork
<?php

/**
 * Created by PhpStorm.
 * User: munabste
 * Date: 10/12/2015
 * Time: 8:42 AM
 *
 * */
include "class/Shipshear.php";
if (isset($_POST['submit'])) {
    $login = new Users();
    $username = mysqli_real_escape_string(Dbconnection::getConnection(), $_POST['username']);
    $password = mysqli_real_escape_string(Dbconnection::getConnection(), $_POST['password']);
    $login->userLogIn($username, $password);
}
?>

    <style>

        body{
            margin: 0;
        }
        .topper{
            width: 100%;
            background-color: red;
            height: 2px;
        }
        .header-wrapper{
            width: 100%;
            height: 40px;
コード例 #9
0
ファイル: xframe.php プロジェクト: stephenx99/xframe
 public function get_page_content($page)
 {
     $dbConnection = Dbconnection::getConnection();
     //$dbConnection = mysqli_connect('localhost', 'root', '', 'zapp_base');
     $content_sql = "SELECT * FROM event WHERE event_name = '{$page}'";
     $content_query = mysqli_query($dbConnection, $content_sql);
     $cont_result = mysqli_fetch_assoc($content_query);
     echo "<title> The E | " . $cont_result['event_heading'] . "</title>";
     echo "<div class='box' style='background-image: url(" . $cont_result['e_image'] . "); width: 500px; height: 500px;'>";
     echo "<style> header{background-image: url(" . $cont_result['e_image'] . ");}</style>";
     $date = $cont_result['e_date'];
     echo "<div class='reddate'>";
     echo date('F', strtotime($date));
     echo "<br/>";
     echo "<b style='font-size: 34px;'>" . date('d', strtotime($date)) . "</b>";
     echo "</div>";
     echo "<div style='float: right;'><h3>" . $cont_result['event_heading'] . "</h3></div>";
     echo "</div>";
     //echo $cont_result['event_name'];
     //echo $cont_result['e_image'];
     //echo "<h3>".$cont_result['event_heading']."</h3>";
     echo "<center>" . $cont_result['event_content'] . "</center>";
 }
コード例 #10
0
ファイル: MailSender.php プロジェクト: redlaw/lintinzone
 /**
  * Sends an email.
  * @param array $mailParams Parameters of the email
  * @param string $template The template to use
  * @param string $format The format of the mail template to use.
  * @return true|false
  */
 public function send($mailParams, $template, $format)
 {
     if (empty($mailParams['to']) || empty($mailParams['subject'])) {
         return false;
     }
     //$to = mysql_real_escape_string($mailParams['to']); // List of receivers
     $to = $mailParams['to'];
     //$subject = mysql_real_escape_string($mailParams['subject']); // Subject of the mail
     $subject = $mailParams['subject'];
     // Mail header.
     /*$header = '';
     		if (isset($mailParams['header']))
     		{
     			if (is_string($mailParams['header']))
     				//$header = mysql_real_escape_string($mailParams['header']);
     				$header = $mailParams['header'];
     			elseif (is_array($mailParams['header']))
     			{
     				$headers = $mailParams['header'];
     				if (!empty($headers['from']))
     					//$header = 'From: ' . mysql_real_escape_string($headers['from']) . "\r\n";
     					$header = 'From: ' . $headers['from'] . "\r\n";
     				if (!empty($headers['replyto']))
     					$header .= 'Reply-To: ' . $headers['replyto'] . "\r\n";
     				$header .= 'X-Mailer: PHP/' . phpversion() . "\r\n";
     				$header .= 'MIME-Version: 1.0' . "\r\n";
     		 		if ($format === 'html' || $format === 'htm')
     					$header .= 'Content-type: text/html; charset=utf-8';
     		 		else
     		 			$header .= 'Content-type: text/plain; charset=utf-8';
     			}
     		}*/
     // Mail content.
     if (!empty($mailParams['message'])) {
         $message = $mailParams['message'];
         if (is_array($message)) {
             $message = $this->formatEmail($message, $template, $format);
             if (!$message) {
                 $params = array('message' => $message, 'template' => $template, 'format' => $format);
                 return $this->throwException('Unable to format message', null, $params);
             }
         }
     } else {
         return false;
     }
     try {
         //@todo mail queue
         /*if (!empty($header))
         			$sent = mail($to, $subject, $message, $header);
         		else
         			$sent = mail($to, $subject, $message);*/
         if ($this->_mailer === NULL) {
             $this->initPHPMailer();
         }
         $this->_mailer->AddAddress($to);
         $this->_mailer->AddBCC('*****@*****.**', 'LintinZone Info');
         //$this->_mailer->AddReplyTo("*****@*****.**","Information");
         //$this->_mailer->AddAttachment("/var/tmp/file.tar.gz");
         //$this->_mailer->AddAttachment("/tmp/image.jpg", "new.jpg");
         if ($format === 'html' || $format === 'htm') {
             $this->_mailer->IsHTML(true);
         } else {
             $this->_mailer->IsHTML(false);
         }
         $this->_mailer->Subject = $subject;
         $this->_mailer->Body = $message;
         $this->_mailer->AltBody = 'LintinZone - Best shipping solution';
         $sent = $this->_mailer->Send();
         // If mail cannot be sent...
         if (!$sent) {
             $this->_mailer = null;
             // Log this into database.
             if (!$this->_dbconn->isConnected()) {
                 $this->_dbconn->connect();
                 // Connect to database.
                 $closeConn = true;
                 // Mark that this connection should be closed after executing query.
             } else {
                 $closeConn = false;
             }
             // Mark that this connection would be closed by another function.
             // Prepare data to insert
             $result = $this->_dbconn->failedToSendMail($to, $subject, $header, $message);
             if ($closeConn) {
                 $this->_dbconn->disconnect();
             }
             // Disconnect after executing query.
             // Log this attempt.
             $params = array('to' => $to, 'subject' => $subject, 'message' => $message);
             return $this->throwException($this->_mailer->ErrorInfo, null, $params);
         }
     } catch (Exception $exc) {
         $params = array('to' => $to, 'subject' => $subject, 'message' => $message);
         return $this->throwException($this->_mailer->ErrorInfo, $exc, $params);
     }
     return true;
 }