コード例 #1
0
	 public function setMiembro($nombre, $apellido, $direccion, $cedula, $email, $casa, $movil, $pin, $categoria, $desc){
	 	
	 	dbConnection(); //Funcion que conecta a la base de datos
	 	
	 	$this->nombre = $nombre;
	 	$this->apellido = $apellido;
	 	$this->cedula = $cedula;
	 	$this->email = $email;
	 	$this->direccion = $direccion;
	 	$this->telefonoCasa = $casa;
	 	$this->telefonoMobil = $movil;
	 	$this->pin = $pin;
	 	$this->categoriaMiembro = $categoria;
	 	$this->desc = $desc;
	 	
	 	$query = "INSERT INTO miembro (codigo, nombre, apellido, direccion, cedula, email, telefono_casa, telefono_mobil, pin, categoria, descripcion)";
	 	$query.= " VALUES (NULL,'$this->nombre','$this->apellido','$this->direccion','$this->cedula','$this->email','$this->telefonoCasa','$this->telefonoMobil','$this->pin','$this->categoriaMiembro','$this->desc')";
	 	
	 	if(mysql_query($query)){
	 		echo "<script type='text/javascript'>
	 				alert('Datos Guardados Correctamente');
	 				window.location.href= 'frmMiembro.php';
	 			 </script>";
	 	};
	 	
	 }
コード例 #2
0
 static function deleteMovie($id)
 {
     $sql = 'DELETE FROM Movie WHERE mov_id=:id;';
     $sth = dbConnection()->prepare($sql);
     $sth->execute(array(':id' => $id));
     $fetch = $sth->fetch();
     return $fetch;
 }
コード例 #3
0
 static function insertUser($u)
 {
     if ($u->firstname != '' && $u->lastname != '' && $u->login != '' && $u->password != '') {
         $sql = 'INSERT INTO User(use_login,use_password,use_firstname,use_lastname) VALUES (:login,:password,:firstname,:lastname)';
         $sth = dbConnection()->prepare($sql);
         $sth->execute(array(':login' => $u->login, ':password' => $u->password, ':firstname' => $u->firstname, ':lastname' => $u->lastname));
         $fetch = $sth->fetch();
         return $fetch;
     } else {
         return false;
     }
 }
コード例 #4
0
function checkuser($fuid)
{
    $conn = dbConnection();
    $sql = "select * from voting where fbID='{$fuid}'";
    $result = $conn->query($sql);
    if ($result->num_rows > 0) {
        session_start();
        session_unset();
        return true;
    }
    return false;
}
コード例 #5
0
ファイル: functions.php プロジェクト: Travelite/Travelite
function dbResultFromQuery($query)
{
    $connection = dbConnection();
    if (!$connection) {
        die("MySQL Connection failed : " . mysqli_connect_error());
    }
    $result = 0;
    if (!empty($query)) {
        $result = mysqli_query($connection, $query) or die("<p>" . mysqli_error($connection) . "</p>");
    }
    mysqli_close($connection);
    return $result;
}
コード例 #6
0
 /**
  * Function that queries the database for a specific Game and 
  * then returns the result.
  * 
  * @param int $title
  * @return Game
  */
 public function getGame($title)
 {
     $db = dbConnection();
     //Establish database connection
     //Prepare &execute the select statement to query the database.
     $stmt = $db->prepare("select * from Game where gme_id = ?");
     $result = $stmt->execute($title);
     //Return the Game if the query is successful.
     if ($result === true) {
         $game = $stmt->fetch();
         return new Game($game['gme_id'], $game['gme_title'], $game['gme_developer'], $game['gme_console'], $game['gme_price'], $game['gme_rating'], $game['gme_comments']);
     } else {
         throw new Exception("Could not find the game!");
     }
 }
