当前位置: 首页>>代码示例>>PHP>>正文


PHP sqlAction函数代码示例

本文整理汇总了PHP中sqlAction函数的典型用法代码示例。如果您正苦于以下问题:PHP sqlAction函数的具体用法?PHP sqlAction怎么用?PHP sqlAction使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sqlAction函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: session_start

<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    session_start();
    require '../../../mysql/query.php';
    $email = sqlEscape($_POST['email']);
    $the_password = sqlEscape($_POST['password_confirm']);
    if (strlen($the_password) > 5 && strlen($the_password) < 25 && filter_var($email, FILTER_VALIDATE_EMAIL)) {
        $password = sqlSelect("SELECT password FROM users WHERE user_id = {$_SESSION['user']['id']};");
        if (password_verify($the_password, $password[0]['password'])) {
            if (sqlAction("UPDATE users SET email = '{$email}' WHERE user_id = {$_SESSION['user']['id']};")) {
                echo json_encode(array('success' => true));
                die;
            }
        }
    }
}
开发者ID:pesa0015,项目名称:greatnonsens,代码行数:17,代码来源:change_email.php

示例2: session_start

<?php

if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    session_start();
    if (isset($_SESSION['company']['id']) && isset($_SESSION['me']['id']) && isset($_GET['service_id'])) {
        if (is_numeric($_SESSION['company']['id']) && is_numeric($_SESSION['me']['id']) && is_numeric($_GET['service_id'])) {
            require '../../mysql/query.php';
            if (sqlAction("INSERT INTO companies_employers_services (employer_id, service_id) VALUES ({$_SESSION['me']['id']}, {$_GET['service_id']});")) {
                header('Location: ../../company?show=services');
                die;
            }
        }
    }
}
开发者ID:pesa0015,项目名称:metajm,代码行数:14,代码来源:add_my_service.php

示例3: rtrim

                $update .= "name = CASE id {$update_description_text} END, ";
            }
            if ($update_price) {
                $update .= "price = CASE id {$update_price_text} END, ";
            }
            if ($update_time) {
                $update .= "time = CASE id {$update_time_text} END, ";
            }
            if ($update_category) {
                $update .= "category_id = CASE id {$update_category_text} END, ";
            }
            $update = rtrim($update, ', ');
            $rowsToUpdate = rtrim($rowsToUpdate, ',');
            $update .= " WHERE id IN ({$rowsToUpdate});";
            // echo $update;
            // die;
            if (sqlAction($update)) {
                $success = true;
            }
        }
    }
    if (empty($newServiceFirstKey["'category'"])) {
        $noNewServices = true;
    }
    if (!$update_description && !$update_price && !$update_time && !$update_category) {
        $noChangesToExistingServices = true;
    }
    if ($success || $noNewServices && $noChangesToExistingServices) {
        header('Location: ../../company?show=services');
    }
}
开发者ID:pesa0015,项目名称:metajm,代码行数:31,代码来源:add_service.php

示例4: session_start

<?php

if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    if (isset($_GET['story']) && is_numeric($_GET['story'])) {
        session_start();
        require '../../../mysql/query.php';
        $story = $_GET['story'];
        $info = sqlSelect("SELECT COUNT(story_writers.user_id) AS num_of_writers, started_by_user FROM story_writers INNER JOIN story ON story_writers.story_id = story.story_id WHERE story_writers.story_id = {$story};");
        if ($info[0]['num_of_writers'] > 2 && $info[0]['started_by_user'] == $_SESSION['me']['id']) {
            if (sqlAction("UPDATE story SET status = 1 WHERE story_id = {$story};")) {
                echo 1;
                die;
            }
        }
    }
}
开发者ID:pesa0015,项目名称:greatnonsens,代码行数:16,代码来源:start.php

示例5: session_start

<?php

