˹á
 úҹ
  C/C++ new
  Java new
 Sourcecode.TV
  Android
  Blackberry
  C/C++
  Java
  Linux
  Windows Phone
  ͧͧ
 
  .NET
  Android
  Blackberry
  C++Builder
  Delphi
  Java
  Mobile
  Open Source
  Pocket PC
  Visual Basic
  Web
  Windows Phone
  Others
 Ẻ¹
  ASP
  ASP.NET Webmatrix
  C++
  eVB
  J2ME
  Java
  PHP
 
  Android
  ASP
  C++
  VC++
  CGI-Perl
  Delphi
  Java
  jQuery
  PHP
  Visual Basic
  .NET
 ԡèҡ
  Դ...
  DoodeeHosting
  Ѻ͡Ẻ Ѳ䫵
  Freeware
  ѵҤɳ
  ª١
  ʶԵԼ
 Ŵ
 Ң
 дҹʹ
  .NET
  C/C++
  Delphi
  Java
  Palm/PocketPC
  Visual Basic
  Web
 
 дҹҹ
 ԧ
 ǡѺ
 ѵҤɳ
Social Network

Facebook  Twitter  YouTube
 New Article
 Webboard
 Freelanceboard
Freeware
 (BerDee)
(Android)
駩غ
駩غ(Android)
WebcamMonitor
WebcamMonitor(Windows)
scSendMail
scSendMail(Windows)
MSN Caption
MSN Caption(Windows)
  Freelance comment
  ԴͺʹФѺ...
2015-07-29 13:35:58
  Ҽͧ纷ѲҴ HTML5 ...
2015-01-18 15:33:54
  Ҽͧ纷ѲҴ HTML5 ...
2015-01-18 15:32:51
  ԴͺФѺ
ҹ...

2014-01-06 12:47:38
  ѧҤ͹ ͧ֡ͧ...
2013-07-06 01:04:37
  ʹ觢ͺࢵҤҤҡ͹ФѺ...
2013-03-24 18:54:20
  ѧդѺҹԴѺ 08...
2012-12-16 19:18:14
  ʹ㨤 Դ 0905076277...
2012-11-12 11:07:46
  Ѻ礹ѡ֡ͺѷ
...

2012-10-29 03:10:46
  sukit_te34@hotmail.com...
2012-10-29 03:09:36
  Webboard comment
  Ѻ ͹ matlab ¹ matlab...
2017-06-03 16:27:23
  ੾зҧҴ ͧҢ...
2017-05-25 16:18:08
  ͧ˹Ѻ os ...
2017-05-25 16:12:47
  ¹ php curl ...
2017-04-20 01:04:20
  ¹ ...
2017-03-27 12:50:54
  ʧҷ ͧѾഷ...
2017-03-27 12:37:20
  ͺõͺ...
2017-02-22 13:10:24
  ͧաԸ¹ recursive f...
2017-02-14 13:11:03
  ҡ кͧشҡ...
2017-01-30 11:45:28
  for-loop ͹ѹ
...

2017-01-28 16:00:12
  Homework comment
  ͺسҡѺ...
2017-08-16 18:27:25
  ͧ ͧ ѧ ^^...
2017-04-18 18:40:46
  ͧ ͧ ѧ ^^...
2017-04-18 18:37:54
  á flowchart ѹ...
2017-04-18 17:43:33
  ҡ flowchart ...
2017-04-18 16:25:29
  kungking ӶäѺ ?...
2017-03-18 23:28:36
  ¹ʴͧ...
2017-03-06 10:56:25
  鴷ӧҹẺ ...
2016-09-06 01:00:12
  ҡҺ鴹Ѻѧ...
2016-09-05 09:31:27
  ͧ֡¹...
2016-04-22 00:47:49
  Article comment
  [b] ...
2017-08-20 08:53:10
  [b]
2017-08-11 22:39:58
  [b]
...

2017-08-11 14:46:33
  ҨѺ ͧ
...

2017-07-11 09:59:35
  ö͡Ѻ anycast ...
2017-07-05 10:12:35
  Ѻ س "Դ" ͧ֡...
2016-06-18 15:21:09
  vs2008 c# Ѻ ͺسѺ...
2016-06-17 14:39:30
  vs c# ӵآ鹵͹...
2016-06-17 14:37:44
  ͧѺ "Ҩԧ ...
2016-03-12 23:36:05
  觢ͤǧ LAN ੾Ф...
2016-03-12 18:25:42
  9Mcode comment
  ҡ...
2014-02-21 08:52:19

Link Exchange

ѵҤɳ
Statistics of Sourcecode in Thailand
 
 Webboard

- - - - - - - - - - - - - - ʹѺʹع- - - - - - - - - - - - - -

з #3099 [Web]

php 觢 sql2008ʴʴ

