示例#1
0
 public function gdrive()
 {
     error_reporting(E_ALL);
     ini_set('display_errors', 1);
     module_load_include('inc', 'nodeapi', 'nodegapi');
     $code = $_GET['code'];
     $folderid = '0B6BzhFrjrlMwUVJEdm41ckd0R2M';
     $v = authenticateuser($code, $folderid);
     print $v;
     die;
 }
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
require "../header.php";
connecttodatabase();
if ($_POST['chack']) {
    if ($_POST['usesame'] != 1) {
        $filename = $_POST['id'] . "_" . $_FILES['profilepic']['name'];
        if ($_FILES["profilepic"]['error'] == 0 && ($_FILES['profilepic']["type"] == "image/jpeg" || $_FILES['profilepic']["type"] == "image/gif" || $_FILES['profilepic']["type"] == "image/png")) {
            if (executequery("update member set profilepic='" . $filename . "' where id=" . $_POST['id'])) {
                move_uploaded_file($_FILES['profilepic']['tmp_name'], "../images/user/{$filename}");
                $query = executequery("select * from member where id=" . $_POST['id']);
                $row = mysql_fetch_array($query);
                authenticateuser($_POST['id'], $row['membername']);
                header("Location:../main.php");
            } else {
                die("error occured");
            }
        }
    } else {
        $query = executequery("select * from member where id=" . $_POST['id']);
        $row = mysql_fetch_array($query);
        if (copy($_SERVER['DOCUMENT_ROOT'] . "/joinfamily/pic/" . str_replace($row['profilepic'], " ", "%20"), $_SERVER['DOCUMENT_ROOT'] . "/images/user/" . str_replace($row['profilepic'], " ", "%20"))) {
            unlink("pic/" . $row['profilepic']);
        } else {
            echo urlencode($_SERVER['DOCUMENT_ROOT'] . "/joinfamily/pic/" . $row['profilepic']);
            echo "<br>";
            echo urlencode($_SERVER['DOCUMENT_ROOT'] . "/images/user/" . $row['profilepic']);
            die("For some reason not able to upload your profile pic");