if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    session_start();
    require '../../../mysql/query.php';
    require '../../../lang/config.php';
    if (isset($_SESSION['user']) && isset($_GET['id']) && is_numeric($_GET['id']) && isset($_GET['friend']) && is_numeric($_GET['friend'])) {
        if (sqlAction("DELETE FROM friends WHERE friend_request_id = {$_GET['id']} AND user_id = {$_GET['friend']} AND friend_user_id = {$_SESSION['user']['id']} AND status = 0 AND sender != {$_SESSION['user']['id']};")) {
            require '../../../lib/Firebase/url.php';
            getFirebase($require = true);
            $firebase = new Firebase\FirebaseLib($url, $token);
            $firebaseArray = array('from' => array('user_id' => $_SESSION['user']['id'], 'user_name' => "{$_SESSION['user']['name']}"), 'group' => 'false', 'story' => 'false', 'time' => time(), 'type' => 'rejected_friend_request', 'unread' => 'true');
            $firebase->push(usersNewsFeed($_GET['friend']), $firebaseArray);
            if (isset($_GET['return_to_profile'])) {
                header("Location: ../../../profile?view={$_GET['friend']}");
            }
            header('Location: ../../../profile?view=friends');
        }
    }
}
开发者ID:pesa0015,项目名称:greatnonsens,代码行数:20,代码来源:reject.php

示例6: sqlSelect

 }
 if (sqlAction($joinStory)) {
     $num_of_writers = $writers[0]['num_of_writers'] + 1;
     $story_writers = sqlSelect("SELECT user_id FROM `story_writers` WHERE story_id = {$story} AND user_id != {$_SESSION['me']['id']};");
     $clients = array();
     if ($writers[0]['max_writers'] == $num_of_writers) {
         if (sqlAction("UPDATE story SET status = 1 WHERE story_id = {$story};")) {
             if ($story_writers) {
                 $news_feed = "INSERT INTO users_news_feed (user_id, type_id, story_id, group_id, writer_id, have_read, date) VALUES";
                 foreach ($story_writers as $writer) {
                     $news_feed .= " ({$writer['user_id']}, 2, {$story}, null, null, 0, now()), ";
                     array_push($clients, 'private-' . $writer['user_id']);
                 }
                 $news_feed = rtrim($news_feed, ', ');
                 $news_feed .= ';';
                 if (sqlAction($news_feed)) {
                     $pusher->trigger($clients, 'news', json_encode(array('type' => 'story_began', 'value' => $story)));
                     echo 2;
                     die;
                 }
             }
         }
     } else {
         foreach ($story_writers as $writer) {
             array_push($clients, 'private-' . $writer['user_id']);
         }
         $pusher->trigger($clients, 'writer_joined_story', json_encode(array('story_id' => $story, 'num_of_writers' => $num_of_writers, 'writer' => $_SESSION['me'])));
         $pusher->trigger('main_channel', 'writer_joined_story', json_encode(array('story_id' => $story, 'num_of_writers' => $num_of_writers)));
         echo 1;
         die;
     }
开发者ID:pesa0015,项目名称:greatnonsens,代码行数:31,代码来源:join.php

示例7: session_start

<?php

if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    session_start();
    if (isset($_SESSION['company']['id']) && isset($_SESSION['me']['id']) && isset($_GET['service_id'])) {
        if (is_numeric($_SESSION['company']['id']) && is_numeric($_SESSION['me']['id']) && is_numeric($_GET['service_id'])) {
            require '../../mysql/query.php';
            if (sqlAction("DELETE FROM companies_employers_services WHERE employer_id = {$_SESSION['me']['id']} AND service_id = {$_GET['service_id']};")) {
                header('Location: ../../company?show=services');
                die;
            }
        }
    }
}
开发者ID:pesa0015,项目名称:metajm,代码行数:14,代码来源:remove_my_service.php

示例8: session_start

<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    session_start();
    require '../../../mysql/query.php';
    if (!is_numeric($_POST['news_id'])) {
        die;
    }
    $news_id = $_POST['news_id'];
    if (sqlAction("UPDATE users_news_feed SET have_read = 1 WHERE id = {$news_id} AND user_id = {$_SESSION['me']['id']};")) {
        echo 'have_read';
        die;
    }
}
开发者ID:pesa0015,项目名称:greatnonsens,代码行数:14,代码来源:read_news_feed.php

