Beispiel #1
0
<?php

include 'templates/header.php';
include 'user.php';
include 'database/polls_fetch.php';
include "utilities/pollgoogle.php";
include_once 'templates/showPolls.php';
$all_groups = getGroupsByUserId(getUserIDbyUsername($_SESSION['username']));
include 'search_poll.php';
foreach ($all_groups as $group) {
    showPollGroupStat($group);
}
include 'templates/footer.php';
Beispiel #2
0
<?php

include 'database/polls_fetch.php';
include 'templates/header.php';
include 'user.php';
include_once 'templates/showPolls.php';
$all_groups = getAnsweredGroups(getUserIDbyUsername($_SESSION['username']));
include 'search_poll.php';
foreach ($all_groups as $item1) {
    showPollGroupStat($item1);
}
include 'templates/footer.php';
        }
    }
} else {
    if ($_SERVER["REQUEST_METHOD"] == "GET") {
        $username = $_GET['username'];
        $code = $_GET['codePw'];
        $_SESSION['tempUsername'] = $username;
        echo 'entrou no get';
        $stmt = $db->prepare('SELECT * FROM resetPw WHERE userId = :user  ');
        $stmt->bindParam(':user', getUserIDbyUsername($username), PDO::PARAM_STR);
        // $stmt->bindParam(':pword',$pword, PDO::PARAM_STR);
        $stmt->execute();
        $result = $stmt->fetch();
        if (validate_password($code, $result['tempCode'])) {
            $stmt = $db->prepare('DELETE FROM resetPw WHERE userId = :user');
            $stmt->bindParam(':user', getUserIDbyUsername($username), PDO::PARAM_STR);
            $stmt->execute();
        } else {
            header("location: polls_index.php");
        }
    }
}
?>


<center>
          <div id="registermodal" >
            <h1>New password</h1> <br>
            <form id="loginform" name="loginform" method="post" action="">
                           
              <label for="New password">New password:</label>
Beispiel #4
0
        $stmt->execute();
        $result = $stmt->fetch();
        if ($result[0] == $email) {
            // Generating Password
            $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#\$%&*_";
            /*$password = substr( str_shuffle( $chars ), 0, 8 );*/
            $code = substr(str_shuffle($chars), 0, 8);
            $link = "http://" . getUrlWithoutPage() . "/change_password_vialink.php?username="******"&codePw=" . $code;
            /*
            			$stmt = $db->prepare('UPDATE Utilizador SET Pword= :temppw WHERE username = :user');
            					$stmt->bindParam(':temppw',create_hash($password), PDO::PARAM_STR);
            					$stmt->bindParam(':user',$username, PDO::PARAM_STR);
            					$stmt->execute();
            */
            $stmt = $db->prepare('INSERT INTO resetPw (userId,tempCode) VALUES (?,?)');
            $stmt->execute(array(getUserIDbyUsername($username), create_hash($code)));
            echo $message = "Hello!\n\r\n\r\nIf you don't have an account on Polly or didn't ask for a new password please ignore this email. \n\r\n\r\nYour new password: "******"\n You can also click the following link to reset the password right now. Note that this link can only be used once, so if you don't reset your password you'll have to use the one we gave you in this email. \n LINK:" . $link;
            mail($email, 'New Password', $message, 'From: polly@forms.com');
            ///		header('Location: polls_index.php');
        }
    }
}
?>


<center>
        <div id="validatemodal" >
            <h1>Recover your account</h1> <br>
            <form id="loginform" name="loginform" method="POST" action="">
              <label for="username"> Enter your username :</label>
              <input type="text" name="username" id="username" class="txtfield" tabindex="1">
Beispiel #5
0
<?php

include_once 'database/polls_fetch.php';
include_once 'templates/showPolls.php';
//print_r($_POST);
if (isset($_POST['title']) && isset($_POST['username']) && isset($_POST['group']) && $_POST['title'] != '') {
    // Fetching variables of the form which travels in URL
    global $db;
    $title = htmlspecialchars($_POST['title']);
    /*$description = htmlspecialchars($_POST['description']);*/
    $userId = getUserIDbyUsername($_POST['username']);
    $options = $_POST['option'];
    //echo 'user name = '.$_POST['username'].' || user id = '.$userId.'<br>';
    //select last created group id
    $group = getGroupPoll(htmlspecialchars($_POST['group']));
    $groupId = $group['groupId'];
    //print_r($db->errorInfo());
    //adds the poll
    if ($title != '') {
        $stmt = $db->prepare('INSERT INTO poll(id,title,userId, titleHash, groupId) VALUES (?,?,?,?,?)');
        /*$titleHash = create_hash($title);*/
        $titleHash = md5('poll' . $title);
        $stmt->execute(array(NULL, $title, $userId, $titleHash, $groupId));
        //print_r($db->errorInfo()); echo '<br>';
    }
    //else echo 'titleVazio<br>';
    //verifies if all the options are filled
    foreach ($options as $option) {
        if ($option == '') {
            //echo 'optionVazia<br>';
        } else {
<?php

include 'templates/header.php';
include 'database/polls_fetch.php';
if (isset($_POST['create']) && isset($_POST['title']) && isset($_POST['description'])) {
    // Fetching variables of the form which travels in URL
    global $db;
    $title = htmlspecialchars($_POST['title']);
    $description = htmlspecialchars($_POST['description']);
    $userId = getUserIDbyUsername($_SESSION['username']);
    //adds the poll
    if ($title != '') {
        if ($description == '') {
            $description = "No description";
        }
        $stmt = $db->prepare('INSERT INTO groupPoll(groupId,title,description,userId,visibility, titleHash) VALUES (?,?,?,?,?,?)');
        /*$titleHash = create_hash($title);*/
        $titleHash = md5('groupPoll' . $title . $description);
        $stmt->execute(array(NULL, $title, $description, $userId, "Public", $titleHash));
        print_r($db->errorInfo());
        header("Location:new_poll2.php?questionnaire={$titleHash}");
    } else {
        header("Location: new_poll_group.php");
    }
}
include 'templates/footer.php';
?>

Beispiel #7
0
<?php

include 'templates/header.php';
include 'database/polls_fetch.php';
include_once 'utilities/getPollURL.php';
include_once 'templates/showPolls.php';
$all_polls = getPollByUser(getUserIDbyUsername($_SESSION['username']));
$all_groups = getPollGroupByUser(getUserIDbyUsername($_SESSION['username']));
include 'search_poll.php';
foreach ($all_groups as $group) {
    showPollGroupManage($group);
}
include 'templates/footer.php';