Example #1
0
function fetch_status()
{
    $db = new Database();
    $db->connect();
    $user_id = 1;
    $content = $_GET['content'];
    $time = date("Y/m/d");
    $query = "insert into status(user_id , content , time) values('{$user_id}','{$content}','{$time}')";
    $result = $db->run_query($query);
    post_status();
}
Example #2
0
function fetch_status()
{
    session_start("login");
    $db = new Database();
    $db->connect();
    //$user_id = $_SESSION['user_id'];
    $content = $_GET['content'];
    $time = date("Y/m/d");
    $query = "insert into status(user_id , content , time) values('" . $_SESSION['user_id'] . "','{$content}','{$time}')";
    $result = $db->run_query($query);
    post_status();
}
Example #3
0
function post_status()
{
    include_once 'include/connection.php';
    $db = new Database();
    $db->connect();
    //$_SESSION['user_id'] = $_SESSION['user_id'];
    //$query1 = "select * from status NATURAL JOIN friends NATURAL JOIN users WHERE ((user_id =".$_SESSION['user_id']." OR friend_id=".$_SESSION['user_id']." )AND request_pending=1) ORDER BY status_id DESC";
    $query1 = "select * from status NATURAL JOIN users WHERE (user_id = " . $_SESSION['user_id'] . "  OR user_id IN (Select friend_id from friends where user_id=" . $_SESSION['user_id'] . " )) ORDER BY status_id DESC";
    $result = $db->run_query($query1);
    @($num = mysqli_num_rows($result));
    if ($num == 0) {
        /* $query2 = "select * from status NATURAL JOIN users WHERE user_id = ".$_SESSION['user_id']." ORDER BY status_id DESC";
             $result1 = $db->run_query($query2);
        
             while($row = mysqli_fetch_array($result1))
                 {
        	             echo '<div class="panel panel-primary">
        	             <div class="panel-body"><strong>'.
        	             ucfirst(strtolower($row["user_nicename"])).'</strong> posted on <strong>'.$row["time"] .'</strong></br> <hr width="100%"></hr>'.
        	             $row["content"].' </br> '.'
        	             </div>
        
        	             <div class="panel-footer">
        	             <a href="#" onclick="like_status(this); return false;" name="+'.$row["status_id"].'"><span class="glyphicon glyphicon-thumbs-up"></span>&nbsp</a><font face="verdana" color="green"><span id="up_'.$row['status_id'].'">'.$row["likes"].'</span> likes</font>&nbsp&nbsp&nbsp
                         <a href="#" onclick="like_status(this); return false;" name="-'.$row["status_id"].'"><span class="glyphicon glyphicon-thumbs-down"></span>&nbsp</a><font face="verdana" color="red"><span id="down_'.$row['status_id'].'">'.$row["dislikes"].'</span> dislikes </font>
          	             </div>
        	             </div>';
        //OR s.user_id = $_SESSION['user_id']
        
                 }*/
        echo "<div style='margin-top:40px;' class='panel panel-primary'>\n                    <div class='panel-body' style='background-color:white; border:1px double white; border-radius:8px;'>\n                    <span style=' color:#286090; font-family:monospace; font-size:18px; font-weight:500;'><p>Welcome..Know all that is there!!</p></span>\n                    <p style='color:#787878; text-align:justify;'>Welcome to Connect. It allows you to find old friends to connect with and to discover new ones and \n\nit's finally here to make your social scene hip and happening.Share your thoughts and read those \n\nof others, post statuses and send friend requests to your friends and interests. Use the \n\ninteractive search bar to see if the people you know have discovered this plethora of activity \n\ntoo. Apart from this, you have the option of whether to accept a friend request or not, and to \n\nlike or dislike any post.</p>\n                    <p><span style='float:right; font-family:cursive; font-size:15px' ; >start exploring.....</span></p>\n                    </div>\n               </div>";
    } else {
        while ($row = mysqli_fetch_array($result)) {
            echo '<div class="panel panel-primary">
	             <div class="panel-body"><span style="color:#606060"><strong>' . ucfirst(strtolower($row["user_nicename"])) . '</strong></span> posted on <strong style="color:#606060">' . date('d-M-y', strtotime($row["time"])) . '</strong></br> <hr width="100%"></hr><span style="word-wrap:break-word">' . $row["content"] . '</span> </br> ' . '
	             </div>

	             <div class="panel-footer">
	             <a href="#" onclick="like_status(this); return false;" name="+' . $row["status_id"] . '"><span class="glyphicon glyphicon-thumbs-up"></span>&nbsp</a><font face="verdana" color="#006600"><span id="up_' . $row['status_id'] . '">' . $row["likes"] . '</span> likes </font>&nbsp&nbsp&nbsp
                 <a href="#" onclick="like_status(this); return false;" name="-' . $row["status_id"] . '"><span class="glyphicon glyphicon-thumbs-down"></span>&nbsp</a><font face="verdana" color="#A00000 "><span id="down_' . $row['status_id'] . '">' . $row["dislikes"] . '</span> dislikes </font>
  	             </div>
	             </div>';
            //OR s.user_id = $_SESSION['user_id']
        }
    }
}
Example #4
0
// Gather user information
$email = $_GET['email'];
$password = $_GET['password'];
$name = $_GET['name'];
$dob = $_GET['dob'];
$dob = date('Y/m/d', strtotime($dob));
$work = $_GET['work'];
//echo $dob1;
if (empty($email) || empty($password) || empty($name) || empty($dob) || empty($work)) {
    $show = '<div class="alert alert-danger"><p>Please fill all the fields...</p></div>';
} else {
    $db = new Database();
    $db->connect();
    //checking for duplicate user
    $query = "Select user_email from users where user_email='{$email}'";
    $result = $db->run_query($query);
    @($num = mysqli_num_rows($result));
    //echo $num;
    if ($num == 0) {
        $query = "insert into users (user_email , user_pass , user_nicename , dob , work) values ( '{$email}' , '{$password}' , '{$name}' , '{$dob}' , '{$work}')";
        $result = $db->run_query($query);
        if ($result) {
            $show = '<div class="alert alert-success"><p>Account has been created</p></div>';
        }
    } else {
        $show = '<div class="alert alert-danger"><p>Duplicate user or some problem with Database</p></div>';
    }
}
echo $show;
$show = "";
//echo $num;
<?php

include_once 'include/connection.php';
session_start("login");
$db = new Database();
$db->connect();
$message = $_GET['message'];
if (isset($_SESSION['friend_id_lv'])) {
    if (!empty($message)) {
        $query1 = "insert into messages (from_user , to_user , message , status) values ('" . $_SESSION['user_id'] . "','" . $_SESSION['friend_id_lv'] . "','{$message}' , 0)";
        $result = $db->run_query($query1);
    } else {
        echo "some pb";
    }
} else {
    echo "select a friend to chat with...";
}
$db->disconnect();
$name = "";
$message = "";
if (isset($_SESSION['sound'])) {
    echo $_SESSION['sound'];
}
Example #6
0
<?php

session_start("login");
include 'include/connection.php';
$db = new Database();
$db->connect();
//$_SESSION['user_id'] = $_SESSION['user_id'];
$id = $_GET['id'];
// friend id
$query1 = "update friends set request_pending = 1 WHERE (user_id = {$id}) AND (friend_id = " . $_SESSION['user_id'] . ")";
$result1 = $db->run_query($query1);
$query2 = "insert into friends (user_id , friend_id , request_pending) values (" . $_SESSION['user_id'] . " , {$id} , 1)";
$result2 = $db->run_query($query2);