Esempio n. 1
0
function update($val, $email)
{
    $conn = getconn();
    if ($_SESSION["type"] == "stu") {
        $stmt = $conn->prepare("update user, student set user.password='******', student.password='******' where user.email=:myemail and user.email=student.email");
    } else {
        $stmt = $conn->prepare("update user, employer set user.password='******', employer.password='******' where user.email=:myemail and user.email=employer.email");
    }
    $stmt->bindParam(":myemail", $email);
    $result = $stmt->execute();
    if (!$result) {
        pdo_die($stmt);
    }
}
Esempio n. 2
0
function sql_add_post($email, $company_name, $position, $description, $job_content)
{
    $conn = getconn();
    $post_id = $conn->lastInsertId();
    $stmt = $conn->prepare("insert into post_info(email, company, position, tags, time, visit, fav) values(:email, :company, :position, :tags, now(), 0, 0)");
    $stmt->bindParam(':email', $email);
    $stmt->bindParam(':company', $company_name);
    $stmt->bindParam(':position', $position);
    $stmt->bindParam(':tags', $description);
    $result = $stmt->execute();
    $post_id = $conn->lastInsertId();
    if (!$result) {
        pdo_die($stmt);
    }
    $stmt = $conn->prepare("insert into post_content(postid, content) values(:postid, :content)");
    $stmt->bindParam(':postid', $post_id);
    $stmt->bindParam(':content', $job_content);
    $result = $stmt->execute();
    $post_id = $conn->lastInsertId();
    if (!$result) {
        pdo_die($stmt);
    }
    return 1;
}
Esempio n. 3
0
function sql_get_username_byEmail($email)
{
    $conn = getconn();
    $stmt = $conn->prepare("select name from user where email = :email");
    $stmt->bindParam(':email', $email);
    $result = $stmt->execute();
    if (!$result) {
        pdo_die($stmt);
    }
    $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
    if (count($result) == 0) {
        return 0;
    }
    return $result[0]['name'];
}
Esempio n. 4
0
}
?>
          </form>
      </div>
      </div>
    </div>
    <div id="menu3" class="tab-pane fade <?php 
if ($active_pos == 3) {
    echo 'in active';
}
?>
">
      <?php 
if (isset($_POST["submit"])) {
    $query = $_POST["content"];
    $conn = getconn();
    $result = $conn->query($query);
    if (!$result) {
        echo "What the f**k?";
        pdo_die($stmt);
    }
    foreach ($result->fetchALL(PDO::FETCH_ASSOC) as $row) {
        foreach ($row as $key => $value) {
            echo "[Key: " . $key . " value: " . $value . "]";
        }
        echo "<br>";
    }
} else {
    echo '<form method=post action=admin.php>';
    echo '<textarea class="form-control" name=content></textarea>';
    echo '<input type=submit name="submit" value = submit>';
Esempio n. 5
0
function Display_all_query()
{
    $conn = getconn();
    $stmt = $conn->prepare("select * from post_info order by time DESC;");
    $result = $stmt->execute();
    if (!$result) {
        echo "What the f**k?";
        pdo_die($stmt);
    }
    $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
    Print_Post($result);
}
Esempio n. 6
0
function searchPost($tag_array)
{
    $conn = getconn();
    $majorClass = $tag_array[0];
    $jobType = $tag_array[1];
    $query = "select postid from post_tags where (" . $majorClass . " = 0 or major_class = " . $majorClass . ") and (" . $jobType . " = 0 or job_type = " . $jobType . ")";
    $stmt = $conn->prepare($query);
    $result = $stmt->execute();
    if (!$result) {
        echo "What the f**k?";
        pdo_die($stmt);
    }
    $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
    /*
    	$pid_array = array();
    
    
    	while ($row = mysql_fetch_array($result)) {
    		array_push($pid_array, $row["postid"]);
    	}
    	return $pid_array;*/
    return $result;
}
Esempio n. 7
0
function Display_all_query($myemail)
{
    $conn = getconn();
    $stmt = $conn->prepare("select * from post_info P, user_fav F WHERE P.postid = F.postid and F.email = '" . $myemail . "' order by time DESC;");
    $result = $stmt->execute();
    if (!$result) {
        echo "What the f**k?";
        pdo_die($stmt);
    }
    $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
    $conn = getconn();
    $stmt = $conn->prepare("select * from user_fav as F WHERE F.email = '" . $myemail . "' order by F.postid;");
    $result2 = $stmt->execute();
    if (!$result2) {
        echo "What the f**k?";
        pdo_die($stmt);
    }
    $result2 = $stmt->fetchAll(PDO::FETCH_ASSOC);
    Print_Fav_Post($result, $myemail, 0, $result2);
}
Esempio n. 8
0
        }
        fclose($fp);
    }
}
function getconn(&$conn, &$active)
{
    $adminpassword = '******';
    $adminport = 88;
    $proxyaddress = 'mail.ccproxy.com';
    $fp = fsockopen($proxyaddress, $adminport, &$errno, &$errstr, 1000);
    if (!$fp) {
        echo "{$errstr} ({$errno})<br>\n";
    } else {
        $url_ = "/accountinfo";
        $auth = "Authorization: Basic " . base64_encode("admin:" . $adminpassword);
        $msg = "GET " . $url_ . " HTTP/1.0\r\nHost: " . $proxyaddress . "\r\n" . $auth . "\r\n" . "\r\n";
        fputs($fp, $msg);
        for ($i = 0; $i < 9; $i++) {
            $s = fgets($fp, 4096);
        }
        $conn = fgets($fp, 4096);
        $active = fgets($fp, 4096);
        fclose($fp);
    }
}
accountcreate("test", "111", "1", "20", "2005-05-30", "20:20:20");
accountedit("test", "111", "1", "20", "2005-05-30", "20:20:20");
accountdelete("test");
getconn($conn, $active);
echo $conn;
echo $active;