示例9: array_push

                    }
                    if ($friend['status'] == 0 && $friend['sender'] != $_SESSION['user']['id']) {
                        array_push($_SESSION['errors'], "<span class=\"ion-android-warning\"><a href=\"profile?view={$friend['user_id']}\">{$friend['username']}</a> har redan skickat vänförfrågan till dig");
                    }
                }
            }
        }
    }
    if ($_SESSION['errors']) {
        header('Location: ../../../profile?view=friends');
    }
    if (!$_SESSION['errors']) {
        require '../../../lib/Firebase/url.php';
        getFirebase($require = true);
        $firebase = new Firebase\FirebaseLib($url, $token);
        $firebaseArray = array('from' => array('user_id' => $_SESSION['user']['id'], 'user_name' => "{$_SESSION['user']['name']}"), 'group' => 'false', 'story' => 'false', 'time' => time(), 'type' => 'friend_request', 'unread' => 'true');
        $friend_request = "INSERT INTO friends (user_id, friend_user_id, status, sender, date) VALUES ";
        foreach ($users as $friend) {
            $friend_request .= "({$_SESSION['user']['id']}, {$friend['user_id']}, 0, {$_SESSION['user']['id']}, now()), ";
        }
        $friend_request = rtrim($friend_request, ', ');
        $friend_request .= ';';
        foreach ($users as $new_friend) {
            $firebase->push(usersNewsFeed($new_friend['user_id']), $firebaseArray);
        }
        if (sqlAction($friend_request)) {
            $_SESSION['noty_message'] = array('text' => $translate['noty_message']['friend_request_sent']['text'], 'type' => $translate['noty_message']['friend_request_sent']['type'], 'dismissQueue' => $translate['noty_message']['friend_request_sent']['dismissQueue'], 'layout' => $translate['noty_message']['friend_request_sent']['layout'], 'theme' => $translate['noty_message']['friend_request_sent']['theme'], 'timeout' => $translate['noty_message']['friend_request_sent']['timeout']);
            header('Location: ../../../profile?view=friends');
        }
    }
}
开发者ID:pesa0015,项目名称:greatnonsens,代码行数:31,代码来源:add.php

示例10: session_start

<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    session_start();
    require '../../../mysql/query.php';
    $old = sqlEscape($_POST['password']);
    $new = sqlEscape($_POST['new_password']);
    $new_repeat = sqlEscape($_POST['password_confirm']);
    if (strlen($old) > 5 && strlen($old) < 25 && strlen($new) > 5 && strlen($new) < 25 && strlen($new_repeat) > 5 && strlen($new_repeat) < 25 && $new === $new_repeat) {
        $password = sqlSelect("SELECT password FROM users WHERE user_id = {$_SESSION['user']['id']};");
        if (password_verify($old, $password[0]['password'])) {
            $pass = password_hash($new, PASSWORD_DEFAULT);
            if (sqlAction("UPDATE users SET password = '{$pass}' WHERE user_id = {$_SESSION['user']['id']};")) {
                echo json_encode(array('success' => true));
                die;
            }
        }
    }
}
开发者ID:pesa0015,项目名称:greatnonsens,代码行数:19,代码来源:change_password.php

示例11: session_start

<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    session_start();
    if (isset($_SESSION['company']['id']) && is_numeric($_SESSION['company']['id']) && isset($_SESSION['me']['id']) && is_numeric($_SESSION['me']['id']) && is_numeric($_POST['id'])) {
        require '../../mysql/query.php';
        $start = sqlEscape($_POST['start']);
        if (sqlAction("DELETE FROM bookings WHERE id = {$_POST['id']} AND start = '{$start}';")) {
            echo 1;
            die;
        } else {
            echo 0;
            die;
        }
        // $times = sqlSelect("SELECT id, booked_at, start, end, invoice, webpay, in_place FROM `bookings` WHERE DATE(`start`) = '{$day}' AND company_id = {$_SESSION['company']['id']} AND employer_id = {$_SESSION['me']['id']};");
        // if ($times)
        // 	echo json_encode($times);
        // else
        // 	echo 0;
        // die;
    }
}
开发者ID:pesa0015,项目名称:metajm,代码行数:22,代码来源:booking.remove.php

示例12: session_start

<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    session_start();
    require '../../../mysql/query.php';
    if (strlen($_POST['new_password']) < 6) {
        echo json_encode(array('password_too_short' => true));
        die;
    }
    if (strlen($_POST['new_password']) > 25) {
        echo json_encode(array('password_too_long' => true));
        die;
    }
    $password = sqlEscape($_POST['new_password']);
    $email = sqlEscape($_POST['email']);
    $token = sqlEscape($_POST['token']);
    $getUser = sqlSelect("SELECT user_id FROM users WHERE email = '{$email}' AND reset_password_key = '{$token}';");
    if ($getUser) {
        $newPassword = password_hash($password, PASSWORD_DEFAULT);
        if (sqlAction("UPDATE users SET password = '{$newPassword}', reset_password_key = null WHERE user_id = {$getUser[0]['user_id']} AND email = '{$email}' AND reset_password_key = '{$token}';")) {
            echo json_encode(array('success' => true));
            die;
        }
    }
}
开发者ID:pesa0015,项目名称:greatnonsens,代码行数:25,代码来源:reset_password.php

