Ejemplo n.º 1
0
    exit;
}
if (!isset($_POST['password']) || empty($_POST['password'])) {
    header("Location: /index.php?m=5");
    // not enough credentials passed
    exit;
}
$location = "/";
$users = new UserManager();
$cookies = new Cookies();
$data = $users->auth_user($_POST["username"], $_POST["password"]);
$auth_level = $data[0];
$user_uid = $data[1];
if ($auth_level !== 0) {
    // user is valid
    $cookies->set_cookie($user_uid);
    if ($auth_level != 1) {
        $location = "/admin.php";
        //         header("Location: /admin.php");
        //         exit;
    } else {
        $location = "/index.php";
        //         header("Location: /index.php?m=6"); // success no message
        //         exit;
    }
} else {
    $location = "/index.php?m=4";
    //     header("Location: /index.php?m=4"); // invalid credentials
    //     exit;
}
if (isset($_POST["redirect"])) {
Ejemplo n.º 2
0
// Social Authentication (Facebook) connect
$app->post('/accounts/facebook/connect', function () use($app) {
    $facebook_id = $app->request->input('facebook_id');
    $email = $app->request->input('email');
    $password = $app->request->input('password');
    $user = app('db')->table('accounts')->where('email', 'like', $email)->first();
    // store ID
    if (!empty($user)) {
        require_once __DIR__ . '/../../public/includes/all.php';
        $manager = new UserManager();
        $auth = $manager->auth_user($email, $password);
        // validate password
        if (!empty($auth[1])) {
            app('db')->table('accounts')->where('id', $user->id)->update(['facebook_id' => $facebook_id]);
            $cookies = new Cookies();
            $cookies->set_cookie($user->uid);
            return redirect('/profile.php?p=2&m=6');
        }
    }
    return redirect('/index.php?m=2');
});
// Save main category settings
$app->post('/admin/category/{categoryId}', function ($categoryId) use($app) {
    $inputs = $app->request->input();
    if (empty($inputs['name'])) {
        unset($inputs['name']);
    }
    // grab existing service
    $category = app('db')->table('categories')->where('id', $categoryId)->first();
    if ($category->displayorder != $inputs['displayorder']) {
        // swap existing order
Ejemplo n.º 3
0
$inputs = app('request')->input();
if (!filter_var($inputs['email'], FILTER_VALIDATE_EMAIL)) {
    array_push($errors, 'Invalid email');
}
if (!isPhone($inputs['phone'])) {
    array_push($errors, 'Invalid phone');
}
if (!empty($errors)) {
    header("Location: /index.php?m=13");
    exit;
}
if ($user->is_account_available($_POST["email"])) {
    $id = $user->add_user($_POST["name"], $_POST["email"], $_POST["password"], $_POST["phone"]);
    if ($id != 0) {
        $user_obj = $user->get_user_from_insertid($id);
        $cookies->set_cookie($user_obj->data["uid"]);
        // log the user in
        //        header("Location: /index.php?m=1");
        header("Location: /profile.php?p=2&m=6");
        exit;
        //        successful!
        //        send an email?
        //        $new_user = $user->get_user_from_insertid($id);
        //        echo "Created account " . $id  . ". Sending email.";
    }
    //    else{
    //        echo "f**k";
    //    }
} else {
    //    echo "Failed to create account because of availability.";
    header("Location: /index.php?m=2");