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


PHP mysql_select_single函数代码示例

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


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

示例1: mysql_select_single

 // Verify that user can afford this offer.
 if ($player_points >= $buy['points']) {
     $data = mysql_select_single("SELECT `points` FROM `znote_accounts` WHERE `account_id`='{$cid}';");
     if (!$data) {
         die("0: Account is not converted to work with Znote AAC");
     }
     $old_points = $data['points'];
     if ((int) $old_points != (int) $player_points) {
         die("1: Failed to equalize your points.");
     }
     // Remove points if they can afford
     // Give points to user
     $expense_points = $buy['points'];
     $new_points = $old_points - $expense_points;
     $update_account = mysql_update("UPDATE `znote_accounts` SET `points`='{$new_points}' WHERE `account_id`='{$cid}'");
     $data = mysql_select_single("SELECT `points` FROM `znote_accounts` WHERE `account_id`='{$cid}';");
     $verify = $data['points'];
     if ((int) $old_points == (int) $verify) {
         die("2: Failed to equalize your points." . var_dump((int) $old_points, (int) $verify, $new_points, $expense_points));
     }
     // Do the magic (insert into db, or change sex etc)
     // If type is 2 or 3
     if ($buy['type'] == 2) {
         // Add premium days to account
         user_account_add_premdays($cid, $buy['count']);
         echo '<font color="green" size="4">You now have ' . $buy['count'] . ' additional days of premium membership.</font>';
     } else {
         if ($buy['type'] == 3) {
             // Character Gender
             mysql_insert("INSERT INTO `znote_shop_orders` (`account_id`, `type`, `itemid`, `count`, `time`) VALUES ('{$cid}', '" . $buy['type'] . "', '" . $buy['itemid'] . "', '" . $buy['count'] . "', '{$time}')");
             echo '<font color="green" size="4">You now have access to change character gender on your characters. Visit <a href="myaccount.php">My Account</a> to select character and change the gender.</font>';
开发者ID:l04d,项目名称:ZnoteAAC,代码行数:31,代码来源:shop.php

示例2: user_character_is_compatible

function user_character_is_compatible($pid)
{
    $data = mysql_select_single("SELECT COUNT(`player_id`) AS `count` from `znote_players` WHERE `player_id` = '{$pid}';");
    return $data !== false ? $data['count'] : 0;
}
开发者ID:niemoralny,项目名称:ZnoteAAC,代码行数:5,代码来源:database2znoteaac.php

示例3: getCache

function getCache()
{
    $results = mysql_select_single("SELECT `cached` FROM `znote`;");
    return $results !== false ? $results['cached'] : false;
}
开发者ID:peonso,项目名称:ZnoteAAC,代码行数:5,代码来源:general.php

示例4: rand

                $newpass = rand(100000000, 999999999);
                $salt = '';
                if ($config['TFSVersion'] != 'TFS_03') {
                    // TFS 0.2 and 1.0
                    $password = sha1($newpass);
                } else {
                    // TFS 0.3/4
                    if (config('salt') === true) {
                        $saltdata = mysql_select_single("SELECT `salt` FROM `accounts` WHERE `email`='{$email}' LIMIT 1;");
                        if ($saltdata !== false) {
                            $salt .= $saltdata['salt'];
                        }
                    }
                    $password = sha1($salt . $newpass);
                }
                $user = mysql_select_single("SELECT `p`.`id` AS `player_id`, `a`.`name`, `a`.`id` AS `account_id` FROM `players` `p` INNER JOIN `accounts` `a` ON `p`.`account_id` = `a`.`id` WHERE `p`.`name` = '{$character}' AND `a`.`email` = '{$email}' AND `a`.`name` = '{$username}' LIMIT 1;");
                if ($user !== false) {
                    // Found user
                    // Give him the new password
                    mysql_update("UPDATE `accounts` SET `password`='{$password}' WHERE `id`='" . $user['account_id'] . "' LIMIT 1;");
                    // Send him a mail with the new password
                    $mailer = new Mail($config['mailserver']);
                    $title = "{$_SERVER['HTTP_HOST']}: Your new password";
                    $body = "<h1>Account Recovery</h1>";
                    $body .= "<p>Your new password is: <b>{$newpass}</b><br>";
                    $body .= "We recommend you to login and change it before you continue playing. <br>";
                    $body .= "Enjoy your stay at " . $config['mailserver']['fromName'] . ". <br>";
                    $body .= "<hr>I am an automatic no-reply e-mail. Any emails sent back to me will be ignored.</p>";
                    $mailer->sendMail($email, $title, $body, $user['name']);
                    ?>
					<h1>Account Found!</h1>
开发者ID:l04d,项目名称:ZnoteAAC,代码行数:31,代码来源:recovery.php

示例5: user_character_id

}
//if (isset($_POST['name'])) $name = getValue($_POST['name']);
// Stage 2: Fetch user id and skills
$skills = false;
$pid = 0;
if ($name !== false) {
    if (user_character_exist($name)) {
        $pid = user_character_id($name);
        if ($config['TFSVersion'] != 'TFS_10') {
            $skills = mysql_select_multi("SELECT `value` FROM `player_skills` WHERE `player_id`='{$pid}' LIMIT 7;");
            $player = mysql_select_single("SELECT `maglevel`, `level`, `vocation` FROM `players` WHERE `id`='{$pid}' LIMIT 1;");
            $skills[] = array('value' => $player['maglevel']);
            $skills[] = array('value' => $player['level']);
            $skills[] = array('value' => $player['vocation']);
        } else {
            $player = mysql_select_single("SELECT `skill_fist`, `skill_club`, `skill_sword`, `skill_axe`, `skill_dist`, `skill_shielding`, `skill_fishing`, `maglevel`, `level`, `vocation` FROM `players` WHERE `id`='{$pid}' LIMIT 1;");
            $skills = array(0 => array('value' => $player['skill_fist']), 1 => array('value' => $player['skill_club']), 2 => array('value' => $player['skill_sword']), 3 => array('value' => $player['skill_axe']), 4 => array('value' => $player['skill_dist']), 5 => array('value' => $player['skill_shielding']), 6 => array('value' => $player['skill_fishing']), 7 => array('value' => $player['maglevel']), 8 => array('value' => $player['level']), 9 => array('value' => $player['vocation']));
        }
        //data_dump($skills, false, "Player skills");
    } else {
        $name = false;
    }
}
?>
<form action="" method="<?php 
if (!$name) {
    echo "get";
} else {
    echo "post";
}
?>
开发者ID:l04d,项目名称:ZnoteAAC,代码行数:31,代码来源:admin_skills.php

示例6: protect_page

include 'layout/overall/header.php';
protect_page();
admin_only($user_data);
// Declare as int
$view = isset($_GET['view']) && (int) $_GET['view'] > 0 ? (int) $_GET['view'] : false;
if ($view !== false) {
    if (!empty($_POST['reply_text'])) {
        sanitize($_POST['reply_text']);
        // Save ticket reply on database
        $query = array('tid' => $view, 'username' => getValue($_POST['username']), 'message' => getValue($_POST['reply_text']), 'created' => time());
        $fields = '`' . implode('`, `', array_keys($query)) . '`';
        $data = '\'' . implode('\', \'', $query) . '\'';
        mysql_insert("INSERT INTO `znote_tickets_replies` ({$fields}) VALUES ({$data})");
        mysql_update("UPDATE `znote_tickets` SET `status`='Staff-Reply' WHERE `id`='{$view}' LIMIT 1;");
    }
    $ticketData = mysql_select_single("SELECT * FROM znote_tickets WHERE id='{$view}' LIMIT 1;");
    ?>
	<h1>View Ticket #<?php 
    echo $ticketData['id'];
    ?>
</h1>
	<table class="znoteTable ThreadTable table table-striped">
		<tr class="yellow">
			<th>
				<?php 
    echo getClock($ticketData['creation'], true);
    ?>
				 - Created by: 
				 <?php 
    echo $ticketData['username'];
    ?>
开发者ID:peonso,项目名称:ZnoteAAC,代码行数:31,代码来源:admin_helpdesk.php

示例7: mysql_update

                // POST update
                if ($changelogId > 0) {
                    mysql_update("UPDATE `znote_changelog` SET `text`='{$changelogText}' WHERE `id`='{$changelogId}' LIMIT 1;");
                    echo "<h2>Changelog message updated!</h2>";
                    $updateCache = true;
                } else {
                    // POST create
                    $time = time();
                    mysql_insert("INSERT INTO `znote_changelog` (`text`, `time`, `report_id`, `status`) VALUES ('{$changelogText}', '{$time}', '0', '35');");
                    echo "<h2>Changelog message created!</h2>";
                    $updateCache = true;
                }
            }
        }
        if ($action === 2) {
            $old = mysql_select_single("SELECT `text` FROM `znote_changelog` WHERE `id`='{$changelogId}' LIMIT 1;");
        }
        // HTML to create or update
        ?>
		<h3>Add or update changelog</h3>
		<form action="" method="POST">
			<input name="changelogId" type="hidden" value="<?php 
        echo $action === 2 ? $changelogId : 0;
        ?>
">
			<textarea rows="7" cols="40" maxlength="254" name="changelogText"><?php 
        echo $action === 2 ? $old['text'] : '';
        ?>
</textarea><br>
			<input type="submit" value="Add or update changelog">
		</form>
开发者ID:l04d,项目名称:ZnoteAAC,代码行数:31,代码来源:changelog.php

示例8: isset

 $oldname = $char_name;
 $newname = isset($_POST['newName']) ? getValue($_POST['newName']) : '';
 $player = false;
 if ($config['TFSVersion'] === 'TFS_10') {
     $player = mysql_select_single("SELECT `id`, `account_id` FROM `players` WHERE `name` = '{$oldname}'");
     $player['online'] = user_is_online_10($player['id']) ? 1 : 0;
 } else {
     $player = mysql_select_single("SELECT `id`, `account_id`, `online` FROM `players` WHERE `name` = '{$oldname}'");
 }
 // Check if user is online
 if ($player['online'] == 1) {
     $errors[] = 'Character must be offline first.';
 }
 // Check if player has bough ticket
 $accountId = $player['account_id'];
 $order = mysql_select_single("SELECT `id`, `account_id` FROM `znote_shop_orders` WHERE `type`='4' AND `account_id` = '{$accountId}' LIMIT 1;");
 if ($order === false) {
     $errors[] = 'Did not find any name change tickets, buy them in our <a href="shop.php">shop!</a>';
 }
 // Check if player and account matches
 if ($session_user_id != $accountId || $session_user_id != $order['account_id']) {
     $errors[] = 'Failed to sync your account. :|';
 }
 $newname = validate_name($newname);
 if ($newname === false) {
     $errors[] = 'Your name can not contain more than 2 words.';
 } else {
     if (empty($newname)) {
         $errors[] = 'Please enter a name!';
     } else {
         if (user_character_exist($newname) !== false) {
开发者ID:l04d,项目名称:ZnoteAAC,代码行数:31,代码来源:myaccount.php

示例9: header

             }
             $errors[] = 'The password to the account of character name: ' . $_POST['reset_pass'] . ' has been set to: ' . $_POST['new_pass'] . '.';
         } else {
             header('Location: changepassword.php');
             exit;
         }
     }
 }
 // Give points to character
 if (empty($_POST['points_char']) === false && empty($_POST['points_value']) === false) {
     $char = sanitize($_POST['points_char']);
     $points = (int) $_POST['points_value'];
     data_dump($_POST, false, "post data");
     $account = mysql_select_single("SELECT `account_id` FROM `players` WHERE `name`='{$char}' LIMIT 1;");
     data_dump($account, false, "fetching account id from players table");
     $znote_account = mysql_select_single("SELECT `id`, `points` FROM `znote_accounts` WHERE `account_id`='" . $account['account_id'] . "';");
     data_dump($znote_account, false, "Fetching existing points from znote_accounts");
     data_dump(array('Old:' => $znote_account['points'], 'New:' => $points, 'Total:' => $znote_account['points'] + $points), false, "Points calculation:");
     $points += $znote_account['points'];
     mysql_update("UPDATE `znote_accounts` SET `points`='{$points}' WHERE `account_id`='" . $account['account_id'] . "';");
 }
 // Set character position
 if (empty($_POST['position_name']) === false && empty($_POST['position_type']) === false) {
     if (user_character_exist($_POST['position_name'])) {
         if (array_key_exists($_POST['position_type'], $config['ingame_positions'])) {
             if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') {
                 set_ingame_position($_POST['position_name'], $_POST['position_type']);
             } else {
                 if ($config['TFSVersion'] == 'TFS_03') {
                     set_ingame_position03($_POST['position_name'], $_POST['position_type']);
                 }
开发者ID:peonso,项目名称:ZnoteAAC,代码行数:31,代码来源:admin.php

示例10: user_login_03

function user_login_03($username, $password)
{
    if (config('salt') === true) {
        $username = sanitize($username);
        $data = mysql_select_single("SELECT `salt`, `id`, `password`, `name` FROM `accounts` WHERE `name`='{$username}';");
        $salt = $data['salt'];
        if (!empty($salt)) {
            $password = sha1($salt . $password);
        } else {
            $password = sha1($password);
        }
        return $data !== false && $data['name'] == $username && $data['password'] == $password ? $data['id'] : false;
    } else {
        return user_login($username, $password);
    }
}
开发者ID:niemoralny,项目名称:ZnoteAAC,代码行数:16,代码来源:users.php

示例11: explode

                if (count($path) === 1) {
                    $path = explode('\\', $entity->getPathname());
                }
                $plugins[$path[1]] = $path[2];
            }
        }
    }
}
$response['modules'] = $plugins;
$response['data']['title'] = $config['site_title'];
$response['data']['slogan'] = $config['site_title_context'];
$response['data']['time'] = getClock(time(), false, true);
$response['data']['time_formatted'] = getClock(time(), true, true);
// Account count
$accounts = mysql_select_single("SELECT COUNT('id') AS `count` FROM `accounts`;");
$response['data']['accounts'] = $accounts !== false ? $accounts['count'] : 0;
// Player count
$players = mysql_select_single("SELECT COUNT('id') AS `count` FROM `players`;");
$response['data']['players'] = $players !== false ? $players['count'] : 0;
// online player count
if ($config['TFSVersion'] != 'TFS_10') {
    $online = mysql_select_single("SELECT COUNT('id') AS `count` FROM `players` WHERE `status`='1';");
} else {
    $online = mysql_select_single("SELECT COUNT('player_id') AS `count` FROM `players_online`;");
}
$response['data']['online'] = $online !== false ? $online['count'] : 0;
$response['data']['client'] = $config['client'];
$response['data']['port'] = $config['port'];
$response['data']['guildwar'] = $config['guildwar_enabled'];
$response['data']['forum'] = $config['forum']['enabled'];
SendResponse($response);
开发者ID:l04d,项目名称:ZnoteAAC,代码行数:31,代码来源:index.php

