示例#1
0
<?php

ob_start();
session_start();
session_regenerate_id();
/**
 * Created by IntelliJ IDEA.
 * User: TipsyCoder
 * Date: 10/3/15
 * Time: 3:10 PM
 */
//TODO FIX THIS
if (isset($_SESSION['user']) && isset($_GET)) {
    if ($_GET['opt'] === 'deleteMe') {
        deleteMe($_SESSION['user']['email']);
        session_destroy();
    }
}
function connectDatabase()
{
    $DB = null;
    $config = array('host' => 'localhost', 'username' => 'we_tipsy', 'password' => '123456', 'dbname' => 'bigyaadtree');
    $DB = new mysqli($config['host'], $config['username'], $config['password'], $config['dbname']);
    if ($DB->connect_error) {
        die('Connected failed: ' . $DB->connect_error);
    }
    return $DB;
}
function closeDatabase($DB)
{
    $DB->close();
<?php

/**
 * Created by PhpStorm.
 * User: TipsyCoder
 * Date: 11/17/15
 * Time: 3:01 PM
 */
require_once '../core/data.php';
if (isset($_SESSION['user']) && isset($_GET)) {
    if ($_GET['opt'] === 'deleteUser') {
        deleteMe($_GET['em']);
    }
}
if (isset($_SESSION['user']) && isset($_GET)) {
    if ($_GET['opt'] === 'deleteRelation') {
        deleteRelation($_GET['pEm'], $_GET['cEm']);
    }
}
if (isset($_SESSION['user']) && isset($_GET)) {
    if ($_GET['opt'] === 'changePassword') {
        changePassword($_GET['em'], $_GET['pass']);
    }
}
function deleteRelation($pEmail, $cEmail)
{
    $con = connectDatabase();
    $lastLogin = null;
    while (1) {
        $stmt = $con->prepare("CALL deleteRelationship(?,?)");
        $stmt->bind_param("ss", $pEmail, $cEmail);