本文整理汇总了PHP中yasDB_select函数的典型用法代码示例。如果您正苦于以下问题:PHP yasDB_select函数的具体用法?PHP yasDB_select怎么用?PHP yasDB_select使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了yasDB_select函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createConfigFile
function createConfigFile()
{
$data = '';
$name = array();
$value = array();
$type = array();
$settings = array();
$result = yasDB_select("SELECT * FROM settings WHERE id = 1");
while ($meta = $result->fetch_field()) {
$name[] = $meta->name;
$type[] = $meta->type;
}
$i = 0;
while ($row = $result->fetch_row()) {
$count = count($row);
$y = 0;
while ($y < $count) {
$value[] = current($row);
next($row);
$y++;
}
$i++;
}
$result->free_result();
for ($i = 0; $i < count($name); $i++) {
$settings[$name[$i]][0] = $value[$i];
$settings[$name[$i]][1] = $type[$i];
}
ksort($settings);
$keys = array_keys($settings);
$values = array_values($settings);
$data = "<?php" . "\n";
$data .= "#--------------------------------\n# http://www.yourarcadescript.com\n# config.inc.php\n#\t\tVERSION 2.5\n#\t\tCC BY-ND 3.0 Licensed (http://creativecommons.org/licenses/by-nd/3.0/)\n# \n# Do not manually edit\n# Use Admin Cpanel\n#--------------------------------" . "\n";
for ($i = 0; $i < count($settings); $i++) {
if ($keys[$i] != 'id' && $keys[$i] != 'gapassword') {
if ($values[$i][1] == 3) {
$data .= "\$setting['" . $keys[$i] . "'] = " . $values[$i][0] . ";" . "\n";
} else {
$data .= "\$setting['" . $keys[$i] . "'] = '" . addslashes($values[$i][0]) . "';" . "\n";
}
}
}
$data .= "?>";
unset($name);
unset($settings);
unset($value);
global $setting;
$file = $setting['sitepath'] . '/includes/config.inc.php';
$h = fopen($file, 'w');
fwrite($h, $data);
fclose($h);
}
示例2: checkUser
function checkUser($uid, $oauth_provider, $username, $email, $twitter_otoken = '', $twitter_otoken_secret = '')
{
$query = yasDB_select("SELECT * FROM `user` WHERE oauth_uid = '{$uid}' and oauth_provider = '{$oauth_provider}'");
if ($query->num_rows != 0) {
# User is already present
} else {
#user not present. Insert a new Record
$query = yasDB_select("INSERT INTO `user` (oauth_provider, oauth_uid, username,email,twitter_oauth_token,twitter_oauth_token_secret,date) VALUES ('{$oauth_provider}', '{$uid}', '{$username}','{$email}','{$twitter_otoken}','{$twitter_otoken_secret}','" . time() . "')");
$query = yasDB_select("SELECT * FROM `user` WHERE oauth_uid = '" . $uid . "' and oauth_provider = '" . $oauth_provider . "' limit 1");
$result = $query->fetch_array(MYSQLI_BOTH);
return $result;
}
$result = $query->fetch_array(MYSQLI_BOTH);
return $result;
}
示例3: yasDB_clean
</label>
</div>
<?php
if (isset($_POST['edit_social'])) {
$fbid = yasDB_clean($_POST['fbAppId']);
$fbsecret = yasDB_clean($_POST['fbAppSecret']);
$twid = yasDB_clean($_POST['twAppId']);
$twsecret = yasDB_clean($_POST['twAppSecret']);
yasDB_update("UPDATE `settings` SET `fb_app_id` = '{$fbid}', `fb_app_secret` = '{$fbsecret}', `tw_app_id` = '{$twid}', `tw_app_secret` = '{$twsecret}' WHERE id = 1", false);
include "../includes/settings_function.inc.php";
createConfigFile();
echo '<center>Updated!';
echo '<br/><a href="index.php?act=socialids">Click to continue.</a></center>';
} else {
echo '<br/>';
$query = yasDB_select("SELECT `fb_app_id`, `fb_app_secret`, `tw_app_id`, `tw_app_secret` FROM `settings` WHERE `id` = 1");
$social = $query->fetch_array(MYSQLI_ASSOC);
?>
<div class="table">
<img src="img/bg-th-left.gif" width="8" height="7" alt="" class="left" />
<img src="img/bg-th-right.gif" width="7" height="7" alt="" class="right" />
<form name="app_ids" method="post" action="index.php?act=socialids">
<table class="listing form" cellpadding="0" cellspacing="0">
<tr>
<th class="full" colspan="2">Social App IDs</th>
</tr>
<tr>
<td class="first" style="width:100px;"><strong>Facebook App ID</strong></td>
<td class="last"><input type="text" name="fbAppId" value="<?php
echo $social['fb_app_id'];
?>
示例4: session_start
session_start();
require_once "../../../includes/db_functions.inc.php";
require_once "../../../includes/config.inc.php";
require_once "../../../includes/filelist.inc.php";
$dir = $setting['sitepath'] . '/avatars';
$files = dir_list($dir);
$os = array("gif", "jpg", "jpeg", "png", "GIF", "JPG", "JPEG", "PNG");
$n = 0;
$num = 0;
$count = count($files);
if ($count == 0) {
echo '<p>No free avatars available.</p>';
exit;
}
$avquery = yasDB_select("SELECT avatar FROM avatars WHERE userid = {$_SESSION['userid']}");
if ($avquery->num_rows != 0) {
while ($avfile = $avquery->fetch_array(MYSQL_ASSOC)) {
echo '
<div class="avatarpics">
<ul>
<li class="even"><input type="image" class="useravatars" src="' . $setting['siteurl'] . 'avatars/' . $avfile['avatar'] . '" onclick="switchAvatar(\'' . $avfile['avatar'] . '\');return false">
<center><input type="image" src="' . $setting['siteurl'] . 'templates/' . $setting['theme'] . '/skins/' . $setting['skin'] . '/images/close.png" height="15" width="15" name="avatar" value="Remove" onclick="deleteAvatar(\'' . addslashes($avfile['avatar']) . '\');return false"/></center></li>
</ul>
</div>';
}
}
$avquery->close();
while ($num < $count) {
$file = $files[$num]['name'];
$num++;
示例5: yasDB_clean
<?php
include "db_functions.inc.php";
$userid = yasDB_clean($_GET['uid']);
$query = yasDB_select("SELECT * FROM `user` WHERE `id` = '{$userid}'");
$userdata = $query->fetch_array(MYSQLI_ASSOC);
?>
<br/><br/>
<form id="profile" name="profile" method="post" action="index.php?act=profile">
<?php
if (!$userdata['oauth_provider']) {
?>
Name:<br />
<input type="text" name="name" value="<?php
echo $userdata['name'];
?>
" size="50" /><p>
<?php
}
if ($userdata['oauth_provider'] != "facebook") {
?>
Email:<br />
<input type="email" name="email" value="<?php
echo $userdata['email'];
?>
" size="50" /><p>
<?php
}
?>
Website:(Remember the http://)<br />
<input type="text" name="website" value="<?php
示例6: yasDB_select
<td style="background-color:#fff;width:100%;"><textarea name="description" id="description" style="width:100%;"></textarea></td>
</tr>
<tr>
<td class="first"><strong>Instructions</strong></td><td class="last"></td>
<tr>
<td style="background-color:#fff;width:100%;"><textarea name="instructions" id="instructions" style="width:100%;"></textarea></td>
</tr>
<tr class="bg">
<td class="first"><strong>Keywords</strong></td>
<td class="last"><input type="text" name="keywords" style="width:275px;"/></td>
</tr>
<tr>
<td class="first" width="172"><strong>Category</strong></td>
<td class="last"><select name="category">
<?php
$query = yasDB_select("SELECT * FROM categories", false);
while ($row = $query->fetch_array(MYSQLI_ASSOC)) {
echo '<option value="' . $row['id'] . '">' . $row['name'] . '</option>';
}
$query->close();
?>
</select></td>
</tr>
<tr class="bg">
<td class="first"><strong>Game File Type</strong></td>
<td class="last"><select name="type">
<option value="SWF">swf</option>
<option value="DCR">dcr</option>
</select></td>
</tr>
<tr>
示例7: yasDB_update
yasDB_update("UPDATE `ads` SET name = '{$name}', code = '{$code}' WHERE id = '{$id}'", false);
}
echo '<center>Updated!';
echo '<br><a href="index.php?act=ads">Click to continue.</a></center>';
} elseif (isset($_POST['delete_ad'])) {
$id = $_REQUEST["id"];
if ($id > 0 && $id < 12) {
yasDB_update("UPDATE ads SET code='Put AD code here' WHERE id = '{$id}'", false);
} else {
yasDB_delete("DELETE FROM ads WHERE id = '{$id}'", false);
}
echo '<center>The ad was deleted</center>';
echo '<center><br><a href="index.php?act=ads">Click to continue.</a></center>';
} else {
echo '<br/>';
$ads = yasDB_select("SELECT * FROM `ads` ORDER BY id asc", false);
while ($row = $ads->fetch_array(MYSQLI_ASSOC)) {
$ad = '<?php ';
$ad .= 'echo ad("' . $row['id'] . '");';
$ad .= ' ?>';
?>
<div class="table">
<img src="img/bg-th-left.gif" width="8" height="7" alt="" class="left" />
<img src="img/bg-th-right.gif" width="7" height="7" alt="" class="right" />
<form name="edit_ads" method="post" action="index.php?act=ads">
<input type="hidden" name="id" value="<?php
echo $row['id'];
?>
"/>
<table class="listing form" cellpadding="0" cellspacing="0">
<tr>
示例8: yasDB_select
<div class="navh3">
<div align="center">Top 5 Members</div>
</div>
<div class="links1">
<p align="left">
<?php
$query = yasDB_select("SELECT * FROM user order by plays desc limit 5", false);
while ($row = $query->fetch_array(MYSQLI_ASSOC)) {
$id = $row['id'];
$username = $row['username'];
$plays = $row['plays'];
if ($setting['seo'] == 'yes') {
$memberlink = $setting['siteurl'] . 'showmember/' . $id . '.html';
} else {
$memberlink = $setting['siteurl'] . 'index.php?act=showmember&id=' . $id;
}
echo '<a href="' . $memberlink . '">' . $username . ' - ' . $plays . ' plays</a><br>';
}
$query->close();
?>
</p></div>
示例9: yasDB_select
?>
</a>
</div>
<div class="clear"></div></div>
<?php
}
}
$query->close();
?>
<div class="clear"></div></div>
<!-- end of toprated -->
<!-- start of newest games box -->
<div class="container_box1"><div class="header">More Random Games</div>
<?php
$query = yasDB_select("SELECT id, title, thumbnail, description, plays FROM games ORDER BY rand() LIMIT 5", false);
if ($query->num_rows == 0) {
echo '<center><h3>We have no Newest games yet!</h3></center>';
}
if ($query->num_rows > 0) {
$pic_settings = array('w' => 130, 'h' => 100);
while ($games = $query->fetch_array(MYSQLI_ASSOC)) {
$gameurl = prepgame($games['title']);
$games['description'] = stripslashes($games['description']);
if (strlen($games['title']) > 19) {
$title = substr($games['title'], 0, 16) . '...';
} else {
$title = $games['title'];
}
if (file_exists($games['thumbnail'])) {
$thumbnail = urldecode($games['thumbnail']);
示例10: install_vascogame
function install_vascogame($gameid)
{
global $mysqli;
$query = yasDB_select("SELECT * FROM `vascogames` WHERE `id` = '{$gameid}'", false);
$result = $query->fetch_array(MYSQLI_ASSOC);
$categories = array('action games' => 2, 'adventure games' => 3, 'strategy games' => 10, 'skill games' => 10, 'puzzle games' => 1, 'arcade games' => 9, 'shooting games' => 5, 'sports games' => 4, 'misc games' => 7, 'car games' => 4);
//Strategy
// Download and save game file
if ($result['file']) {
$g_url = str_replace("..", "", $result['file']);
$game_file = basename($g_url);
$game_file = "vasco_" . preg_replace('#\\W#', '', $result['title']) . "." . GetFileExtension($result['file']);
$game_url = '../swf/' . $game_file;
download_file($g_url, $game_url);
} else {
return false;
}
// Download and save thumbnail pic
if ($result['thumbnail']) {
$t_url = str_replace("..", "", $result['thumbnail']);
$smallthumb = "vasco_" . preg_replace('#\\W#', '', $result['title']) . "." . GetFileExtension($result['thumbnail']);
$thumb = '../img/' . $smallthumb;
download_file($t_url, $thumb);
}
$desc = yasDB_clean($result['description']);
// Prep for DB insert
$gamename = yasDB_clean($result['title']);
$gamefile = yasDB_clean(str_replace("../", "", $game_url));
$gamethumb = yasDB_clean(str_replace("../", "", $thumb));
$height = $result['height'];
$width = $result['width'];
$c = $result['category'];
$category = $categories[$c];
$query->close();
if ($category == null || $category == '' || $category == 0) {
$category == 7;
}
$query = yasDB_insert("INSERT INTO `games` (`id`, `title`, `description`, `instructions`, `keywords`, `file`, `height`, `width`, `category`, `plays`, `code`, `type`, `source`, `sourceid`, `thumbnail`, `thumbnail_200`, `screen1`, `screen2`, `screen3`, `screen4`) VALUES (NULL, '{$gamename}', '{$desc}', '', '', '{$gamefile}', {$height}, {$width}, {$category}, 0, '', 'SWF', 'VASCOGAMES', {$gameid}, '{$gamethumb}', '', '', '','','')", false);
if (!$query) {
echo 'Error updating Games database';
return false;
}
$query = yasDB_update("UPDATE `vascogames` SET `installed` = 1 WHERE `id` = {$result['id']}", false);
if (!query) {
echo 'Error updating vascogames database';
return false;
}
return true;
}
示例11: yasDB_clean
if (isset($_SESSION['user'])) {
$user = yasDB_clean($_SESSION['user']);
yasDB_update("UPDATE `user` set topics = topics +1 WHERE username = '{$user}'");
// add a post to the user
yasDB_update("UPDATE `user` set totalposts = totalposts +1 WHERE username = '{$user}'");
// add a post to user total
yasDB_update("UPDATE `stats` set numbers = numbers +1 WHERE id = '3'");
// adds a post to Forum Total Posts
yasDB_update("UPDATE `stats` set numbers = numbers +1 WHERE id = '4'");
// adds a post to Post Today
}
if ($result) {
?>
<center>Successful<br/></center>
<?php
$query = yasDB_select("SELECT max(id) AS lastid FROM forumtopics");
$answer = $query->fetch_array(MYSQLI_ASSOC);
if ($setting['seo'] == 'yes') {
$answerlink = $setting['siteurl'] . 'forumtopics/' . $answer['lastid'] . '/1.html';
} else {
$answerlink = $setting['siteurl'] . 'index.php?act=forumtopics&id=' . $answer['lastid'];
}
?>
<center><a href="<?php
echo $answerlink;
?>
">View your topic</a></center><?php
} else {
echo "<center>Could not create topic.</center>";
}
} elseif (!isset($_SESSION["user"])) {
示例12: yasDB_select
}
echo '<center>Media successfully added!</font><br/>';
echo '<a href="index.php?">Click here to proceed</a></center>';
} else {
?>
<div class="table">
<form enctype="multipart/form-data" action="" method="post">
<table class="listing form" cellpadding="0" cellspacing="0">
<tr>
<th class="full" colspan="2">ADD YOUTUBE VIDEOS TO ALL PET HUMOR</th>
</tr>
<tr>
<td class="first" width="172"><strong>Category</strong></td>
<td class="last"><select name="category">
<?php
$query = yasDB_select("SELECT * FROM categories WHERE active='Yes'");
while ($row = $query->fetch_array(MYSQLI_ASSOC)) {
echo '<option value="' . $row['id'] . '">' . $row['name'] . '</option>';
}
$query->close();
?>
</select></td>
</tr>
<tr class="bg">
<td class="first"><strong>File</strong></td>
<td class="last"><select name="type">
<option value="YOUTUBE">youtube</option>
</select></td>
</tr>
<tr>
<td class="first" width="172"><strong>File path</strong></td>
示例13: fopen
$fopen = fopen($rrsfile, 'w');
fwrite($fopen, ob_get_contents());
fclose($fopen);
echo '<META http-equiv="refresh" content="2; URL=' . $setting['siteurl'] . 'admin/newsblogfeed.php?act=done">';
ob_end_flush();
$rrsfile = '../news-blog-feed.xml';
ob_start();
print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
print "" . "<rss version=\"2.0\">\n";
print "" . "<channel>\n";
print "" . "<title>" . $setting['sitename'] . "</title>\n";
print "" . "<link>" . $setting['siteurl'] . "</link>\n";
print "" . "<ttl>600</ttl>\n";
print "" . "<description>News Blog Rss Feed.</description>\n";
print "" . "<copyright>" . date("Y") . " " . $setting['sitename'] . " All rights reserved.</copyright>\n";
$query = yasDB_select("SELECT * FROM news ORDER BY id DESC");
while ($row = $query->fetch_array(MYSQLI_ASSOC)) {
$ID = $row['id'];
$date = $row['date'];
$topic = $row['topic'];
$news = $row['news_text'];
$rowurl = $row['news_text'];
$rowurl = str_replace(" ", "-", $rowurl);
$rowurl = str_replace("'", "_", $rowurl);
$rowurl = str_replace('"', "_", $rowurl);
$rowurl = str_replace('/', "_", $rowurl);
$rowurl = str_replace("\\", "_", $rowurl);
$rowurl = rawurlencode($rowurl);
if ($setting['seo'] == 'yes') {
$newslink = $setting['siteurl'] . 'shownews/' . $ID . '.html';
} else {
示例14: yasDB_select
<div id="member_plays_header">Plays</div>
</div><div class="member_box">
<div class="member_box2">
<?php
$result = yasDB_select("SELECT count(id) FROM `user` ");
$query_data = $result->fetch_array(MYSQLI_NUM);
$numrows = $query_data[0];
$rquery = yasDB_select("SELECT `username` FROM `user` ORDER BY `plays` DESC", false);
$ranking = array();
$i = 0;
while ($cow = $rquery->fetch_array(MYSQLI_ASSOC)) {
$ranking[$i] = $cow['username'];
$i++;
}
$pageurl = new pagination($numrows, $setting['seo'], 'members', 15, 3);
$query = yasDB_select("SELECT * FROM user ORDER BY `username` asc LIMIT " . $pageurl->start . ", " . $pageurl->limit);
while ($row = $query->fetch_array(MYSQLI_ASSOC)) {
$rank = array_search($row['username'], $ranking) + 1;
$id = $row['id'];
$username = $row['username'];
$plays = $row['plays'];
if ($setting['seo'] == 'yes') {
$memberlink = $setting['siteurl'] . 'showmember/' . $id . '.html';
} else {
$memberlink = $setting['siteurl'] . 'index.php?act=showmember&id=' . $id;
}
if ($row['useavatar'] == '1') {
$avatarimage = $setting['siteurl'] . 'avatars/' . $row['avatarfile'];
} else {
$avatarimage = $setting['siteurl'] . 'avatars/useruploads/noavatar.jpg';
}
示例15: session_start
<?php
session_start();
include "db_functions.inc.php";
if (isset($_SESSION['userid'])) {
$gameid = yasDB_clean($_GET['gid']);
$userid = yasDB_clean($_SESSION['userid']);
$query = yasDB_select("SELECT `gameid` FROM `favourite` WHERE `userid` = {$userid} && `gameid` = {$gameid}");
if ($query->num_rows == 0) {
yasDB_insert("INSERT INTO `favourite` (userid, gameid) VALUES ({$userid}, {$gameid})");
}
}