------------------------------------
<?php
require_once ("inc/functions.php") ;
$view = $_GET['view'];
if ( in_array($account2, $editor_list) && $enable_edit ) {
if ($_GET['sidebar']) {
?>
<div id="item_title"><b class="title">ITEM PANEL MENU</b></div>
<div id="item_detail">
<p class="item_name" style="height: auto;"><img src="images/bullet.jpg" /> <a href="javascript: goPanelPage('add');">Add Item</a></p>
<p class="item_name" style="height: auto;"><img src="images/bullet.jpg" /> <a href="javascript: goPanelPage('modify');">Modify Items</a></p>
<p class="item_name" style="height: auto;"><img src="images/bullet.jpg" /> <a href="javascript: goPanelPage('<?php echo strtolower($cash_name) ;?>');">Add <?php echo $cash_name ;?></a></p>
</div>
<?php
}
else {
?>
<script type="text/javascript">
function addcash()
{
var account = $("#account").val();
var cash = $("#cash").val();

$.post("BackendPanel.php?view=<?php echo strtolower($cash_name) ;?>",{account: account, cash: cash},function(result){
$("#list").html(result);
});
}

function goViewPage(id)
{
goPanelPage('modify&page='+id);
}

function additem()
{
var form = $("#additem").serialize();

$.post("BackendPanel.php?view=add",form,function(result){
$("#list").html(result);
});
}

function edititem()
{
var form = $("#edititem").serialize();
var id = $("#listid").val();

$.post("BackendPanel.php?id="+id,form,function(result){
$("#list").html(result);
});
}

function switchBundle()
{
var display = $(".bundle:first").css("display");

if (display=="none")
$(".bundle").show();
else
$(".bundle").css("display","none");
}
</script>
<div id="item_cat"><b class="title">ITEM PANEL > <?php echo ($view == "add") ? "ADD ITEM" : ( ( $view == strtolower($cash_name)) ? "ADD " . strtoupper($cash_name) : "MODIFY ITEMS" ) ;?></b></div>
<div id="item_content">
<?php
switch ($view) {
case "add" :
if ( count($_POST)) {
$id = getLastID() + 1 ;
$query = "INSERT [{$mssql_db['webshop']}].dbo.PREMIUM_SHOP_TBL " ;
$fields = "(id" ;
$values = "VALUES ('" . $id . "'" ;
$i = 0 ;
foreach ($_POST as $field => $value) {
if ( ($field == "itemid" || $field == "name") && trim($value) == "" )
$error = true ;
if ($field == "price" || $field == "price_sale" || $field == "itemcount")
$value = abs($value) ;
if ($field == "desc")
$field = "[desc]" ;
if ($field == "isbundle" || $field == "forsale") {
if ($value == "on")
$value = 1 ;
else
$value = 0 ;
}
$fields .= ", " . $field ;
$values .= ", '" . preg_replace("/'/", "\'\'", $value) . "'" ;
}
$fields .= ")" ;
$values .= ")" ;
$query .= $fields . $values ;
if (!$error)
$result = mssql_query($query) ;
if ($result)
echo "<p style='text-align: center; color: green'>{$_POST['name']} added successfully.</p>" ;
else
echo "<p style='text-align: center; color: red'>Failed to add item.</p>" ;
}
?>
<style>
table th {padding: 1px; width: 100px;}
table td {border: 0;}
input, select, textarea {padding: 2px; width: 100%;}
select {width: 103%;}
</style>
<p>
<form action="javascript: additem();" id="additem">
<table style="width: 350px; margin: auto;">
<tr>
<th>Item ID:</th>
<td><input name="itemid" maxlength="8" /></td>
</tr>
<tr>
<th>Item Name:</th>
<td><input name="name" maxlength="75" /></td>
</tr>
<tr>
<th>Description:</th>
<td><textarea name="desc"></textarea></td>
</tr>
<tr>
<th>Count:</th>
<td><input name="itemcount" maxlength="4" /></td>
</tr>
<tr>
<th>Price:</th>
<td><input name="price" maxlength="8" /></td>
</tr>
<tr>
<th>Sale Price:</th>
<td><input name="price_sale" maxlength="8" value="0" /></td>
</tr>
<tr>
<th>Category:</th>
<td><select name="category"><option value="A">Special Bundles</option> <option value="B">Chance Boxes</option> <option value="C">New Player Packages</option> <option value="D">Upgrading</option> <option value="E">Stats & Awakenings</option> <option value="F">Functional Items</option> <option value="G">Buffs & Amps</option> <option value="H">Flasks & Potions</option> <option value="I">Food</option> <option value="J">Character</option> <option value="K">Storage</option> <option value="L">Guild & Party</option> <option value="M">Premium EXP Areas</option> <option value="N">Pick-Up Pets</option> <option value="O">Buff Pets</option> <option value="P">Pet Enhancements</option> <option value="Q">Pet Beads</option> <option value="R">Flying Items</option> <option value="S">Fashion Sets</option> <option value="T">Fashion Set Pieces</option> <option value="U">Clocks & Glasses</option> <option value="V">Hair</option> <option value="W">Furniture</option> <option value="X">Misc. Functional</option> <option value="Y">Misc. Fashion</option></select></td>
</tr>
<tr>
<th>Image Extension:</th>
<td><input name="image" maxlength="4" value="." /></td>
</tr>
<tr>
<th>Is Bundle:</th>
<td style="padding: 2px; border: 1px solid #ccc;"><input type="checkbox" name="isbundle" onclick="switchBundle();" /></td>
</tr>
<tr class="bundle">
<th>Item 1 ID:</th>
<td><input name="item1_id" maxlength="8" /></td>
</tr>
<tr class="bundle">
<th>Item 1 Name:</th>
<td><input name="item1_name" maxlength="75" /></td>
</tr>
<tr class="bundle">
<th>Item 1 Count:</th>
<td><input name="item1_count" maxlength="4" /></td>
</tr>
<tr class="bundle">
<th>Item 2 ID:</th>
<td><input name="item2_id" maxlength="8" /></td>
</tr>
<tr class="bundle">
<th>Item 2 Name:</th>
<td><input name="item2_name" maxlength="75" /></td>
</tr>
<tr class="bundle">
<th>Item 2 Count:</th>
<td><input name="item2_count" maxlength="4" /></td>
</tr>
<tr class="bundle">
<th>Item 3 ID:</th>
<td><input name="item3_id" maxlength="8" /></td>
</tr>
<tr class="bundle">
<th>Item 3 Name:</th>
<td><input name="item3_name" maxlength="75" /></td>
</tr>
<tr class="bundle">
<th>Item 3 Count:</th>
<td><input name="item3_count" maxlength="4" /></td>
</tr>
<tr class="bundle">
<th>Item 4 ID:</th>
<td><input name="item4_id" maxlength="8" /></td>
</tr>
<tr class="bundle">
<th>Item 4 Name:</th>
<td><input name="item4_name" maxlength="75" /></td>
</tr>
<tr class="bundle">
<th>Item 4 Count:</th>
<td><input name="item4_count" maxlength="4" /></td>
</tr>
<tr>
<th>For Sale:</th>
<td style="padding: 2px; border: 1px solid #ccc;"><input type="checkbox" checked name="forsale" /></td>
</tr>
<tr>
<td colspan="2" style="border: 0;"><input type="submit" value="Add Item" style="width: auto;" /></td>
</tr>
</table>
</form>
</p>
<?php
break ;
case strtolower($cash_name) :
?>
<p>Please enter a valid account name and a positive integer to add <?php echo $cash_name ;?> to a user's account.<br/>
<small><i>Negative values will be made positive, and if non-interger values in the <?php echo $cash_name ;?> field will be canceled.</i></small></p>
<p>
<form action="javascript: addcash();">
<table style="width: 190px; margin: auto;">
<tr>
<th style="padding: 1px;">Account:</th>
<td style="border: 0;"><input id="account" maxlength="16" style="padding: 2px;" /></td>
</tr>
<tr>
<th style="padding: 1px;"><?php echo $cash_name ;?>:</th>
<td style="border: 0;"><input id="cash" maxlength="10" style="padding: 2px;" /></td>
</tr>
<tr>
<td colspan="2" style="border: 0;"><input type="submit" value="Add <?php echo $cash_name ?>" style="padding: 2px;" /></td>
</tr>
</table>
</form>
<?php
if ( count($_POST)) {
if ( trim($_POST['account']) == "" || trim($_POST['cash']) == "" || !ctype_digit($_POST['cash'])) {
$error = "<div style='color: red; text-align: center;'>Failed to add {$cash_name}.</div>" ;
}
else {
$account = clean($_POST['account']) ;
$cash = clean( abs($_POST['cash'])) ;
$result = mssql_query("UPDATE [{$mssql_db['account']}].dbo.[CHR_LOG_INFO] SET cash = cash + {$cash} WHERE id_loginid = {$account}") ;
if ($result) {
$cash_result = mssql_query("SELECT TOP 1 {$cash_row} FROM [{$mssql_db['account']}].dbo.[CHR_LOG_INFO] WHERE id_loginid = {$account}") ;
$cash_array = mssql_fetch_array($cash_result) ;
$total_cash = $cash_array[$cash_row];
$error = "<div style='color: green; text-align: center;'><b>{$cash} {$cash_name}</b> has been added successfully to <b>{$_POST['account']}</b>'s account.<br/><b>Total Cash:</b> {$total_cash}</div>" ;
}
else
$error = "<div style='color: red; text-align: center;'>Failed to add <b>{$cash} {$cash_name}</b> to <b>{$_POST['account']}</b>'s account.</div>" ;
}
echo $error ;
}
?>
</p>
<?php
break ;
default :
if ($_GET['id']) {
$id = clean( abs($_GET['id'])) ;
$result = mssql_query("SELECT * FROM [{$mssql_db['webshop']}].dbo.PREMIUM_SHOP_TBL WHERE id = {$id}") ;
$row = mssql_fetch_array($result) ;
if ( !mssql_num_rows($result)) {
echo "<p style='text-align: center; color: #FF0000; padding-top: 30%; font-weight: bold'>Invalid item ID.</p>" ;
}
else
if ($_GET['view'] == "delete") {
if ( !isset ($_GET['confirm']))
echo
"<p style='text-align: center; color: #FF0000; padding-top: 25%; font-weight: bold'>Are you sure you wish to delete {$row['name']}?<br/><input type='button' value='Delete' onclick=\"goPanelPage('delete&id={$row['id']}&confirm');\" style='padding: 2px;' /> <input type='button' value='Cancel' onclick=\"goViewPage({$_SESSION['panelpage']});\" style='padding: 2px;' /></p>" ;
else {
$result = mssql_query("DELETE [{$mssql_db['webshop']}].dbo.PREMIUM_SHOP_TBL WHERE id = {$id}") ;
$lastpage = $_SESSION['panelpage'] ? $_SESSION['panelpage'] : 1 ;
if ($result)
echo "<p style='text-align: center; color: #FF0000; padding-top: 30%; font-weight: bold'>{$row['name']} deleted.<br/><a href=\"javascript: goViewPage({$lastpage});\">Back</a></p>" ;
else
echo "<p style='text-align: center; color: #FF0000; padding-top: 30%; font-weight: bold'>Failed to delete.<br/><a href=\"javascript: goViewPage({$lastpage});\">Back</a></p>" ;
}
}
else {
if ( count($_POST)) {
unset ($result) ;
if (!$_POST['isbundle'])
$_POST['isbundle'] = 0 ;
if (!$_POST['forsale'])
$_POST['forsale'] = 0 ;
$update = array() ;
foreach ($_POST as $field => $value) {
if ( ($field == "itemid" || $field == "name") && trim($value) == "" )
$error = true ;
if ($field == "price" || $field == "price_sale" || $field == "itemcount")
$value = abs($value) ;
if ($field == "isbundle" || $field == "forsale") {
if ($value)
$value = 1 ;
else
$value = 0 ;
}
if ($value != $row[$field]) {
if ( stristr($value, "'") || $field == "desc" )
$value = "'" . preg_replace("/'/", "''", $value) . "'" ;
else
$value = clean($value) ;
$update[$field] = $value ;
}
}
$query = "UPDATE [{$mssql_db['webshop']}].dbo.PREMIUM_SHOP_TBL SET " ;
if ( empty ($update))
$error = true ;
if (!$error) {
$i = 0 ;
foreach ($update as $row => $value) {
if ($i != 0)
$query .= "," ;
if ($row == "desc")
$row = "[desc]" ;
$query .= " {$row} = {$value}" ;
$i++;
}
$query .= " WHERE id = {$id}" ;
$result = mssql_query($query) ;
}
$item_name = $_POST['name'] ? $_POST['name'] : $row['name'];
if ($result) {
$row = $_POST ;
echo "<p style='text-align: center; color: green'>{$item_name} updated successfully.</p>" ;
}
else
echo "<p style='text-align: center; color: red'>Failed to update {$item_name}.</p>" ;
}
foreach ($row as $field => $value) {
$row[$field] = br( preg_replace("/'/", "\'", $value)) ;
}
?>
<script type="text/javascript">
$(document).ready(function() {
<?php
foreach ($row as $field => $value) {
if ($field == "desc") {
?>
$("textarea[name='<?php echo $field ;?>']").val('<?php echo $value ;?>');
<?php
}
else
if ($field == "category") {
?>
$("select[name='<?php echo $field ;?>']").val('<?php echo $value ;?>');
<?php
}
else
if ($field == "isbundle" || $field == "forsale") {
$onoff = $row[$field] ? "true" : "false"
?>
$("input[name='<?php echo $field ;?>']").attr('checked', <?php echo $onoff ;?>);
<?php
if ($field == "isbundle" && $onoff == "true") {
echo "$(\".bundle\").show();" ;
}
unset ($onoff) ;
}
else {
?>
$("input[name='<?php echo $field ;?>']").val('<?php echo $value ;?>');
<?php
}
}
?>
});
</script>
<style>
table th {padding: 1px; width: 100px;}
table td {border: 0;}
input, select, textarea {padding: 2px; width: 100%;}
select {width: 103%;}
</style>
<p>
<input id="listid" value="<?php echo $id ;?>" type="hidden" />
<form action="javascript: edititem();" id="edititem">
<table style="width: 350px; margin: auto;">
<tr>
<th>Item ID:</th>
<td><input name="itemid" maxlength="8" /></td>
</tr>
<tr>
<th>Item Name:</th>
<td><input name="name" maxlength="75" /></td>
</tr>
<tr>
<th>Description:</th>
<td><textarea name="desc"></textarea></td>
</tr>
<tr>
<th>Count:</th>
<td><input name="itemcount" maxlength="4" /></td>
</tr>
<tr>
<th>Price:</th>
<td><input name="price" maxlength="8" /></td>
</tr>
<tr>
<th>Sale Price:</th>
<td><input name="price_sale" maxlength="8" value="0" /></td>
</tr>
<tr>
<th>Category:</th>
<td><select name="category"><option value="A">Special Bundles</option> <option value="B">Chance Boxes</option> <option value="C">New Player Packages</option> <option value="D">Upgrading</option> <option value="E">Stats & Awakenings</option> <option value="F">Functional Items</option> <option value="G">Buffs & Amps</option> <option value="H">Flasks & Potions</option> <option value="I">Food</option> <option value="J">Character</option> <option value="K">Storage</option> <option value="L">Guild & Party</option> <option value="M">Premium EXP Areas</option> <option value="N">Pick-Up Pets</option> <option value="O">Buff Pets</option> <option value="P">Pet Enhancements</option> <option value="Q">Pet Beads</option> <option value="R">Flying Items</option> <option value="S">Fashion Sets</option> <option value="T">Fashion Set Pieces</option> <option value="U">Clocks & Glasses</option> <option value="V">Hair</option> <option value="W">Furniture</option> <option value="X">Misc. Functional</option> <option value="Y">Misc. Fashion</option></select></td>
</tr>
<tr>
<th>Image Extension:</th>
<td><input name="image" maxlength="4" value="." /></td>
</tr>
<tr>
<th>Is Bundle:</th>
<td style="padding: 2px; border: 1px solid #ccc;"><input type="checkbox" name="isbundle" onclick="switchBundle();" /></td>
</tr>
<tr class="bundle">
<th>Item 1 ID:</th>
<td><input name="item1_id" maxlength="8" /></td>
</tr>
<tr class="bundle">
<th>Item 1 Name:</th>
<td><input name="item1_name" maxlength="75" /></td>
</tr>
<tr class="bundle">
<th>Item 1 Count:</th>
<td><input name="item1_count" maxlength="4" /></td>
</tr>
<tr class="bundle">
<th>Item 2 ID:</th>
<td><input name="item2_id" maxlength="8" /></td>
</tr>
<tr class="bundle">
<th>Item 2 Name:</th>
<td><input name="item2_name" maxlength="75" /></td>
</tr>
<tr class="bundle">
<th>Item 2 Count:</th>
<td><input name="item2_count" maxlength="4" /></td>
</tr>
<tr class="bundle">
<th>Item 3 ID:</th>
<td><input name="item3_id" maxlength="8" /></td>
</tr>
<tr class="bundle">
<th>Item 3 Name:</th>
<td><input name="item3_name" maxlength="75" /></td>
</tr>
<tr class="bundle">
<th>Item 3 Count:</th>
<td><input name="item3_count" maxlength="4" /></td>
</tr>
<tr class="bundle">
<th>Item 4 ID:</th>
<td><input name="item4_id" maxlength="8" /></td>
</tr>
<tr class="bundle">
<th>Item 4 Name:</th>
<td><input name="item4_name" maxlength="75" /></td>
</tr>
<tr class="bundle">
<th>Item 4 Count:</th>
<td><input name="item4_count" maxlength="4" /></td>
</tr>
<tr>
<th>For Sale:</th>
<td style="padding: 2px; border: 1px solid #ccc;"><input type="checkbox" name="forsale" /></td>
</tr>
<tr>
<td colspan="2" style="border: 0;"><input type="submit" value="Edit Item" style="width: auto;" /></td>
</tr>
</table>
</form>
</p>
<p style="text-align: right;"><a href="javascript: goViewPage(<?php echo $_SESSION['panelpage'] ? $_SESSION['panelpage'] : 1 ;?>);">Back</a></p>
<?php
}
}
else {
$total_query = mssql_query("SELECT id FROM [{$mssql_db['webshop']}].dbo.PREMIUM_SHOP_TBL") ;
$total_pgs = mssql_num_rows($total_query) / $max_panel_list ;
$total_pages = roundUp($total_pgs) ;
if ($total_pages < 1)
$total_pages = 1 ;
if ($page > $total_pages)
$page = $total_pages ;
$pageMax = $page * $max_panel_list ;
$listArray = tableArray("SELECT TOP {$pageMax} * FROM [{$mssql_db['webshop']}].dbo.PREMIUM_SHOP_TBL") ;
$_SESSION['panelpage'] = $page ;
?>
<style>
table.panel-table tr td, table.panel-table tr th, table.panel-table tr th img {height: 35px; padding: 0; margin: 0; overflow: none;}
table.panel-table td, table.panel-table tr.panel-table-header th {padding: 2px; height: auto;}
th img {margin-top: 1px;}

#page_nav {width: 500px; height: 15px; padding: 0; text-align: center; margin: 2px auto;}
#page_nav a {color: #56585d; font-size: 13px; margin: auto 3px; font-weight: bold;}
#page_nav span {color:#5F87E1; font-size: 13px;}
</style>

<table style="width: 100%;" class="panel-table">
<tr class="panel-table-header">
<th>Image</th>
<th>Name</th>
<th style="width: 275px;">Description</th>
<th>Price</th>
<th>Options</th>
</tr>
<?php
for ( $i = $pageMax - $max_panel_list ; $i < count($listArray) ; $i++ ) {
?>
<tr<?php echo ( $i + 1 == count($listArray)) ? " class='last'" : "" ?>>
<th><img src="images/items/<?php echo $listArray[$i]['itemid'];echo $listArray[$i]['bundle'] ? "_bundle" : "" ;echo $listArray[$i]['image'];?>" /></th>
<td><?php echo $listArray[$i]['name'];?></td>
<td><?php echo ( strlen($listArray[$i]['desc']) > 40 ) ? substr($listArray[$i]['desc'], 0, 40) . "..." : $listArray[$i]['desc'];?></td>
<td><?php echo $listArray[$i]['price_sale'] ? $listArray[$i]['price_sale'] : $listArray[$i]['price'];echo " " . $cash_name_min ;?></td>
<td><a href="javascript: goPanelPage('modify&id=<?php echo $listArray[$i]['id'];?>');"><img src="images/management_edit.png" /></a> <a href="javascript: goPanelPage('delete&id=<?php echo $listArray[$i]['id'];?>');"><img src="images/management_delete.png" /></a></td>
</tr>
<?php
}
?>
</table>
<?php
echo '</div>' ;
echo '<p id="page_nav">' ;
echo page_list($total_pages, "goViewPage(") ;
echo '</p><div>' ;
}
}
?>
</div>
<?php
}
}
else {
include ("GetItemList.php") ;
}
?>
-----------------------------------------------
úǹ¹¤Ѻ
ҡس : oat / kenu.ood@hotmail.com [2011-07-08 11:10:39]  