示例13: header

            $_SESSION['group']['description'] = $description;
        }
        header('Location: ../../../groups/new');
    } else {
        $group_id = sqlAction("INSERT INTO groups (name, secret, open, chat_is_public, description, created) VALUES ('{$name}', {$secret}, {$open}, {$chat}, '{$description}', now());", $getLastId = true);
        $group = sqlSelect("SELECT id, name FROM groups WHERE id = {$group_id};");
        if ($group_id) {
            $group_m = "INSERT INTO group_members (group_id, user_id, admin, joined) VALUES ({$group_id}, {$_SESSION['user']['id']}, 1, now());";
            // $group_activity_history = "INSERT INTO groups_activity_history (user_id, group_id) VALUES ({$_SESSION['user']['id']}, {$group_id});";
            sqlAction($group_m);
            // sqlAction($group_activity_history);
            $group_news_feed = "INSERT INTO group_news_feed (group_id, user_id, type, what, date) VALUES ({$group_id}, {$_SESSION['user']['id']}, 'group_created', 'null', now()), ";
            if (!empty($group_members)) {
                $group_invites = "INSERT INTO group_members (group_id, user_id, status, admin, joined) VALUES ";
                foreach ($users_exists as $user) {
                    $group_invites .= "({$group_id}, {$user['user_id']}, 2, 0, 'null'), ";
                    $group_news_feed .= "({$group_id}, {$_SESSION['user']['id']}, 'invited', '{\"id\":{$user['user_id']}, \"username\":\"{$user['username']}\"}', now()), ";
                }
                $group_invites = rtrim($group_invites, ', ');
                $group_invites .= ';';
                sqlAction($group_invites);
            }
            $group_news_feed = rtrim($group_news_feed, ', ');
            $group_news_feed .= ';';
            sqlAction($group_news_feed);
            $_SESSION['noty_message'] = array('text' => $translate['noty_message']['group_created']['text'], 'type' => $translate['noty_message']['group_created']['type'], 'dismissQueue' => $translate['noty_message']['group_created']['dismissQueue'], 'layout' => $translate['noty_message']['group_created']['layout'], 'theme' => $translate['noty_message']['group_created']['theme'], 'timeout' => $translate['noty_message']['group_created']['timeout']);
            // header('Location: ../../../groups?view=new');
            header('Location: ../../../groups/' . $group_id . '/news');
        }
    }
}
开发者ID:pesa0015,项目名称:greatnonsens,代码行数:31,代码来源:new.php

示例14: session_start

<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    session_start();
    require '../../mysql/query.php';
    if (isset($_SESSION['company']['id']) && is_numeric($_SESSION['company']['id']) && isset($_POST['id']) && is_numeric($_POST['id']) && !empty($_POST['timestamp'])) {
        $timestamp = sqlEscape($_POST['timestamp']);
        $schedule = sqlSelect("SELECT schedule.id, timestamp, booked, customers.first_name, customers.last_name, customers.mail FROM `schedule` LEFT JOIN customers ON schedule.customer_id = customers.id WHERE schedule.id = {$_POST['id']} AND timestamp = '{$timestamp}' AND company_id = {$_SESSION['company']['id']};");
        if ($schedule) {
            if (sqlAction("DELETE FROM schedule WHERE id = {$_POST['id']} AND timestamp = '{$timestamp}' AND company_id = {$_SESSION['company']['id']};")) {
                if ($schedule[0]['booked'] == 1) {
                } else {
                    echo 1;
                }
            }
        }
    }
}
开发者ID:pesa0015,项目名称:metajm,代码行数:18,代码来源:time.remove.php

示例15: session_start

<?php

if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    if (isset($_GET['story']) && is_numeric($_GET['story'])) {
        session_start();
        require '../../../mysql/query.php';
        $story = $_GET['story'];
        if (sqlAction("DELETE FROM story_writers WHERE story_id = {$story};") && sqlAction("DELETE FROM row WHERE story_id = {$story};")) {
            if (sqlAction("DELETE FROM story WHERE story_id = {$story};")) {
                echo 1;
                die;
            }
        }
    }
}
开发者ID:pesa0015,项目名称:greatnonsens,代码行数:15,代码来源:delete.php


注:本文中的sqlAction函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。