示例12: mysql_select_single

					<input name="create_thread_title" type="text" placeholder="Thread Subject" style="width: 592px;"><br><br>
					<textarea name="create_thread_text" style="width: 100%; height: 250px" placeholder="Message"></textarea><br>
					<br><input type="submit" value="Create Thread" class="btn btn-success">
				</form>
				<?php 
                        } else {
                            echo '<p><b><font color="red">Permission to create thread denied.</font></b></p>';
                        }
                    }
                } else {
                    /////////////////////
                    // When category is specified
                    if ($getCat !== false) {
                        $getCat = (int) $getCat;
                        // Fetch category rules
                        $category = mysql_select_single("SELECT `name`, `access`, `closed`, `hidden`, `guild_id` FROM `znote_forum` WHERE `id`='{$getCat}' AND `access`<='{$yourAccess}' LIMIT 1;");
                        if ($category !== false && $category['guild_id'] > 0 && !$admin) {
                            $access = false;
                            foreach ($charData as $char) {
                                if ($category['guild_id'] == $char['guild']) {
                                    $access = true;
                                }
                            }
                            if ($access !== true) {
                                $category = false;
                            }
                        }
                        if ($category !== false) {
                            // TODO : Verify guild access
                            //foreach($charData)
                            echo "<strong><a href='forum.php'>Forum</a> &raquo; " . $category['name'] . "</strong><br><br>";
开发者ID:peonso,项目名称:ZnoteAAC,代码行数:31,代码来源:forum.php

示例13: foreach

        }
    }
    ?>
<!-- leave guild with character -->
<?php 
    $bool = false;
    if (user_logged_in() === true) {
        for ($i = 0; $i < $char_count; $i++) {
            foreach ($players as $player) {
                if ($player['name'] == $characters[$i]) {
                    $bool = true;
                }
            }
        }
        if ($bool) {
            $forumExist = mysql_select_single("SELECT `id` FROM `znote_forum` WHERE `guild_id`='{$gid}' LIMIT 1;");
            if ($forumExist !== false) {
                ?>
 - <font size="4"><a href="forum.php?cat=<?php 
                echo $forumExist['id'];
                ?>
">Visit Guild Board</a></font><br><br><br><?php 
            }
            ?>

<form action="" method="post">
	<ul>
		<li>
			Leave Guild:<br>
			<select name="leave_guild">
				<option disabled>With...</option>
开发者ID:peonso,项目名称:ZnoteAAC,代码行数:31,代码来源:guilds.php

示例14: user_login

 if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') {
     $login = user_login($username, $password);
 } else {
     if ($config['TFSVersion'] == 'TFS_03') {
         $login = user_login_03($username, $password);
     } else {
         $login = false;
     }
 }
 if ($login === false) {
     $errors[] = 'Username and password combination is wrong.';
 } else {
     // Check if user have access to login
     $status = false;
     if ($config['mailserver']['register']) {
         $authenticate = mysql_select_single("SELECT `id` FROM `znote_accounts` WHERE `account_id`='{$login}' AND `active`='1' LIMIT 1;");
         if ($authenticate !== false) {
             $status = true;
         } else {
             $errors[] = "Your account is not activated. An email should have been sent to you when you registered. Please find it and click the activation link to activate your account.";
         }
     } else {
         $status = true;
     }
     if ($status) {
         setSession('user_id', $login);
         // if IP is not set (etc acc created before Znote AAC was in use)
         $znote_data = user_znote_account_data($login);
         if ($znote_data['ip'] == 0) {
             $update_data = array('ip' => ip2long(getIP()));
             user_update_znote_account($update_data);
开发者ID:l04d,项目名称:ZnoteAAC,代码行数:31,代码来源:login.php

示例15: protect_page

/*	PLAYER SKILLS REPAIR SCRIPT IF YOU SOMEHOW DELETE PLAYER SKILLS
	---------------------------------------------------------------
		Place in root web directory, login to admin account, 
		and enter site.com/repairSkills.php (with big S). 
*/
protect_page();
admin_only($user_data);
$Splayers = 0;
$Salready = 0;
$Sfixed = 0;
$players = mysql_select_multi("SELECT `id` FROM `players`;");
if ($players !== false) {
    $Splayers = count($players);
    foreach ($players as $char) {
        // Check if player have skills
        $skills = mysql_select_single("SELECT `value` FROM `player_skills` WHERE `player_id`='" . $char['id'] . "' AND `skillid`='2' LIMIT 1;");
        // If he dont have any skills
        if ($skills === false) {
            $Sfixed++;
            // Loop through every skill id and give him default skills.
            $query = "INSERT INTO `player_skills` (`player_id`, `skillid`, `value`, `count`) VALUES ";
            for ($i = 0; $i < 7; $i++) {
                if ($i != 6) {
                    $query .= "('" . $char['id'] . "', '{$i}', '10', '0'), ";
                } else {
                    $query .= "('" . $char['id'] . "', '{$i}', '10', '0');";
                }
            }
            mysql_insert($query);
        } else {
            $Salready++;
开发者ID:l04d,项目名称:ZnoteAAC,代码行数:31,代码来源:repairSkills.php


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