203.146.242.40 Դ #28417 (ҡ IP: 203.146.242.40)
Ǩͺѧ
1.˹˹Ѻ <meta http-equiv="Content-Type" content="text/html; charset=Windows-874"> ѧ

2.ҹ͡ collection Ẻ http://mssqlbase.blogspot.com/2010/06/sql-server-database-collation.html
ҡس : maddog [2011-07-08 11:50:25]

183.89.200.221 Դ #28419 (ҡ IP: 183.89.200.221)
Ѻ͹
ҡس : oat [2011-07-09 22:54:20]

183.89.200.221 Դ #28420 (ҡ IP: 183.89.200.221)
Ѻ
-----------------
<?php

require_once("inc/config.php");

if(stristr($_SERVER['PHP_SELF'], "functions.php"))
header("Location: ../");

session_start();

if (!$enable_shop)
die("<p style='text-align: center; color: #FF0000; padding-top: 30%; font-weight: bold'>The shop is currently unavailable.<br/>Please try again later.</p>");

$mssql_con = mssql_connect($mssql_server, $mssql_username, $mssql_password);
if (!$mssql_con)
die("Cannot connect to MSSQL Server.");

if (isset($_POST['user_id']))
{
session_destroy();
session_start();
}

$account = (isset($_SESSION['ifs_account'])) ? strtolower($_SESSION['ifs_account']) : strtolower($_POST['user_id']);
$player = (isset($_SESSION['ifs_player'])) ? $_SESSION['ifs_player'] : addZeroes($_POST['propid']);
$sindex = (isset($_SESSION['ifs_sindex'])) ? $_SESSION['ifs_sindex'] : "0".$_POST['server_index'];
$passwd = (isset($_SESSION['ifs_passwd'])) ? $_SESSION['ifs_passwd'] : $_POST['check'];