コード例 #7
0
ファイル: functions.php プロジェクト: gvh574/cs313-php
function insertHash($user, $pass)
{
    $pass = password_hash($pass, PASSWORD_DEFAULT);
    $db = dbConnection();
    try {
        $sql = 'INSERT INTO users(username, password) VALUES(:user, :pass)';
        $stmt = $db->prepare($sql);
        $stmt->bindValue(':user', $user, PDO::PARAM_STR);
        $stmt->bindValue(':pass', $pass, PDO::PARAM_STR);
        $stmt->execute();
        $stmt->closeCursor();
    } catch (PDOException $exc) {
        return FALSE;
    }
}
コード例 #8
0
ファイル: functions.php プロジェクト: afmiguez/test
function queryMysqli($query, array $params)
{
    $conPDO = dbConnection();
    try {
        //prepare the query
        $result = $conPDO->prepare($query);
        //execute the query with the passed parameters
        $result->execute($params);
        //close the database connection
        $conPDO = null;
        return $result;
    } catch (PDOException $e) {
        trigger_error('Error: ' . $e->getMessage(), E_USER_ERROR);
    }
}
コード例 #9
0
function getAlldetails($id, $lat, $lng)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "SELECT * FROM `servicesubcatrelation` a,`ownerservice` b,`servicebranch` c WHERE a.sub_category_id={$id} and a.service_id=b.service_id and b.service_id=c.service_id ";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        $data = array();
        //! retrieve the result from the result set
        while ($aRow = mysqli_fetch_assoc($res)) {
            if (distance($lat, $aRow['branch_lat'], $lng, $aRow['branch_lng']) < 300) {
                $data[] = $aRow;
            }
        }
        //! Closing the connections
        dbConnectionClose($rConnection);
        //! Message Login
        comment_message_log('Query Executed Successfully.::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
        return $data;
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}
コード例 #10
0
function aGetAllTags()
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "SELECT * FROM `interests` ORDER BY `id` DESC;";
    //! Executing the query
    $rResultSet = mysqli_query($rConnection, $sQuery);
    //! Closing the connections
    dbConnectionClose($rConnection);
    /*!
     *  Check If the Query executed properly
     */
    if ($rResultSet != '') {
        //! Message Login
        comment_message_log('Query Executed Successfully. ::: ' . $sQuery);
        $aData = array();
        //! retrieve the result from the result set
        while ($aRow = mysqli_fetch_assoc($rResultSet)) {
            $aData[] = $aRow;
        }
        comment_message_log('End of Function : ' . __FUNCTION__);
        return $aData;
    } else {
        //! Message Loggin
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00100;
    }
}
コード例 #11
0
ファイル: admin.php プロジェクト: saurabhgarg1996/Admin_Panel
function aGetUserbyPass($user, $pass)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "SELECT * FROM `admin` where `email` = '{$user}' AND `password` = '{$pass}';";
    //! Executing the query
    $rResultSet = mysqli_query($rConnection, $sQuery);
    //! Closing the connections
    dbConnectionClose($rConnection);
    /*!
     *  Check If the Query executed properly
     */
    if ($rResultSet != '') {
        //! Message Login
        comment_message_log('Query Executed Successfully. ::: ' . $sQuery);
        $aData = array();
        //! retrieve the result from the result set
        while ($aRow = mysqli_fetch_assoc($rResultSet)) {
            $aData = $aRow;
        }
        comment_message_log('End of Function : ' . __FUNCTION__);
        return $aData;
    } else {
        //! Message Loggin
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00100;
    }
}
コード例 #12
0
function insertintoservicesused($user_id, $service_id, $single_id, $freeserivce_id, $created_at)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "INSERT INTO `services_used` (`id`,`user_id`,`service_id`, `singleent_id`,`freeservice_id` `timeStamp`) VALUES (NULL, '{$user_id}','{$service_id}','{$single_id}','{$freeservice_id}' ,'{$created_at}');";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        $user_id = mysqli_insert_id($rConnection);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return $user_id;
        //! Message Login
        comment_message_log('Query Executed Successfully.::: owner_id = $owner_id ::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}
コード例 #13
0
function insertintoownerapp($owner_name, $owner_email, $service_mobile_num, $password, $created_at, $isActive, $type)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "INSERT INTO `ownerapp` (`owner_id`,`owner_name`, `owner_email`, `service_mobile_number`, `password`, `timeStamp`,`isActive`,`type`) VALUES (NULL, '{$owner_name}','{$owner_email}','{$service_mobile_num}','{$password}','{$created_at}','{$isActive}','{$type}');";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        $owner_id = mysqli_insert_id($rConnection);
        //! Closing the connections
        dbConnectionClose($rConnection);
        //! Message Login
        comment_message_log('Query Executed Successfully.::: owner_id = $owner_id ::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
        return $owner_id;
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}
コード例 #14
0
function insertintofreeservicedb($owner_id, $branch_id, $frees_name, $free_description, $counter, $created_at, $validity)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "INSERT INTO `freeservicedb` (`id`,`owner_id`, `branch_id`,`free_name` ,`free_description`,`counter`,`timestamp`,`validity`) VALUES (NULL, '{$owner_id}', '{$branch_id}','{$free_name}','{$free_description}','{$counter}', '{$created_at}','{$validity}');";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        $id = mysqli_insert_id($rConnection);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return $id;
        //! Message Login
        comment_message_log('Query Executed Successfully.::: owner_id = $owner_id ::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}
コード例 #15
0
function insertintosingleent($owner_id, $category_id, $ent_name, $ent_details, $ent_website, $isActive, $listingType, $ProvidesFreeSrvc, $premiumStartDate, $premiumEndDate, $amount_paid, $created_at)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "INSERT INTO `servicebranch` (`ent_id`,`owner_id`,`category_id`,`ent_name`,`ent_details`,`ent_website`,`isActive` ,`listingType` ,`ProvidesFreeSrvc` ,`premiumStartDate` ,`premiumEndDate`,`amt_paid`,`timeStamp`) VALUES (NULL, '{$owner_id}', '{$category_id}','{$ent_name} ','{$ent_details}','{$ent_website}','{$isActive}' ,'{$listingType}' ,'{$ProvidesFreeSrvc}' ,'{$premiumStartDate}' ,'{$premiumEndDate}','{$amount_paid} ','{$created_at}');";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        $ent_id = mysqli_insert_id($rConnection);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return $ent_id;
        //! Message Login
        comment_message_log('Query Executed Successfully.::: owner_id = $owner_id ::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}
コード例 #16
0
function insertintoservicesubcatrelation($service_id, $ent_id, $free_id, $subcategory_id)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "INSERT INTO `servicesubcatrelation` (`service_id`,`ent_id`,`free_id`,`sub_category_id`) VALUES ('{$service_id}','{$ent_id}','{$free_id}','{$subcategory_id}');";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        mysqli_insert_id($rConnection);
        //! Closing the connections
        dbConnectionClose($rConnection);
        //! Message Login
        comment_message_log('Query Executed Successfully.::: owner_id = $owner_id ::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}
コード例 #17
0
function insertintofriend($name, $data)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "INSERT INTO `friend_list` (`user_id`,`friend_name`) VALUES ('{$data}', '{$name}');";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        mysqli_insert_id($rConnection);
        //! Closing the connections
        dbConnectionClose($rConnection);
        //! Message Login
        comment_message_log('Query Executed Successfully.::: owner_id = $owner_id ::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}
コード例 #18
0
function updatefreeservice_id($freeservice_id, $rating)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "UPDATE `freeservicedb` SET `avg_rating`='{$rating}' WHERE `id`='{$freeservice_id}'";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        //! Closing the connections
        dbConnectionClose($rConnection);
        return $rating_id;
        //! Message Login
        comment_message_log('Query Executed Successfully.::: owner_id = $owner_id ::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}
コード例 #19
0
function searchinservice($string)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "SELECT `service_id`,`service_name` FROM `ownerservice` WHERE `service_name` OR `service_details` LIKE '%{$string}%'";
    //! Executing the query
    $rResultSet = mysqli_query($rConnection, $sQuery);
    //! Closing the connections
    dbConnectionClose($rConnection);
    /*!
     *  Check If the Query executed properly
     */
    if ($rResultSet != '') {
        //! Message Login
        comment_message_log('Query Executed Successfully. ::: ' . $sQuery);
        $aData = array();
        //! retrieve the result from the result set
        while ($aRow = mysqli_fetch_assoc($rResultSet)) {
            $aData[] = $aRow;
        }
        comment_message_log('End of Function : ' . __FUNCTION__);
        return $aData;
    } else {
        //! Message Loggin
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00100;
    }
}
コード例 #20
0
<div id="barLibro">Prestamo</div>

<form action="insertPrestamo.php" method="post" id="frmPrestamo" name="frmPrestamo" enctype="multipart/form-data">
<table border="0" cellspacing="2" cellpadding="5">

<tr>
<td><label rel="Codigo Miembro" >Codigo Miembro:</label></td>
<td><input type="text" name="txtmiembro" id="txtmiembro" class="in" /></td>
</tr>

<tr>
<td><label rel="isbn">Isbn:</label></td>
<td><select name="txtisbn" id="txtisbn">
<?php 
require_once "config/dbConnection.php";
dbConnection();
$query = "SELECT isbn FROM libro WHERE estado = 'Disponible' ";
$result = mysql_query($query);
while ($datos = mysql_fetch_array($result, MYSQL_ASSOC)) {
    ?>


<option value="<?php 
    echo $datos["isbn"];
    ?>
"><?php 
    echo $datos["isbn"];
    ?>
</option>

<?php 
コード例 #21
0
function addintofriendlist($user_id, $friend)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "INSERT INTO `friend_list` (`user_id`,`friend_name`) VALUES ('{$user_id}','{$friend_name}');";
    //! Executing the query
    $rResultSet = mysqli_query($rConnection, $sQuery);
    //! Closing the connections
    dbConnectionClose($rConnection);
    /*!
     *  Check If the Query executed properly
     */
    if ($rResultSet != '') {
        //! Message Login
        comment_message_log('Query Executed Successfully. ::: ' . $sQuery);
        //! retrieve the result from the result set
        comment_message_log('End of Function : ' . __FUNCTION__);
        return 1;
    } else {
        //! Message Loggin
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00100;
    }
}
コード例 #22
0
function iUpdatesubCats($sub_category_id, $category_id, $subcategoryname, $showinapp)
{
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "UPDATE sub_category SET `category_id` = '{$category_id}' , `sub_category_name` = '{$subcategoryname}',`show_in_app` = '{$showinapp}' WHERE `sub_category_id` = '{$sub_category_id}' ";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        //! Closing the connections
        dbConnectionClose($rConnection);
        //! Message Login
        comment_message_log('Query Executed Successfully.::: id = $iId ::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}
コード例 #23
0
ファイル: modules.php プロジェクト: harshatjk/ERA81
function sendPassword($email)
{
    $conn = dbConnection();
    $sql = "select Password from memberdetails where Email='{$email}'";
    $result = $conn->query($sql);
    if ($result->num_rows > 0) {
        while ($row = $result->fetch_assoc()) {
            $to = "*****@*****.**";
            $subject = "This is subject";
            $message = "This is simple text message.";
            $header = "From:harshatjk@gmail.com \r\n";
            $retval = mail($to, $subject, $message, $header);
            if ($retval == true) {
            } else {
                echo "Message could not be sent...";
            }
        }
    }
}
コード例 #24
0
function getAllfriendservices($id)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "SELECT * FROM `friend_list` a,`user` b,`services_used` c WHERE a.user_id={$id} and b.full_name=a.friend_name and c.user_id=b.user_id";
    //! Executing the query
    $rResultSet = mysqli_query($rConnection, $sQuery);
    //! Closing the connections
    dbConnectionClose($rConnection);
    /*!
     *  Check If the Query executed properly
     */
    if ($rResultSet != '') {
        //! Message Login
        comment_message_log('Query Executed Successfully. ::: ' . $sQuery);
        $aData = array();
        //! retrieve the result from the result set
        while ($aRow = mysqli_fetch_assoc($rResultSet)) {
            $aData[] = $aRow;
        }
        comment_message_log('End of Function : ' . __FUNCTION__);
        return $aData;
    } else {
        //! Message Loggin
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00100;
    }
}
コード例 #25
0
ファイル: config.php プロジェクト: Covert-Inferno/evegate
<?php

/**
 * configuration
 */
//setup db connection - mysql
$setup['db_ip'] = '127.0.0.1';
$setup['db_user'] = '******';
$setup['db_pass'] = '******';
$setup['db_name'] = 'database_name';
$link = dbConnection($setup['db_ip'], $setup['db_user'], $setup['db_pass'], $setup['db_name']);
//configure from mail
$from_mail = '*****@*****.**';
コード例 #26
0
ファイル: functions.php プロジェクト: gvh574/cs313-php
function insertReview($review)
{
    $db = dbConnection();
    try {
        $sql = 'INSERT INTO review(comment) VALUES(:review)';
        $stmt = $db->prepare($sql);
        $stmt->bindValue(':review', $review, PDO::PARAM_STR);
        $stmt->execute();
        $lastid = $db->lastInsertId();
        $stmt->closeCursor();
    } catch (PDOException $e) {
        echo $message = "PDO Failure";
    }
    if ($lastid) {
        return $lastid;
    } else {
        return FALSE;
    }
}
コード例 #27
0
ファイル: getCategories.php プロジェクト: vladimirgor/exam
<?php

//categories set for updating
include_once __DIR__ . '/config.php';
require_once __DIR__ . '/functions.php';
$table = CATEGORIES;
$pdo = dbConnection();
//table categories truncate
try {
    $stmt = $pdo->prepare("\n        TRUNCATE `{$table}` ");
    $stmt->execute([':email' => $email]);
} catch (PDOException $e) {
    echo "Category truncate error: " . $e->getMessage();
    die;
}
//categories set insert into the categories table
foreach ($categories as $category) {
    try {
        $stmt = $pdo->prepare("\n            INSERT INTO `{$table}` (`category`)\n            VALUES (:category)");
        $stmt->execute([':category' => $category]);
    } catch (PDOException $e) {
        echo "Category insert error: " . $e->getMessage();
        die;
    }
}
echo json_encode($categories);