Example #1
0
 function login()
 {
     $email = $_POST['login_email'];
     $password = $_POST['login_password'];
     $id = User::getIdByEmail($email);
     if (!User::loginIsValid($email, md5($password))) {
         throw new Exception("Error when loggin in user.");
     }
     if (!User::accountIsActivated($id)) {
         echo "Your account has not yet been activated. Click \r\n\t\t\tthe link in the confirmation email which was sent to your email account when you registered";
         return;
     }
     $this->session->set_userdata('userid', $id);
     redirect('/main');
 }
Example #2
0
 public static function addEmployee($name, $emp_id, $address_1, $address_2, $landmark, $city, $state, $pincode, $phone, $fax, $email, $website, $description)
 {
     $defaultPassword = '******';
     if (!empty($_SESSION['user']['company'])) {
         //$retCode = User::add($name, '', $emp_id, $defaultPassword, $phone, $phone, $email,  $address_1, $address_2, $landmark, $city, $state, $pincode, $_SESSION['user']['company']);
         if (User::add($name, '', $emp_id, $defaultPassword, $phone, $phone, $email, $address_1, $address_2, $landmark, $city, $state, $pincode, $_SESSION['user']['company'])) {
             User::activate(User::getIdByEmail($email));
             $mEmployee = new User(User::getIdByEmail($email));
             $mAddedBy = new User();
             $mEmployee->SetAddedby($mAddedBy->getId());
             Mailer::sendEmployeeAddedMessage($name, $emp_id, $email, $defaultPassword, $_SESSION['user']['company'], $mAddedBy->getFullname());
             return Timeline::addTimelineEvent("staff_addition", "", "", $mEmployee->getId(), $mAddedBy->getId(), 1);
             return true;
         }
         return false;
     } else {
         return false;
     }
 }
Example #3
0
        }
        break;
    case "logout":
        if ($mUser->logout()) {
            header('Location:login.php');
            exit;
        } else {
            header('Location:abc.php');
            exit;
        }
        break;
    case "activate":
        if (!isset($_GET['email']) || !isset($_GET['key'])) {
            echo "<script>window.location.href = '../user/login.php'</script>";
            break;
        }
        $email = $_GET['email'];
        $key = $_GET['key'];
        $id = User::getIdByEmail($email);
        $securityKey = Security::getSecurityKey($id);
        if ($key == $securityKey) {
            //die("match!!");
            if (User::activate($id)) {
                header('Location:activate.php?q=1');
            }
        } else {
            //die("sorry!!");
            echo "<script>window.location.href = '../user/login.php'</script>";
        }
        break;
}
    if (!empty($_POST['title']) && !empty($_POST['rating'])) {
        $user = new User();
        $post = new MediaPost();
        $from_user = $_SESSION['authenticated_user'];
        $title = $_POST['title'];
        $rating = $_POST['rating'];
        $comment = $_POST['comment'];
        $date_created = date("Y-m-d H:i:s");
        $media = $post->getMediaIdByTitle($title);
        if (!$media) {
            $media = $post->storeMedia($title);
            $new_media = true;
        }
        if ($_POST['review_type'] == 'private') {
            $email = $_POST['username'];
            $to_user = $user->getIdByEmail($email);
            if ($to_user) {
                $post->storeRecommendation($from_user, $to_user, $media, $rating, $comment, $date_created);
            } else {
                $error = "User with email did not exist";
            }
        } else {
            $post->storePublicReview($from_user, $media, $rating, $comment, $date_created);
        }
    }
    if ($error === "") {
        ?>

    <div class="container">
        <div class="jumbotron">
            <span>Recommendation Created</span><br/>
Example #5
0
 public static function resetpasswordmail($id)
 {
     $securityKey = Security::getSecurityKey($id);
     $idk = User::getIdByEmail($id);
     $passresetlink = "http://www.findgaddi.com/navigator/ui/user/resetPassword.php?id={$idk}&key={$securityKey}";
     $messagereset = '<br > Please click on the below link or if link does not work please copy paste the link in your browser.<br >';
     $messagereset .= $passresetlink;
     return Mailer::SendResetPasswd($id, 'Please reset your passwword', $messagereset);
 }
Example #6
0
</head>

<body>
    <section id="head-bar">
        <?php 
require_once 'user.php';
$login_successful = false;
if (!empty($_POST['email']) && !empty($_POST['password'])) {
    $email = $_POST['email'];
    $password = hash("sha256", $_POST['password']);
    $authUser = new User();
    $checkUser = $authUser->checkLoginCredentials($email, $password);
    if ($checkUser) {
        $first_name = $authUser->getFirstNameByEmail($email);
        $last_name = $authUser->getLastNameByEmail($email);
        $_SESSION['authenticated_user'] = $authUser->getIdByEmail($email);
        $login_successful = true;
    } else {
        $login_successful = false;
    }
}
?>
        <?php 
include_once 'navbar.php';
?>
    </section>


    <div class="container">
        <div class="jumbotron">
        <?php 
Example #7
0
        <?php 
include_once 'navbar.php';
?>
    </section>
    <div class="container">
        <?php 
if (isset($_SESSION['authenticated_user'])) {
    require_once 'watchlist.php';
    require_once 'mediapost.php';
    require_once 'user.php';
    $watchlist = new Watchlist();
    $post = new MediaPost();
    $user = new User();
    if ($_SERVER['REQUEST_METHOD'] === 'POST') {
        if (!empty($_POST['friend_email'])) {
            $new_friend_id = $user->getIdByEmail($_POST['friend_email']);
            if (!$new_friend_id) {
                echo "<h2 style='color: white; background-color: #d61616;'>User not found with email address " . $_POST['friend_email'] . ". Try again.</h2>";
            } else {
                $date_created = date("Y-m-d H:i:s");
                $watchlist->addNewBoy($_SESSION['authenticated_user'], $new_friend_id, $date_created);
            }
        }
    }
    $this_user = $_SESSION['authenticated_user'];
    $friends = $watchlist->getMyBoys($this_user);
    if ($friends) {
        while ($friend = $friends->fetch_object()) {
            $friend_watchlist = $watchlist->getWatchlistForUser($friend->friend);
            $url_string = "conversation.php?friend_id=" . $friend->friend;
            $user_email = $post->getUserById($friend->friend)->email;