$accountcheck = $account ? true : false;

$account2 = $account;
$account = clean($account);

if (!isset($_SESSION['ifs_account']))
{
if ($accountcheck)
{
$account_query=mssql_query("SELECT * FROM [{$mssql_db['account']}].dbo.[chr_log_info] WHERE id_loginid = {$account}");
$account_row=mssql_fetch_array($account_query);
if (mssql_num_rows($account_query)) {
if ($account_row['id_passwd']==$passwd)
{
$character_query=mssql_query("SELECT * FROM [{$mssql_db['account']}].dbo.[chr_log_info] WHERE propid = $player");
$character_row=mssql_fetch_array($character_query);
if (mssql_num_rows($character_query))
{
$_SESSION['ifs_account'] = $_POST['account'];
$_SESSION['ifs_player'] = $character_row['propid'];
$_SESSION['ifs_passwd'] = $passwd;
}

}
else
header("Location: login.php?error=3");
}
else
header("Location: login.php?error=2");
}
else
header("Location: login.php?error=1");
}

$cash_query=mssql_query("SELECT * FROM [{$mssql_db['account']}].[dbo].[chr_log_info] WHERE id_loginid = {$account}");
$cash_row_array=mssql_fetch_array($cash_query);
$cash_count=$cash_row_array[$cash_row];

