Hello,
I need help with code. Please help with change from profitsms to microsms.
I need help with code. Please help with change from profitsms to microsms.
PHP:
<?
/*FILE INFO:
downloads stuff*/
include ("config.php");
include ("functions.php");
$ptitle="Premium - $cfg[server_name]";
include ("header.php");
?>
<div id="content">
<div class="top"><b><font color='green'>SMS SHOP</b></font></div>
<div id="center">
<div class="s-img"><center><h3><?=$lang_shop;?></h3></center></div>
<div class="s-tresc">
<img src="images/line_pages.png" alt="" border="0" />
<center>
<!--
ProfitSMS Shop API
By Baabuseek
-->
<script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var first_imageSource = $("select[name=offer] option:first").val();
window.name = first_imageSource;
$('select[name=offer]').keyup(function() {
var imageSource = $("select[name=offer]").val();
$cos = "#" + window.name;
$($cos).fadeOut(10);
$name = "#" + $('#offer').val();
$($name).fadeIn();
window.name = imageSource;
});
$("select[name=offer]").change(function() {
var imageSource = $("select[name=offer]").val();
$cos = "#" + window.name;
$($cos).fadeOut(10);
$name = "#" + $('#offer').val();
$($name).fadeIn();
window.name = imageSource;
});
});
</script>
<?php
include("config.php");
/**
* Shop Script Configuration
*/
$offer = array(array());
$shop['id'] = "39c478c49e1558669fa4726168a0150d"; //Twój klucz API który uzyskasz po rejestracji się w http://profitsms.pl/. Znajduje się on w dziale "Moje usługi"
if($_GET['buy'] == "thing"){ // konfiguracja dla przedmiotow
$offer[1]['offer_type'] = "item";
$offer[1]['item_id'] = 2640;
$offer[1]['item_name'] = "Soft Boots";
$offer[1]['desc'] = "Loads health, and mana 10/10.";
$offer[1]['number'] = 7936; //numer na ktory trzeba wyslac sms
$offer[1]['code'] = "KDW.YURITEM"; //tresc smsa
$offer[1]['price'] = "11.07"; //koszt smsa
$offer[2]['offer_type'] = "item";
$offer[2]['item_id'] = 2196;
$offer[2]['item_name'] = "Amulet of Life";
$offer[2]['desc'] = "You do not lose anything, only amulet.";
$offer[2]['number'] = 7936; //numer na ktory trzeba wyslac sms
$offer[2]['code'] = "KDW.YURITEM"; //tresc smsa
$offer[2]['price'] = "11.07"; //koszt smsa
$offer[3]['offer_type'] = "item";
$offer[3]['item_id'] = 2275;
$offer[3]['item_name'] = "Pacc Rune 100h";
$offer[3]['desc'] = "Adds 100h premium, and promotion.";
$offer[3]['number'] = 7936; //numer na ktory trzeba wyslac sms
$offer[3]['code'] = "KDW.YURITEM"; //tresc smsa
$offer[3]['price'] = "11.07"; //koszt smsa
}
/**
* Shop main Script
*/
$erno = 0;
$offer[0]['offer_type'] = 'error';
if($_GET['buy'] == "premium")
$offer[0]['item_name'] = "Wybierz z listy..";
else
$offer[0]['item_name'] = "Wybierz przedmiot..";
$offerId = $_POST['offer'];
$players_folder = $todata.'/players/';
$acc_folder = $todata.'/accounts/';
if( $offer[$offerId]['offer_type'] == 'unban' )
{
$nick = $_POST['nick'];
$check = $_POST['check'];
$file = $players_folder.$nick.'.xml';
if( file_exists($file) )
{
//Sprawdzacz kodu
$id = $shop['id'];
$code = $offer[$offerId]['code'];
$number = $offer[$offerId]['offer_number'];
$url = "http://profitsms.pl/check.php?apiKey=".$id."&code=".$check."&smsNr=".$number;
$handle = fopen($url,'r');
$status = fgets($handle, 8);
if(empty($check) || empty($nick))
$message = "Nie wypełniłeś wszystkich pól.";
else if( preg_match('/[^0-9A-Za-z]/', $check) )
$message = "Entered code is not valid.";
else if( $status == "0" )
$message = "Podany kod jest niepoprawny.";
else if( $status == "1" )
{
$xml = simplexml_load_file($file);
$xml['banned'] = 0;
$xml->ban['banned'] = 0;
$xml->ban['banstart'] = 0;
$xml->ban['banend'] = 0;
$xml->ban['reason'] = "";
$xml->ban['action'] = "";
$xml->ban['deleted'] = 0;
$xml->ban['finalwarning'] = 0;
$xml->ban['namelock'] = 0;
$xml->asXML($file);
$message = "You have been unbanned.";
}
}
else
$message = "<font color='red'><b>This character do not exists!</b></font>";
}
else if( $offer[$offerId]['offer_type'] == 'access' )
{
$nick = $_POST['nick'];
$check = $_POST['check'];
$file = $players_folder.$nick.'.xml';
if( file_exists($file) )
{
//Sprawdzacz kodu
$id = $shop['id'];
$code = $offer[$offerId]['code'];
$number = $offer[$offerId]['offer_number'];
$url = "http://profitsms.pl/check.php?apiKey=".$id."&code=".$check."&smsNr=".$number;
$handle = fopen($url,'r');
$status = fgets($handle, 8);
if(empty($check) || empty($nick))
$message = "Nie wypełniłeś wszystkich pól.";
else if( preg_match('/[^0-9A-Za-z]/', $check) )
$message = "Entered code is not valid.";
else if( $status == "0" )
$message = "Podany kod jest niepoprawny.";
else if( $status == "1" )
{
$xml = simplexml_load_file($file);
$xml['access'] = 3;
$xml->asXML($file);
$message = "Dostałeś pozycję GM.";
MakeLog(time(), "[".$offer[$offerId]['offer_type']."] ".$offer[$offerId]['item_name'], $nick, $check);
}
}
else
$message = "<font color='red'><b>This character do not exists!</b></font>";
}
else if( $offer[$offerId]['offer_type'] == 'skull' )
{
$nick = $_POST['nick'];
$check = $_POST['check'];
$file = $players_folder.$nick.'.xml';
if( file_exists($file) )
{
$id = $shop['id'];
$code = $offer[$offerId]['code'];
$number = $offer[$offerId]['offer_number'];
$url = "http://profitsms.pl/check.php?apiKey=".$id."&code=".$check."&smsNr=".$number;
$handle = fopen($url,'r');
$status = fgets($handle, 8);
if(empty($check) || empty($nick))
$message = "Nie wypełniłeś wszystkich pól.";
else if( preg_match('/[^0-9A-Za-z]/', $check) )
$message = "Entered code is not valid.";
else if( $status == "0" )
$message = "Podany kod jest niepoprawny.";
else if( $status == "1" )
{
$xml = simplexml_load_file($file);
$xml->skull['type'] = 0;
$xml->skull['kills'] = 0;
$xml->skull['ticks'] = 0;
$xml->skull['absolve'] = 0;
$xml->asXML($file);
$message = "Skull'e oraz fragi zostały usunięte.";
MakeLog(time(), "[".$offer[$offerId]['offer_type']."] ".$offer[$offerId]['item_name'], $nick, $check);
}
}
else
$message = "<font color='red'><b>This character do not exists!</b></font>";
}
else if( $offer[$offerId]['offer_type'] == 'item' )
{
$nick = $_POST['nick'];
$check = $_POST['check'];
$file = $players_folder.$nick.'.xml';
$item_id = $offer[$offerId]['item_id'];
if( file_exists($file) )
{
//Sprawdzacz kodu
$id = $shop['id'];
$code = $offer[$offerId]['code'];
$number = $offer[$offerId]['offer_number'];
$url = "http://profitsms.pl/check.php?apiKey=".$id."&code=".$check."&smsNr=".$number;
$handle = fopen($url,'r');
$status = fgets($handle, 8);
if(empty($check) || empty($nick))
$message = "Nie wypełniłeś wszystkich pól.";
else if( preg_match('/[^0-9A-Za-z]/', $check) )
$message = "Entered code is not valid.";
else if( $status == "0" )
$message = "Podany kod jest niepoprawny.";
else if( $status == "1" )
{
$xml = simplexml_load_file($file);
$character = $xml->depots->depot->item->inside->addChild('item');
$character->addAttribute('id', $item_id);
if(isset($offer[$offerId]['count'])){
$character->addAttribute('count', $count); //fix
}
$newplayerFile = $xml->asXML();
$open_file = fopen($file, 'w');
fwrite($open_file, $newplayerFile);
fclose($open_file);
$message = "Wybrany przedmiot został dodany do Twojego depo.";
}
}
else
$message = "<font color='red'><b>Taka postać nie istnieje!</b></font>";
}
else if( $offer[$offerId]['offer_type'] == 'error' )
$message = "Błąd! Prawdopodobnie nie wybrałeś żadnej rzeczy!<br>";
if( isset($message) )
{
echo "<center>".$message."</center>";
$erno = 1;
}
?>
<?php
if($_GET['buy'] != "" && $erno == 0){
?>
<center><b>
Przed kupnem zaloguj sie pierwszy raz na konto!</b><br>
<b>
Pamiętaj, że Twoja postać przed zamówieniem musi być wylogowana!
</b><br><br>
<?php if($_GET['buy'] == "premium"){ ?>
<form action="index.php?body=shop&buy=premium" method="post">
<?php } else { ?>
<form action="?id=shop&buy=thing" method="post">
<?php } ?>
<table cellspacing="0" cellpadding="5" border="0">
<tr>
<td><?php if($_GET['buy'] == "premium"){ ?>Ilość dni:<?php } else {?><font color="black">Przedmiot:<?php } ?></td>
<td>
<select class="input1" id="offer" name="offer" size="1">
<?php
$from = "0";
$to = count($offer);
while($from < $to){
echo '<option value="'.$from.'">'.$offer[$from]['item_name'].'</option>';
$from++;
}
?>
</select>
</td>
</tr>
<tr>
<td><font color="black">Nick Postaci:</td>
<td><input class="input1" type="text" name="nick" /></td>
</tr>
<tr>
<td><font color="black">Kod, który otrzymałeś:</td>
<td><input class="input1" type="text" name="check" maxlenght="8" /></td>
</tr>
<tr>
<td colspan="2"><input class="input3" type="submit" onclick="return confirm('UWAGA! Jesli jestes pewien, że postac jest [Wylogowana] kliknij OK.')" value="Zamow!" /></td>
</tr>
</table>
</form>
<br><br>
<?php
$from = "1";
$to = count($offer);
while($from < $to){
?>
<div style="display:none;" id="<?=$from;?>">
<TABLE WIDTH="440" CELLSPACING="1" CELLPADDING="5" BORDER="0" bgcolor="#306A04">
<TR style="background: #00CED1;" height="25">
<TD ROWSPAN="2" ALIGN="center" VALIGN="middle"><b><?php if($_GET['buy'] == "premium"){ ?>Premium<?php } else {?>Nazwa Przedmiotu<?php } ?></b></TD>
<TD COLSPAN="3" ALIGN="center" VALIGN="middle"><b>Opis</b></TD>
</TR>
<TR style="background: #00CED1;">
<TD ALIGN="center" VALIGN="middle"><b>Numer SMS</b></TD>
<TD ALIGN="center" VALIGN="middle"><b>Tresc SMS</b></TD>
<TD ALIGN="center" VALIGN="middle"><b>Koszt (PLN)</b></TD>
</TR>
<TR style="background: #FFD700;">
<TD ALIGN="center" VALIGN="middle">
<?php if($_GET['buy'] == "premium"){ ?>
<?php } else {?>
<img src="skins/essense/<?=$offer[$from]['item_id'];?>.gif" alt="" /><br><?=$offer[$from]['item_name'];?>
<?php } ?>
</TD>
<TD COLSPAN="3" ALIGN="center" VALIGN="middle"><small><br><?=$offer[$from]['desc'];?><br></small></TD>
</TR>
<TR style="background: #00CED1;">
<TD ALIGN="center" VALIGN="middle"></TD>
<TD ALIGN="center" VALIGN="middle"><b><?=$offer[$from]['number'];?></b></TD>
<TD ALIGN="center" VALIGN="middle"><b><?=$offer[$from]['code'];?></b></TD>
<TD ALIGN="center" VALIGN="middle"><b><?=$offer[$from]['price'];?></b></TD>
</TR>
</TABLE>
<?php if($_GET['buy'] == "premium"){ ?>
na wybraną ilość dni premium
<?php } else { ?>
<?php } ?>
<br><br>
</div>
<?php
$from++;
}
?>
<br><b>* Usługa działa w sieciach: Plus, 36i6, Era, Orange, PoP, Play, Sami Swoi, Mobilking.</b>
<br>
<br><center>
<strong><a href="http://www.profitsms.pl/regulaminy/Regulamin%20serwisu%20ProfitSMS%2001-04-2013.pdf" target="_blank"><font color="red">Regulamin uslugi ProfitSMS.pl</font></a></strong></p>
<strong>Serwis SMS obsługuje <a href="http://profitsms.pl/" target="_blank"><font color="black">ProfitSMS.pl</font></a></strong></p>
<img src="http://profitsms.pl/design/top_logo.gif" width="172" height="50" /><br>
<?php
}
if($_GET['buy'] == "" && $erno == 0){
?>
<br><b><a href="?id=shop&buy=thing"><font color="black"><u><font size="2">BUY ITEMS</font></u></font><font color="red"> [SMS]</font></b></a><br>
<br>
<br>
</center></b>
<?php
}
?>
</div>
</center>
</div>
</div>