Example #1
0
function GetAllUsersList($mailAdd)
{
    global $connection;
    $response = "<div class='row'>";
    $id = "";
    $email = "";
    $interests = "";
    try {
        if (checkIfUserExists($mailAdd) == "1") {
            $query = "select * from Users";
            $rs = mysql_query($query);
            if (!$rs) {
                $response = "-1";
            } else {
                while ($res = mysql_fetch_array($rs)) {
                    $id = $res["UserID"];
                    $email = $res["UserEmail"];
                    $interests = getInterests($email, $id);
                    $in = explode(" @I ", $interests);
                    $interests = "";
                    foreach ($in as $i) {
                        if ($i == "-" || $i == " " || $i == "" || $i == "-3") {
                        } else {
                            $interests .= $i . ", ";
                        }
                    }
                    $interests = substr($interests, 0, strlen($interests) - 2);
                    if ($interests == "") {
                        $interests = "-1";
                    }
                    if ($res["UserPic"] == "") {
                        $res["UserPic"] = "img/dp.jpg";
                    }
                    // <p class='userLocation'><span>Expertise in: </span> <u>" . $interests . "</u> </p>
                    if ($interests == "-1") {
                        //$response .= "<div class='list-group-item item'><div class='media-left media-top'><img src='" . $res["UserPic"] . "' class='media-object userImage' width='120' height='120' /></div><div class='userItem'><p class='userName'>" . $res["UserName"] . "</p><p class='userReadMore'><a class='readMoreLink' data-id='" . $id . "' data-email='" . $email . "' href='#'>Read More...</a></p></div><button class='btn btn-lg btn-primary btn-block btnConnRequest' data-id='" . $id . "' data-email='" . $email . "' data-profile='" . $res["UserProfile"] . "'>Connect on LinkedIn</button></div>" . " (BR) ";
                        $response .= "<div class='col-lg-6 col-md-6'><div class='thumbnail'><img class='media-object userImage' width='130' height='130' src='" . $res["UserPic"] . "' /><div class='caption'><p class='userName'>" . $res["UserName"] . "</p><p class='userLocation'><span>Expertise in: </span> <u>" . "None" . "</u> </p><p class='userReadMore'><a class='readMoreLink' data-id='" . $id . "' data-email='" . $email . "' href='#'>Read More...</a></p></div><button class='btn btn-lg btn-primary btn-block btnConnRequest' data-id='" . $id . "' data-email='" . $email . "' data-profile='" . $res["UserProfile"] . "'>Connect on LinkedIn</button></div></div>" . " (BR) ";
                    } else {
                        //$response .= "<div class='list-group-item item'><div class='media-left media-top'><img src='" . $res["UserPic"] . "' class='media-object userImage' width='120' height='120' /></div><div class='userItem'><p class='userName'>" . $res["UserName"] . "</p><p class='userLocation'><span>Expertise in: </span> <u>" . $interests . "</u> </p><p class='userReadMore'><a class='readMoreLink' data-id='" . $id . "' data-email='" . $email . "' href='#'>Read More...</a></p></div><button class='btn btn-lg btn-primary btn-block btnConnRequest' data-id='" . $id . "' data-email='" . $email . "' data-profile='" . $res["UserProfile"] . "'>Connect on LinkedIn</button></div>"  . " (BR) ";
                        if (strlen($interests) >= 15) {
                            $interests = substr($interests, 0, 15);
                            $interests .= "...";
                        }
                        $response .= "<div class='col-lg-6 col-md-6'><div class='thumbnail'><img class='media-object userImage' width='130' height='130' src='" . $res["UserPic"] . "' /><div class='caption'><p class='userName'>" . $res["UserName"] . "</p><p class='userLocation'><span>Expertise in: </span> <u>" . $interests . "</u> </p><p class='userReadMore'><a class='readMoreLink' data-id='" . $id . "' data-email='" . $email . "' href='#'>Read More...</a></p></div><button class='btn btn-lg btn-primary btn-block btnConnRequest' data-id='" . $id . "' data-email='" . $email . "' data-profile='" . $res["UserProfile"] . "'>Connect on LinkedIn</button></div></div>" . " (BR) ";
                    }
                }
            }
            $response .= "</div>";
        } else {
            if (checkIfUserExists($mailAdd) == "-1") {
                // user does not exists.
                $response = "-1";
            } else {
                $response = "-2";
            }
        }
        return $response;
    } catch (Exception $e) {
        $response = "-2";
        return $response;
    }
}
require_once ".\\includes\\connection.php";
?>

<?php 
//echo "in userHistory";
$uname = $_SESSION["login_user"];
$videoArray = array();
if (isset($profile_uname)) {
    //echo "<p>not the same user</p>";
    $user = $profile_uname;
    $watchedVideos = null;
    getWatchedVideos($uname);
    $interests = null;
    $recommendation_factor = null;
    getInterests($uname);
} else {
    //echo "<p>same user</p>";
    $user = $uname;
}
getRatedVideos($user);
class Video
{
    var $lid;
    var $url;
    var $profileUserRating;
    var $loggedUserRating;
    var $recommendation;
    var $overallRating;
    function __construct($lid, $url, $profileUserRating, $loggedUserRating, $recommendation, $overallRating)
    {
function LoadData($email, $id)
{
    $res = "";
    $res2 = "";
    $id = "";
    $per = "";
    $edu = "";
    $exp = "";
    $intr = "";
    try {
        //assign the id here first.
        $id = getUserID($email);
        if ($id == "-1") {
            $res = "-3";
            echo $res;
            return;
        }
        if (checkIfUserExists($email) == "-1") {
            $res = "-2";
            //user does not exists. Add the user here.
        } else {
            // Also, check if the user here is Verified or not. If verified, go ahead. Else, return with a code(-5 for non verified user.).
            if (IsVerifiedUser($email) == "1") {
                $per = getPersonalData($email, $id);
                $edu = getEducationData($email, $id);
                $exp = getExperienceData($email, $id);
                $intr = getInterests($email, $id);
                if ($per == "" || $per == "-1") {
                    $res2 = "-4";
                    $res .= "-4" . " @bk ";
                    // echo $res;
                    // return;
                } else {
                    $res .= $per . " @bk ";
                }
                if ($edu == "" || $edu == "-1") {
                    $res2 = "-4";
                    $res .= "-4" . " @bk ";
                    // echo $res;
                    // return;
                } else {
                    $res .= $edu . " @bk ";
                }
                if ($exp == "" || $exp == "-1") {
                    $res2 = "-4";
                    $res .= "-4" . " @bk ";
                    // echo $res;
                    // return;
                } else {
                    $res .= $exp . " @bk ";
                }
                if ($intr == "" || $intr == "-1") {
                    $res2 = "-4";
                    $res .= "-4" . " @bk ";
                    // echo $res;
                    // return;
                } else {
                    if ($intr == "-3") {
                        $res .= "-5" . " @bk ";
                        // -5 is for when the data row does not exists.
                    } else {
                        $res .= $intr . " @bk ";
                    }
                }
            } else {
                if (IsVerifiedUser($email) == "0") {
                    $res = "-5";
                    // for non-verified user.
                } else {
                    $res = "-1";
                }
            }
        }
        echo $res . " ~ " . $res2;
    } catch (Exception $e) {
        $res = "-1";
        echo $res;
    }
}