mssql_select_db($mssql_db['webshop']);

$page = (isset($_GET['page'])) ? clean(abs($_GET['page'])) : 1;
if ($page < 1) $page = 1;
$page_max = $page*$max_items;
$page_limit = $page_max-$max_items;

function clean($var)
{
if (is_int($var))
{
$var = $var;
}
else
if (is_array($var))
{
foreach($var as $key => $value)
{
$var[$key] = clean($value);
}
}
else
{
$unpacked = unpack('H*hex',$var);
$hex = '0x'.$unpacked['hex'];
$var = $hex;
}

return $var;
}

function addZeroes($num)
{
$max_len=7;
$cur_len=strlen($num);

while ($cur_len < $max_len)
{
$num="0".$num;
$cur_len++;
}

return $num;
}

function item_query($itemid)
{
global $popular;
switch($itemid)
{
case "popular":
if ($popular==0)
$item_query="SELECT TOP 1 * FROM PREMIUM_SHOP WHERE forsale = 1 ORDER BY purchases DESC";
else
$item_query="SELECT TOP 1 * FROM PREMIUM_SHOP WHERE id= {$popular} AND forsale = 1";
break;

default:
$item_query="SELECT TOP 1 * FROM PREMIUM_SHOP WHERE id = {$itemid} AND forsale = 1";
$item_result=mssql_query($item_query);
if(!mssql_num_rows($item_result))
$item_query="SELECT TOP 1 * FROM PREMIUM_SHOP WHERE forsale = 1 ORDER BY purchases DESC";
}

return $item_query;
}

