LTD Script [CROSS-COMPATIBLE][PHOENIX]
Hey again guys,
As Phoenix is still not using an SWF that allows you to buy LTD Rares from inside of the client, I decided to create a little LTD Script that you can set up on your homepage :)
Its mainly compatible with UberCMS, and with a little editing, it should work great on other CMS's too.
This script lets you add an LTD Rare, and then put it on sale, and let people buy it via your homepage.
Example: http://gyazo.com/57c37ee3ab1aca7c083d3fbf051e1a39.png
PHP :
PHP Code:
<div class="limited-edition">
<?php
$getRare = dbquery("SELECT * FROM rares ORDER BY timestamp DESC LIMIT 1");
$rare = mysql_fetch_assoc($getRare);
$getUser = dbquery("SELECT * FROM users WHERE id = '".USER_ID."' LIMIT 1");
$user = mysql_fetch_assoc($getUser);
if(isset($_POST['submit'])){
if($user['credits'] >= $rare['credits'] AND $user['vip_points'] >= $rare['vip_points'] AND $rare['amount'] >= 1){
dbquery("UPDATE rares SET amount = amount - 1 WHERE id = '".$rare['id']."'");
dbquery("UPDATE users SET credits = credits - ".$rare['credits'].", vip_points = vip_points - ".$rare['vip_points']." WHERE id = '".USER_ID."'");
$item = $rare['item_ids'];
$page = $rare['page_id'];
$core->Mus( 'giveitem', USER_ID . ' '.$item.' '.$page.' Enjoy your Limited Edition furni! Keep checking for more Limited Edition furnis!');
$core->Mus( 'updatepoints', USER_ID );
$core->Mus( 'updatecredits', USER_ID );
header("Location: ".WWW."/client");
}
}
echo'
<div class="image" style="background:url(\''.$rare['image'].'\') no-repeat;background-position:center center;"></div>
<div class="details">
<div class="header"></div>
<span class="item-name"><b>'.$rare['name'].'</b> '.$rare['caption'].'</span>
<span class="item-desc">Amount available: <b>'.$rare['amount'].'</b>
<BR>Price:<b>';
if($rare['credits'] >= 1 & $rare['vip_points'] >= 1){
echo' '.$rare['credits'].' credits + '.$rare['vip_points'].' shells ';
}
elseif($rare['credits'] >= 1 & $rare['vip_points'] == 0) {
echo' '.$rare['credits'].' credits ';
}
elseif($rare['credits'] == 0 & $rare['vip_points'] >= 1) {
echo' '.$rare['vip_points'].' shells ';
}
elseif($rare['credits'] == 0 & $rare['vip_points'] == 0) {
echo' Free! ';
}
echo '</b></span>';
if($rare['amount'] >= 1 & $user['credits'] >= $rare['credits'] & $user['vip_points'] >= $rare['vip_points']) {
echo' <form method="post"><input type="submit" name="submit" value="Buy" /></form> ';
}
elseif($rare['amount'] >= 1 & $user['credits'] < $rare['credits']) {
echo' <input type="submit" name="currency" value="Not enough credits!" /> ';
}
elseif($rare['amount'] >= 1 & $user['vip_points'] < $rare['vip_points']) {
echo' <input type="submit" name="currency" value="Not enough shells!" /> ';
}
elseif($rare['amount'] == 0) {
echo'<input type="submit" name="none" value="Sold Out!" />';
}
echo'</div>';
?>
</div>
SQL:
PHP Code:
CREATE TABLE IF NOT EXISTS `rares` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`item_ids` int(120) NOT NULL,
`page_id` int(120) NOT NULL,
`name` varchar(100) NOT NULL,
`caption` varchar(150) NOT NULL,
`amount` int(10) NOT NULL,
`credits` int(10) NOT NULL DEFAULT '0',
`vip_points` int(10) NOT NULL DEFAULT '0',
`image` varchar(500) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
I think it needs a little bit of re-coding considering I created this script when I was still in the process of getting a grip of PHP (which was a few months ago).
There is also no style sheet associated with the script, so you will need to design the look and feel of it.
This script is also compatible with Phoenix, as once you "buy" the furni, it will update your credits/pixels/shells and also automatically insert the item into your Inventory using MUS.
At the time of coding this, I tried to make it as flexible as possible, meaning that you are able to pick the currency the LTD is - credits / pixels / shells. If you want an image of the LTD Rare to display, you will need to save the image in your directory, and in the "image" area of the "rares" table, the link to the image will go there.
If you have any questions about this release, feel free to ask. I'll try to help you as best as possible.
Like + Rep if you like this release :ott1:
Thanks
- Nicholas
Re: LTD Script [CROSS-COMPATIBLE][PHOENIX]
Is this the one that there are a limited amount of rares, and you have buy them before they run out?
Re: LTD Script [CROSS-COMPATIBLE][PHOENIX]
Quote:
Originally Posted by
Weytin
Is this the one that there are a limited amount of rares, and you have buy them before they run out?
Exactly how it works! You give a certain amount of that particular rare, and once it runs out, it will display "Sold Out". Of course though, you can add additional "amounts" with the database :)
Re: LTD Script [CROSS-COMPATIBLE][PHOENIX]
Can someone convert this for RevCMS?
Re: LTD Script [CROSS-COMPATIBLE][PHOENIX]
Quote:
Originally Posted by
Ddos Attack
Exactly how it works! You give a certain amount of that particular rare, and once it runs out, it will display "Sold Out". Of course though, you can add additional "amounts" with the database :)
That's what I was hoping for, thanks.
Re: LTD Script [CROSS-COMPATIBLE][PHOENIX]
Thanks ! :D You didn't even forgot the Mus shit for automatic delivering. Must-have til Phoenix 4
Re: LTD Script [CROSS-COMPATIBLE][PHOENIX]
Thanks so much. Like + Rep for you <3 *-*
Re: LTD Script [CROSS-COMPATIBLE][PHOENIX]
Here's my style for the script:
Code:
<?php
$getRare = dbquery("SELECT * FROM rares ORDER BY timestamp DESC LIMIT 1");
$getUser = dbquery("SELECT * FROM users WHERE id = '".USER_ID."' LIMIT 1");
$user = mysql_fetch_assoc($getUser);
if(isset($_POST['submit'])){
if($user['credits'] >= $rare['credits'] AND $user['vip_points'] >= $rare['vip_points'] AND $rare['amount'] >= 1){
dbquery("UPDATE rares SET amount = amount - 1 WHERE id = '".$rare['id']."'");
dbquery("UPDATE users SET credits = credits - ".$rare['credits'].", vip_points = vip_points - ".$rare['vip_points']." WHERE id = '".USER_ID."'");
$item = $rare['item_ids'];
$page = $rare['page_id'];
$core->Mus('giveitem', USER_ID . ' '.$item.' '.$page.' Voilà ton mobis édition limitée est livré!');
$core->Mus('updatepoints', USER_ID );
$core->Mus('updatecredits', USER_ID );
header("Location: ".WWW."/client");
}
}
echo '<div class="habblet-container ">
<div class="cbb clearfix red ">
<h2 class="title"><span style="float: left;">Édition limitée</span></h2>
<div class="box-content">';
if (mysql_num_rows($getRare) > 0)
{
$oe = 1;
while ($rare = mysql_fetch_assoc($getRare))
{
if ($oe == 2)
{
$oe = 1;
}
else
{
$oe = 2;
}
echo '<table width="107%" style="padding: 5px; margin-left: -15px; background-color: ' . (($oe == 2) ? '#fff' : '#E6E6E6') . ';">
<tbody>
<tr>
<td valign="middle" width="25">
<img style="margin-top: -10px;" src="' . $rare['image'] . '">
</td>
<td valign="top">
<b style="font-size: 110%;">' . $rare['name'] . '</b><br />
<i>' . $rare['caption'] . '</i><br />
Quantité restante: <b>' . $rare['amount'] . '<br />
Prix:<b>';
if($rare['credits'] >= 1 & $rare['vip_points'] >= 1){
echo' '.$rare['credits'].' Crédits + '.$rare['vip_points'].' Coquillages ';
}
elseif($rare['credits'] >= 1 & $rare['vip_points'] == 0) {
echo' '.$rare['credits'].' Crédits ';
}
elseif($rare['credits'] == 0 & $rare['vip_points'] >= 1) {
echo' '.$rare['vip_points'].' Coquillages ';
}
elseif($rare['credits'] == 0 & $rare['vip_points'] == 0) {
echo' Gratuit! ';
}
echo '</b><br />';
if($rare['amount'] >= 1 & $user['credits'] >= $rare['credits'] & $user['vip_points'] >= $rare['vip_points']) {
echo '<form method="post"><input type="submit" value="Acheter" name="buy" class="submit" style="float: right;" /></form>';
}
elseif($rare['amount'] >= 1 & $user['credits'] < $rare['credits']) {
echo '<br><b style="float: right;">Pas assez de crédits</b>';
}
elseif($rare['amount'] >= 1 & $user['vip_points'] < $rare['vip_points']) {
echo '<br><b style="float: right;">Pas assez de coquillages</b>';
}
elseif($rare['amount'] == 0) {
echo '<br><b style="float: right;">Plus en stock</b>';
}
echo '</td>
</tr>
</tbody>
</table>';
}
}
else
{
echo '<i>Il n\'y a aucune vente active pour le moment</i>';
}
echo '</div>
</div>
</div>
<script type="text/javascript">if (!$(document.body).hasClassName(\'process-template\')) { Rounder.init(); }</script> ';
?>
http://images.habbostrap.com/strapcm...script-laf.png
But when I click on the button it does nothing, the script load but it seems to don't execute SQL queries and MUS Commands
Re: LTD Script [CROSS-COMPATIBLE][PHOENIX]
Hmm.. Do I smell exploitable scripts from an exploitable CMS or is it just me?
Anyways, good for people who like Phoenix and who want LTD shit, however it would be better if somebody made a AS3 script for it.
Re: LTD Script [CROSS-COMPATIBLE][PHOENIX]
No need for me. Got LTD working at Butterstorm :P Would be a bit double to add it to the CMS too :P
Also is this that same LTD you once showed me and I've been asking three months ago?
Re: LTD Script [CROSS-COMPATIBLE][PHOENIX]
Fixed it myself, the code is a lot messy (Actually the Mus function for uber is in the page can't get it working from a require_once with the global.php file):
PHP Code:
<?php
function Mus($header, $data = '')
{
$musData = $header . chr(1) . $data;
$sock = @socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp'));
@socket_connect($sock, '127.0.0.1', '30001');
@socket_send($sock, $musData, strlen($musData), MSG_DONTROUTE);
@socket_close($sock);
}
$getRare = dbquery("SELECT * FROM rares ORDER BY timestamp DESC LIMIT 1");
$rare = mysql_fetch_assoc($getRare);
$getUser = dbquery("SELECT * FROM users WHERE id = '".USER_ID."' LIMIT 1");
$user = mysql_fetch_assoc($getUser);
if(isset($_POST['submit'])){
if($user['credits'] >= $rare['credits'] AND $user['vip_points'] >= $rare['vip_points'] AND $rare['amount'] >= 1){
dbquery("UPDATE rares SET amount = amount - 1 WHERE id = '".$rare['id']."'");
dbquery("UPDATE users SET credits = credits - ".$rare['credits'].", vip_points = vip_points - ".$rare['vip_points']." WHERE id = '".USER_ID."'");
$item = $rare['item_ids'];
$page = $rare['page_id'];
Mus('giveitem', USER_ID . ' '.$item.' '.$page.' Voilà ton mobis édition limitée est livré!');
Mus('updatepoints', USER_ID );
Mus('updatecredits', USER_ID );
}
}
echo '<div class="habblet-container ">
<div class="cbb clearfix red ">
<h2 class="title"><span style="float: left;">Édition limitée</span></h2>
<div class="box-content">';
if (mysql_num_rows($getRare) > 0)
{
$oe = 1;
}
if ($oe == 2)
{
$oe = 1;
}
else
{
$oe = 2;
}
echo '<table width="107%" style="padding: 5px; margin-left: -15px; background-color: ' . (($oe == 2) ? '#fff' : '#E6E6E6') . ';">
<tbody>
<tr>
<td valign="middle" width="25">
<img style="margin-top: -10px;" src="' . $rare['image'] . '">
</td>
<td valign="top">
<b style="font-size: 110%;">' . $rare['name'] . '</b><br />
<i>' . $rare['caption'] . '</i><br />
Quantité restante: <b>' . $rare['amount'] . '<br />
Prix:<b>';
if($rare['credits'] >= 1 & $rare['vip_points'] >= 1){
echo' '.$rare['credits'].' Crédits + '.$rare['vip_points'].' Coquillages ';
}
elseif($rare['credits'] >= 1 & $rare['vip_points'] == 0) {
echo' '.$rare['credits'].' Crédits ';
}
elseif($rare['credits'] == 0 & $rare['vip_points'] >= 1) {
echo' '.$rare['vip_points'].' Coquillages ';
}
elseif($rare['credits'] == 0 & $rare['vip_points'] == 0) {
echo' Gratuit! ';
}
echo '</b><br />';
if($rare['amount'] >= 1 & $user['credits'] >= $rare['credits'] & $user['vip_points'] >= $rare['vip_points']) {
echo '<form method="post"><input type="submit" class="submit" style="float: right;" name="submit" value="Acheter" /></form>';
}
elseif($rare['amount'] >= 1 & $user['credits'] < $rare['credits']) {
echo '<br><b style="float: right;">Pas assez de crédits</b>';
}
elseif($rare['amount'] >= 1 & $user['vip_points'] < $rare['vip_points']) {
echo '<br><b style="float: right;">Pas assez de coquillages</b>';
}
elseif($rare['amount'] == 0) {
echo '<br><b style="float: right;">Plus en stock</b>';
}
echo '</td>
</tr>
</tbody>
</table>';
echo '</div>
</div>
</div>
<script type="text/javascript">if (!$(document.body).hasClassName(\'process-template\')) { Rounder.init(); }</script> ';
?>
Now the code is compatible with every CMS that use PHP ^^
Re: LTD Script [CROSS-COMPATIBLE][PHOENIX]
Quote:
Originally Posted by
Emetophobic
Fixed it myself, the code is a lot messy (Actually the Mus function for uber is in the page can't get it working from a require_once with the global.php file):
PHP Code:
<?php
function Mus($header, $data = '')
{
$musData = $header . chr(1) . $data;
$sock = @socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp'));
@socket_connect($sock, '127.0.0.1', '30001');
@socket_send($sock, $musData, strlen($musData), MSG_DONTROUTE);
@socket_close($sock);
}
$getRare = dbquery("SELECT * FROM rares ORDER BY timestamp DESC LIMIT 1");
$rare = mysql_fetch_assoc($getRare);
$getUser = dbquery("SELECT * FROM users WHERE id = '".USER_ID."' LIMIT 1");
$user = mysql_fetch_assoc($getUser);
if(isset($_POST['submit'])){
if($user['credits'] >= $rare['credits'] AND $user['vip_points'] >= $rare['vip_points'] AND $rare['amount'] >= 1){
dbquery("UPDATE rares SET amount = amount - 1 WHERE id = '".$rare['id']."'");
dbquery("UPDATE users SET credits = credits - ".$rare['credits'].", vip_points = vip_points - ".$rare['vip_points']." WHERE id = '".USER_ID."'");
$item = $rare['item_ids'];
$page = $rare['page_id'];
Mus('giveitem', USER_ID . ' '.$item.' '.$page.' Voilà ton mobis édition limitée est livré!');
Mus('updatepoints', USER_ID );
Mus('updatecredits', USER_ID );
}
}
echo '<div class="habblet-container ">
<div class="cbb clearfix red ">
<h2 class="title"><span style="float: left;">Édition limitée</span></h2>
<div class="box-content">';
if (mysql_num_rows($getRare) > 0)
{
$oe = 1;
}
if ($oe == 2)
{
$oe = 1;
}
else
{
$oe = 2;
}
echo '<table width="107%" style="padding: 5px; margin-left: -15px; background-color: ' . (($oe == 2) ? '#fff' : '#E6E6E6') . ';">
<tbody>
<tr>
<td valign="middle" width="25">
<img style="margin-top: -10px;" src="' . $rare['image'] . '">
</td>
<td valign="top">
<b style="font-size: 110%;">' . $rare['name'] . '</b><br />
<i>' . $rare['caption'] . '</i><br />
Quantité restante: <b>' . $rare['amount'] . '<br />
Prix:<b>';
if($rare['credits'] >= 1 & $rare['vip_points'] >= 1){
echo' '.$rare['credits'].' Crédits + '.$rare['vip_points'].' Coquillages ';
}
elseif($rare['credits'] >= 1 & $rare['vip_points'] == 0) {
echo' '.$rare['credits'].' Crédits ';
}
elseif($rare['credits'] == 0 & $rare['vip_points'] >= 1) {
echo' '.$rare['vip_points'].' Coquillages ';
}
elseif($rare['credits'] == 0 & $rare['vip_points'] == 0) {
echo' Gratuit! ';
}
echo '</b><br />';
if($rare['amount'] >= 1 & $user['credits'] >= $rare['credits'] & $user['vip_points'] >= $rare['vip_points']) {
echo '<form method="post"><input type="submit" class="submit" style="float: right;" name="submit" value="Acheter" /></form>';
}
elseif($rare['amount'] >= 1 & $user['credits'] < $rare['credits']) {
echo '<br><b style="float: right;">Pas assez de crédits</b>';
}
elseif($rare['amount'] >= 1 & $user['vip_points'] < $rare['vip_points']) {
echo '<br><b style="float: right;">Pas assez de coquillages</b>';
}
elseif($rare['amount'] == 0) {
echo '<br><b style="float: right;">Plus en stock</b>';
}
echo '</td>
</tr>
</tbody>
</table>';
echo '</div>
</div>
</div>
<script type="text/javascript">if (!$(document.body).hasClassName(\'process-template\')) { Rounder.init(); }</script> ';
?>
Now the code is compatible with every CMS that use PHP ^^
No, it isn't. Uber there are still some functions inside that other CMS' don't use.
Example: There are dbquery is an undefined method if you use this on other CMS', and USER_ID is an undefined constant.
Change all the dbquery(); functions to mysql_query for it to be compatible with other CMS'.
Re: LTD Script [CROSS-COMPATIBLE][PHOENIX]
Quote:
Originally Posted by
Weytin
No, it isn't. Uber there are still some functions inside that other CMS' don't use.
Example: There are dbquery is an undefined method if you use this on other CMS', and USER_ID is an undefined constant.
Change all the dbquery(); functions to mysql_query for it to be compatible with other CMS'.
Yoops, thanks for telling me. ^^'
Re: LTD Script [CROSS-COMPATIBLE][PHOENIX]
I was expecting it to be working in the client for a second there =) Seems nice though.. But maybe make it have a little LTD theme :p? Thanks though!
Re: LTD Script [CROSS-COMPATIBLE][PHOENIX]
Quote:
Originally Posted by
Emetophobic
Yoops, thanks for telling me. ^^'
No problem. Like/Rep my post if I helped. :P