[Release] WebShop For 97d+99i Update 4

nelson25

Member
Joined
Apr 1, 2017
Messages
57
Reaction score
8
Screenshot by Lightshot

Module added
Pros:
- It is working and well secured
- It is dynamically created, so you could add an additional resource for sell
- Support the latest PHP versions

Cons:
- Needs a visual improvements
- Needs to be translated into the other added languages
- Adding option to sell all resources at once
Excellent module. I meant that our users can buy them, how they buy any item here.
 

r00tme

Well-Known Member
Joined
Apr 30, 2014
Messages
495
Reaction score
685
Excellent module. I meant that our users can buy them, how they buy any item here.
Well, I did not understand what you mean. I can not say that will do it as I have done such modules couple of times in different variations and there is no challenge to me and if there is no challenge, I have no interest.

But you can have a look on to DTweb 2.0 jewel depositor or box adder how they are written and take the part you need to implement it here.

If you do so, I will be very thankful if you share the module with others as we all do.
 
Last edited:

r00tme

Well-Known Member
Joined
Apr 30, 2014
Messages
495
Reaction score
685
Хайде от мен да мине, барем ме помните с добро. Няма да правим проблем за 30 реда код при положение, че Savoy всичко е направил и трябва само да до сглобим.

Screenshot by Lightshot

PHP:
<?php
iseedeadpeople();
$success = false;
switch (1) {
	default: 
/********** Buy Resources *************/
$webshop['buyres']        = true; // Start Stop Module			 
$webshop['buyres_temp']   = array(
	//         ItemName           HexMark   Credits
	   array("Box of Kundun + 1"  ,'CB40'     ,200),
	   array("Box of Kundun + 2"  ,'CB48'     ,300),
	   array("Box of Kundun + 3"  ,'CB50'     ,400),
	   array("Box of Kundun + 4"  ,'CB58'     ,500),
	   array("Box of Kundun + 5"  ,'CB60'     ,600),
       array("Jewel of Chaos"     ,'8F00'     ,600),
       array("Jewel of Life"      ,'D000'     ,600),
       array("Jewel of Bless"     ,'CD00'     ,600),
       array("Jewel of Soul"      ,'CE00'     ,600),	   
	 );	
	 
	require 'inc/function.iteminfo.php';
	foreach($webshop['sell_resources'] as $key => $values){
		$options .= "<form method='post'><option value='".$key."'>".$values[0]."</option>";
		$prices  .= "<tr><td>" .$values[0]. "</td><td> x" .$values[2]. " credits</td></tr>";
	}	
    if(isset($_POST['type']) && isset($_POST['count'])){
	   $type  = (int)$_POST['type'];
	   $count = (int)$_POST['count'];
	   if($type >=0 && $type < count($webshop['buyres_temp']) && $count > 0){
		  	if(mssql_num_rows(mssql_query("Select * from Memb_Stat where ConnectStat=0 and memb___id='" . htmlspecialchars($_COOKIE['WebShopUsername']. "'"))) == 1){
                if($mycreds >= bcmul($count,$webshop['buyres_temp'][$type][2])){
			        for($i=0;$i < $count; $i++){
					   	$mycuritems = '0x' . strtoupper(bin2hex(mssql_fetch_row(mssql_query("SELECT [Items] FROM [warehouse] WHERE [AccountID]='" . $GLOBALS['mu_user'] . "'"))[0]));		 
				        $ser_ex	    = mssql_fetch_row(mssql_query("exec WZ_GetItemSerial"));
				        $newitem    = $webshop['buyres_temp'][$type][1]."00".sprintf("%08X", $ser_ex[0],00000000)."800000";				        
			            $test		= 0;
			            $slot 	    = smartsearch($mycuritems,1,1); 
			            $test		= $slot*20;
						if ($slot == 1337)  { 
			            	print "<br>".phrase_no_slots;			            
			            }
						else{
							$mynewitems = substr_replace($mycuritems, $newitem, ($test+2), 20); 									
							$update_ware = mssql_query("Update warehouse set items = ".$mynewitems." where AccountID='".htmlspecialchars($_COOKIE['WebShopUsername'])."'");
                            if($update_ware){
			   	                mssql_query("Update Memb_Credits set credits = credits-".bcmul($count,$webshop['buyres_temp'][$type][2])." where memb___id='".htmlspecialchars($_COOKIE['WebShopUsername'])."'");        
			                    $message = "You have successfully bought x".$count." " . $webshop['buyres_temp'][$type][0] ." for " . bcmul($count,$webshop['buyres_temp'][$type][2]) . " credits " ;				   
				                echo '<meta http-equiv="refresh" content="1">';
								$success = true;
							}						
						}
			   	    }
					if($success){
						echo $message;
					}
				}
				else{
					print phrase_lack_credits;
				}
			}
		else{
			echo phrase_leave_the_game;
		}
	  }
	  else{
		echo "Please select the resource properly";  
	  }
	}
	
	print '<fieldset style="width: 350px;background-color: #DDDDDD;border: 1px solid #000000; font-family: arial; font-size: 12px;"><legend class="mu_style2" style="padding: 3px;font-weight:bold;background-color: #DDDDDD;border: 1px solid #000000;border-bottom:0px;">Sell Resources</legend>';	
	echo "
	<form method='post'>
	<table width=100% cellpadding='2' cellspacing='1'	border='1'>
        <tr style='background:#bbbbbb;font-weight:600'>
		   <td>Choose Resource</td>
		   <td>Amount</td>
		</tr>			
	    <tr>
		               <td><select name='type'>".$options."</select></td>
					   <td><input type='number' name='count'/></td>
					   <td align='center'>
					       <input class='button' type='submit' value='Buy Now' name='submit'/>
						</td>
			   </tr>";
		

echo '</table></br>
<fieldset style="width: 300px">
<legend class="mu_style2" style="padding: 0px;font-weight:bold;">Price Table</legend>
<div align="justify">
<table width=100% cellpadding="2" cellspacing="1" border=1>
<tr  style="background:#bbbbbb;font-weight:600"><td>Resource Name</td><td> Price Each</td></tr>
'.$prices.'
</table>
</div>
</fieldset>';
}

?>
 

Attachments

Reactions: Ivailo99

herjuni

Member
Joined
May 27, 2015
Messages
36
Reaction score
2
you have some correction when you buy an error item that the character is connected to the server that is disconnected so do not dupe items
 

EddyM

New Member
Joined
Feb 2, 2019
Messages
15
Reaction score
0
Verifying required extensions:OK

Parse error
: parse error in C:\xampp\htdocs\shop\inc\mssql2sqlsrv.php on line 10



How to fix this error ? I use xampp 1.7.1