function roundUp( $value, $precision=0 )
{
if ( $precision == 0 ) {
$precisionFactor = 1;
}
else {
$precisionFactor = pow( 10, $precision );
}
return ceil( $value * $precisionFactor )/$precisionFactor;
}

function br($text)
{
$text=str_replace("\\r\\n","<br />",$text);
$text=str_replace("\n","<br />",$text);
return $text;
}

function friends()
{
global $player, $sindex;
$stmt = mssql_init('shopMessengerList');

mssql_bind($stmt, '@pserverindex', $sindex, SQLCHAR);
mssql_bind($stmt, '@pPlayerID', $player, SQLCHAR);

$result = mssql_execute($stmt);

while ($row = mssql_fetch_assoc($result)) {
$return.= '<option value="'.$row['idFriend'].'">'.$row['m_szName'].'</option>';
}

mssql_free_statement($stmt);

return $return;
}

function updateCash($new_cash)
{
global $account, $cash_row, $mssql_db;
$new_cash = abs($new_cash);

$query = "UPDATE [{$mssql_db['account']}].[dbo].[chr_log_info] SET [{$cash_row}] = {$new_cash} WHERE id_loginid = {$account}";
$result=mssql_query($query);

if ($result)
return true;
else
return false;
}

function giftBundle($item1_id, $item1_name, $item1_count, $item2_id, $item2_name, $item2_count, $item3_id, $item3_name, $item3_count, $item4_id, $item4_name, $item4_count, $player)
{
global $sindex;

if ($item1_id&&$item1_name&&$item1_count)
$return = giftItem($item1_id, $item1_name, $item1_count, $player);

if ($item2_id&&$item2_name&&$item2_count&&$return)
$return = giftItem($item2_id, $item2_name, $item2_count, $player);

if ($item3_id&&$item3_name&&$item3_count&&$return)
$return = giftItem($item3_id, $item3_name, $item3_count, $player);

if ($item4_id&&$item4_name&&$item4_count&&$return)
$return = giftItem($item4_id, $item4_name, $item4_count, $player);

if (!isset($return))
$return = 0;

return $return;
}

