コード例 #1
0
ファイル: index.php プロジェクト: Zzepish/CMS-for-phone
    $orderByUp = ', `eventUpInCatAll` DESC';
    $eventFreezeTime = '`eventUpInCatAll`';
    $and = '';
    if (isset($_GET['cityId'])) {
        $filters[] = '`spotCityId` = ' . (int) $_GET['cityId'] . ' ';
    }
    if (isset($_GET['catId'])) {
        $filters[] = '`eventCatId` = ' . (int) $_GET['catId'] . ' ';
        $orderByUp = ', `eventUpInCat` DESC';
        $eventFreezeTime = '`eventUpInCat`';
    }
    if (isset($_GET['SubCatId'])) {
        $filters[] = ' `eventSubCatId` = ' . (int) $_GET['SubCatId'] . ' ';
    }
    if (isset($_GET['textSearchRequest'])) {
        $filters[] = ' MATCH (`eventName`,`eventInfo`) AGAINST (\'' . $dbConnection->ms($_GET['textSearchRequest']) . '\' IN BOOLEAN MODE) ';
    }
    $_GET['from'] = isset($_GET['from']) ? (int) $_GET['from'] : 0;
    $_GET['amount'] = isset($_GET['amount']) ? (int) $_GET['amount'] : 10;
    $and = count($filters) > 0 ? ' AND ' : '';
    $query = $dbConnection->mq('
										SELECT 
											*,
											IF(`eventFreezeTime`>=NOW(),1,0) as VIP
										FROM
											`event`
										INNER JOIN
											`eventSpots`
										ON
											`eventSpotsEventId` = `eventId`
										INNER JOIN
コード例 #2
0
function authorize(Mysql $mysql)
{
    if (!isset($_POST['email'], $_POST['pass'])) {
        exit;
    }
    $query = $mysql->mq('
								SELECT
									`companyId`
								FROM
									`company`
								WHERE 
									`companyMail` = "' . $mysql->ms($_POST['email']) . '"
								AND
									`companyPassword` = "' . Security::generatePassword($_POST['email'], $_POST['pass']) . '"
								LIMIT 1
									
						');
    if ($query->num_rows) {
        $_SESSION['userId'] = $mysql->assoc($query)['companyId'];
    }
    echo $query->num_rows;
}