function giftItem($itemid, $itemname, $itemcount, $player_to)
{
global $sindex, $player, $mssql_db;
mssql_select_db($mssql_db['webshop']);
$stmt = mssql_init('shopSendItem');

mssql_bind($stmt, '@propid', $player_to, SQLCHAR);
//mssql_bind($stmt, '@serverindex', $sindex, SQLCHAR);
//mssql_bind($stmt, '@item_name', $itemname, SQLTEXT);
mssql_bind($stmt, '@item_count', $itemcount, SQLINT1);
mssql_bind($stmt, '@item_id', $itemid, SQLINT1);
mssql_bind($stmt, '@m_idSender', $player, SQLCHAR);

$return = mssql_execute($stmt);

mssql_free_statement($stmt);

return $return;
}

function sendBundle($item1_id, $item1_name, $item1_count, $item2_id, $item2_name, $item2_count, $item3_id, $item3_name, $item3_count, $item4_id, $item4_name, $item4_count) {
global $player, $sindex;
mssql_select_db($mssql_db['webshop']);

if ($item1_id&&$item1_name&&$item1_count)
$return = sendItem($item1_id, $item1_name, $item1_count);

if ($item2_id&&$item2_name&&$item2_count&&$return)
$return = sendItem($item2_id, $item2_name, $item2_count);

if ($item3_id&&$item3_name&&$item3_count&&$return)
$return = sendItem($item3_id, $item3_name, $item3_count);

if ($item4_id&&$item4_name&&$item4_count&&$return)
$return = sendItem($item4_id, $item4_name, $item4_count);

if (!isset($return))
$return = 0;

return $return;
}

function sendItem($itemid, $itemname, $itemcount)
{
global $player, $sindex, $mssql_db;
mssql_select_db($mssql_db['webshop']);
$stmt = mssql_init('shopSendItem');

mssql_bind($stmt, '@propid', $player, SQLCHAR);
//mssql_bind($stmt, '@serverindex', $sindex, SQLCHAR);
//mssql_bind($stmt, '@item_name', $itemname, SQLTEXT);
mssql_bind($stmt, '@item_count', $itemcount, SQLINT1);
mssql_bind($stmt, '@item_id', $itemid, SQLINT1);

$return = mssql_execute($stmt);

mssql_free_statement($stmt);

return $return;
}

function PurchaseCount($itemid)
{
global $mssql_db;
if (is_int($itemid))
return mssql_query("UPDATE [{$mssql_db['webshop']}].dbo.[PREMIUM_SHOP] SET purchases = purchases + 1 WHERE id = {$itemid}");
}

function getLastID()
{
global $mssql_db;
$result = mssql_query("SELECT id FROM [{$mssql_db['webshop']}].dbo.[PREMIUM_SHOP] ORDER BY id DESC");
$row = mssql_fetch_array($result);
return $row['id'];
}

function tableArray($query)
{
$array = array();
$result = mssql_query($query);

for($i=0;$i<mssql_num_rows($result);$i++)
{
$mini_array = array();
for($n=0;$n<mssql_num_fields($result);$n++)
{
$field = mssql_field_name($result, $n);
$mini_array[$field] = mssql_result($result, $i, $field);
}

$array[$i] = $mini_array;
}

return $array;
}

function page_list($totalPages, $function)
{
global $max_list, $page;

$partial = ceil($max_list/2);

$cP = 1;
if ($page > $partial)
{
$cP = $page - $partial + 1;
}

if ($cP+$max_list > $totalPages+1)
{
while($cP+$max_list > $totalPages+1)
{
$cP--;
}
}

if ($cP < 1)
$cP = 1;

$prev = ($page - 1 > 0) ? $page - 1 : 1;
$next = ($page + 1 > $totalPages) ? $totalPages : $page + 1;

echo "<a href=\"javascript:{$function}1);\"><img src=\"../images/paper/prev_01.gif\"><a href=\"javascript:{$function}{$prev});\" ><img src=\"../images/paper/prev_02.gif\"></a> " ;
$i2 = 0 ;
for ( $i = $cP ; ($i2 < $max_list) && ($i <= $totalPages) ; $i++ ) {
echo ($i == $page) ? "<span>" : "<a href=\"javascript:{$function}{$i});\">" ;
echo $i ;
echo ($i == $page) ? "</span>" : "</a>" ;
echo " " ;
$i2++;
}
echo "<a href=\"javascript:{$function}{$next});\"><img src=\"../images/paper/next_02.gif\"><a href=\"javascript:{$function}{$totalPages});\"><img src=\"../images/paper/next_01.gif\"></a>" ;
}

function likeClean($str)
{
return preg_replace('/(?!\s)(\W)/', '', $str);
}

function fail($itemid = "popular", $giftflag = 1)
{
return '<script type="text/javascript">
$(document).ready(function() {
PurchaseFail('.$itemid.','.$giftflag.');
});
</script>';
}

function success($itemid, $giftflag = 1)
{
return '<script type="text/javascript">
$(document).ready(function() {
PurchaseSuccess('.$itemid.','.$giftflag.');
});
</script>';
}

function success2($itemid, $giftflag = 1)
{
return '<script type="text/javascript">
$(document).ready(function() {
PurchaseSuccess2('.$itemid.','.$giftflag.');
});
</script>';
}
?>
----------------------------
ͺسѺ
ҡس : oat / kenu.ood@hotmail.com [2011-07-09 22:58:13]

125.24.175.224 Դ #28422 (ҡ IP: 125.24.175.224)
ʹ繷 ҧ php ʴŢŨҡ database ҧ һ

ͧ php ա˹鴷 insert ŧ database ǡʴһ

ҷͧҧʴ黡 繷ҡͧس php ջѭ

ҡͧҧ軡
ͧͧ OS ͧѺ С˹ web server١ͧ ͧѺ tis-620 windows-874
ҡس : maddog [2011-07-09 23:52:21]
ͺз
´

- - - - - - - - - - - - - - ʹѺʹع- - - - - - - - - - - - - -

 
 
µͨ Ѻͧ macbook pro 2016 (usb-c to HDMI)
µͨ Ѻͧ macbook pro 2016 (usb-c to HDMI) ´дѺ 4K
ŧ Mini DisplayPort to HDMI Adapter ŧ Mini DisplayPort to HDMI Adapter Ѻͧ macbook air/pro, mac mini
ŧ Mini DisplayPort to HDMI Adapter Ѻͧ macbook air/pro, mac mini
µٿѧ Ъ Ѻ iPhone 7  7 Plus
µٿѧ Ъ Ѻ iPhone 7 7 Plus
ŧҡ USB-C Type  USB 3.1 Ѻ MacBook
ŧҡ USB-C Type USB 3.1 Ѻ MacBook
䢤ǧѺͧ Macbook Air/Pro
䢤ǧ Ѻͧ Macbook Air/Pro (300ҷ)
HDMI  3 ͡  1
HDMI 3 ͡ 1 (350ҷ)
Ի͹¹
¹¹ͷ
¹¹͹´
¹¹
¹¹ վʾ
¹¹
¹ҹԹء
¹¹Թ⿹
¹¹Ϊ ʤ
9M Blog ͧ͡ ¹ͧ
ԡ ҾѺԭ
OrmSin.com: ˹ѧͧҹ--չ (country crafts)
ѵҤɳ
 
Tutorial
eVB Tutorial
ASP.NET Webmatrix Tutorial
J2ME Tutorial
C++  Tutorial
Java  Tutorial
PHP Tutorial
ASP Tutorial
 
ẺǨ
Freelance ѺѲ

Home - Article - Tutorial - Sourcecode - Dev Handbook - Search - WebBoard - Links - About Us

ʧǹԢԷ Ѵ͡ ӫ Ѵŧ ٻẺ Ѻ͹حҵѡɳѡ
Ţ¹ҳԪ硷͹ԡҡзǧҳԪ: 7100503002000
Copyright 2001 SourceCode.in.th