Salve ragazzi oggi vorrei postare questo negozio che ho trovato su kekomundo
L'ho anche tradotto e ho cambiato i punti in crediti perchè altrimenti avremmo dovuto darei punti dal php
comunque iniziamo
andate in root/xampp/htdocs , create un file php e chiamatelo "badgeshop" senza ""
e inseriteci questo
poi in root/xampp/htdocs/inc/tpl create un tpl di nome "aboutpoints"
e inseriteci questo
sempre in tpl creiamo un altro tpl di nome "buybadge"
e inseriteci questo
Ora dobbiamo in qualche modo inserire i distintivi giusto?
ottimo andate in manage (o administracion come nel mio)
(la root del housekeeping)
andate in pages e create un file php di nome "addbadgetoshop"
e aggiungeteci
andate in top.php sempre nella root dell housekeeping
e inserite questa stringa dove volete che venga visualizzato il tastino "Aggiungi distintivi"
Poi nel db aggiungete questo codice:
Screen
Sito utenti
Housekeeping
Ricordo che l'ho tradotto al 100% io
Fonte: KekoMundo
Traduzione:mia al 100%
L'ho anche tradotto e ho cambiato i punti in crediti perchè altrimenti avremmo dovuto darei punti dal php
comunque iniziamo
andate in root/xampp/htdocs , create un file php e chiamatelo "badgeshop" senza ""
e inseriteci questo
<?php
/*=======================================================================
| UberCMS - Advanced Website and Content Management System for uberEmu
| #######################################################################
| Copyright (c) 2010, Roy 'Meth0d'
|
| #######################################################################
| This program is free software: you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation, either version 3 of the License, or
| (at your option) any later version.
| #######################################################################
| This program is distributed in the hope that it will be useful,
| but WITHOUT ANY WARRANTY; without even the implied warranty of
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
| GNU General Public License for more details.
\======================================================================*/
require_once "global.php";
if(USER_ID=="-1")
{
Header("Location: index.php");
//die("hai bisogno di loggarti."); // place holder
}
define('TAB_ID', 50);
define('PAGE_ID', 50);
$tpl->Init();
$tpl->AddGeneric('head-init');
$tpl->AddIncludeSet('generic');
$tpl->AddIncludeFile(new IncludeFile('text/css', 'http://images.habbo.com/habboweb/%web_build%/web-gallery/v2/styles/newcredits.css', 'stylesheet'));
$tpl->AddIncludeFile(new IncludeFile('text/javascript', 'http://images.habbo.com/habboweb/%web_build%/web-gallery/static/js/newcredits.js'));
$tpl->WriteIncludeFiles();
$tpl->AddGeneric('head-overrides-generic');
$tpl->AddGeneric('head-bottom');
$tpl->AddGeneric('generic-top');
$tpl->Write('<div id="column1" class="column">');
$tpl->AddGeneric('buybadge');
$tpl->Write('</div>');
$tpl->Write('<div id="column2" class="column">');
$tpl->AddGeneric('aboutpoints');
$tpl->Write('</div>');
$tpl->AddGeneric('generic-column3');
$tpl->AddGeneric('footer');
$tpl->SetParam('page_title', 'Badge Shop');
$tpl->SetParam('body_id', 'home');
$tpl->Output();
?>
/*=======================================================================
| UberCMS - Advanced Website and Content Management System for uberEmu
| #######################################################################
| Copyright (c) 2010, Roy 'Meth0d'
|
Perfavore,
Entra
oppure
Registrati
per vedere i Link!
| #######################################################################
| This program is free software: you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation, either version 3 of the License, or
| (at your option) any later version.
| #######################################################################
| This program is distributed in the hope that it will be useful,
| but WITHOUT ANY WARRANTY; without even the implied warranty of
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
| GNU General Public License for more details.
\======================================================================*/
require_once "global.php";
if(USER_ID=="-1")
{
Header("Location: index.php");
//die("hai bisogno di loggarti."); // place holder
}
define('TAB_ID', 50);
define('PAGE_ID', 50);
$tpl->Init();
$tpl->AddGeneric('head-init');
$tpl->AddIncludeSet('generic');
$tpl->AddIncludeFile(new IncludeFile('text/css', 'http://images.habbo.com/habboweb/%web_build%/web-gallery/v2/styles/newcredits.css', 'stylesheet'));
$tpl->AddIncludeFile(new IncludeFile('text/javascript', 'http://images.habbo.com/habboweb/%web_build%/web-gallery/static/js/newcredits.js'));
$tpl->WriteIncludeFiles();
$tpl->AddGeneric('head-overrides-generic');
$tpl->AddGeneric('head-bottom');
$tpl->AddGeneric('generic-top');
$tpl->Write('<div id="column1" class="column">');
$tpl->AddGeneric('buybadge');
$tpl->Write('</div>');
$tpl->Write('<div id="column2" class="column">');
$tpl->AddGeneric('aboutpoints');
$tpl->Write('</div>');
$tpl->AddGeneric('generic-column3');
$tpl->AddGeneric('footer');
$tpl->SetParam('page_title', 'Badge Shop');
$tpl->SetParam('body_id', 'home');
$tpl->Output();
?>
poi in root/xampp/htdocs/inc/tpl create un tpl di nome "aboutpoints"
e inseriteci questo
<?php
$getSettings = dbquery("SELECT * FROM users WHERE username = '" . USER_NAME . "'");
$userAccount = mysql_fetch_assoc($getSettings);
?>
<div class="habblet-container ">
<div class="cbb clearfix blue ">
<h2 class="title">A cosa serve?</h2>
<center>
Questo negozio serve a voi utenti per comprare distintivi con crediti.</center>
</div></div>
<div class="cbb clearfix blue ">
<h2 class="title">Come prendo crediti?</h2>
<center>Facilissimo.In questo hotel basta aspettare 3 ore e arriveranno 3000 crediti oppure chiedi crediti allo staff</center>
</div></div>
$getSettings = dbquery("SELECT * FROM users WHERE username = '" . USER_NAME . "'");
$userAccount = mysql_fetch_assoc($getSettings);
?>
<div class="habblet-container ">
<div class="cbb clearfix blue ">
<h2 class="title">A cosa serve?</h2>
<center>
Questo negozio serve a voi utenti per comprare distintivi con crediti.</center>
</div></div>
<div class="cbb clearfix blue ">
<h2 class="title">Come prendo crediti?</h2>
<center>Facilissimo.In questo hotel basta aspettare 3 ore e arriveranno 3000 crediti oppure chiedi crediti allo staff</center>
</div></div>
sempre in tpl creiamo un altro tpl di nome "buybadge"
e inseriteci questo
<?php
$getSettings = dbquery("SELECT * FROM users WHERE username = '" . USER_NAME . "'");
$userAccount = mysql_fetch_assoc($getSettings);
$checkUserBadges = dbquery("SELECT * FROM user_badges WHERE user_id = '" . USER_ID . "'");
$userBadges = mysql_fetch_assoc($checkUserBadges);
$getBadges = dbquery("SELECT * FROM badge_shop");
if(isset($_GET["buybadge"]))
{
$getBadgeCost = dbquery("SELECT * FROM badge_shop WHERE badge_id = '" . $_GET["buybadge"] . "'");
$badgeCost = mysql_fetch_assoc($getBadgeCost);
$doesBadgeExist = dbquery("SELECT badge_id FROM badge_shop WHERE badge_id = '" . $_GET["buybadge"] . "'");
if(!file_exists("./c_images/album1584/" . $_GET["buybadge"] . ".gif"))
{
Header("Location: badgeshop.php?error=notexist");
}
elseif(!mysql_num_rows($doesBadgeExist))
{
Header("Location: badgeshop.php?error=notsold");
}
else
{
if($userAccount["credits"] < $badgeCost['cost'])
{
Header("Location: badgeshop.php?error=balance");
}
else
{
dbquery("INSERT INTO user_badges (user_id, badge_id, badge_slot) VALUES ('" . $userAccount['id'] . "', '" . $_GET["buybadge"] . "', '0')");
dbquery("UPDATE users SET credits = credits - " . $badgeCost['cost'] . " WHERE username = '" . $userAccount['username'] . "'");
Header("Location: badgeshop.php?bought=" . $_GET["buybadge"]);
}
}
}
?>
<div class="habblet-container ">
<div class="cbb clearfix red ">
<h2 class="title">Negozio Distintivi</h2>
<center>
<?php
if(isset($_GET["error"]))
{
if($_GET["error"] == "notexist")
{
echo "<font color='darkred'><b>Questo distintivo non esiste nel nostro server e quindi non puoi comprarlo.</font color></b><br>";
}
elseif($_GET["error"] == "notsold")
{
echo "<font color='darkred'><b>Questo distintivo non e' presente nel nostro negozio.</font color></b><br>";
}
elseif($_GET["error"] == "balance")
{
echo "<font color='darkred'><b>Non hai abbastanza crediti per comprare questo distintivo.</font color></b><br>";
}
echo "<br>Clicca <a href='badgeshop.php'>qui</a> Per ritornare allo shop.";
}
elseif(isset($_GET["bought"]))
{
echo "<b>Hai comprato il distintivo: " . $_GET["bought"] . " con successo.</b><br>";
echo "<br>Clicca <a href='badgeshop.php'>qui</a> per ritornare allo shop.";
}
else
{
?>Puoi comprare distintivi in questo negozio | I tuoi crediti: <b><?php echo $userAccount["credits"]; ?></b><br><b><h3><font color='darkred'>Ricarica il client affinche' l'acquisto abbia effetto.</font color></b><br>
</h3><?php
while($badgeShit = mysql_fetch_assoc($getBadges))
{
echo '<table border="0">
<tr>
<td><img src="./c_images/album1584/' . $badgeShit['badge_id'] . '.gif"> </td>
<td>- Costo: ' . $badgeShit['cost'] . ' crediti - <a href="badgeshop.php?buybadge=' . $badgeShit['badge_id'] . '">buy</a></td>
</tr></table>';
}
}
?>
</center>
</div></div>
$getSettings = dbquery("SELECT * FROM users WHERE username = '" . USER_NAME . "'");
$userAccount = mysql_fetch_assoc($getSettings);
$checkUserBadges = dbquery("SELECT * FROM user_badges WHERE user_id = '" . USER_ID . "'");
$userBadges = mysql_fetch_assoc($checkUserBadges);
$getBadges = dbquery("SELECT * FROM badge_shop");
if(isset($_GET["buybadge"]))
{
$getBadgeCost = dbquery("SELECT * FROM badge_shop WHERE badge_id = '" . $_GET["buybadge"] . "'");
$badgeCost = mysql_fetch_assoc($getBadgeCost);
$doesBadgeExist = dbquery("SELECT badge_id FROM badge_shop WHERE badge_id = '" . $_GET["buybadge"] . "'");
if(!file_exists("./c_images/album1584/" . $_GET["buybadge"] . ".gif"))
{
Header("Location: badgeshop.php?error=notexist");
}
elseif(!mysql_num_rows($doesBadgeExist))
{
Header("Location: badgeshop.php?error=notsold");
}
else
{
if($userAccount["credits"] < $badgeCost['cost'])
{
Header("Location: badgeshop.php?error=balance");
}
else
{
dbquery("INSERT INTO user_badges (user_id, badge_id, badge_slot) VALUES ('" . $userAccount['id'] . "', '" . $_GET["buybadge"] . "', '0')");
dbquery("UPDATE users SET credits = credits - " . $badgeCost['cost'] . " WHERE username = '" . $userAccount['username'] . "'");
Header("Location: badgeshop.php?bought=" . $_GET["buybadge"]);
}
}
}
?>
<div class="habblet-container ">
<div class="cbb clearfix red ">
<h2 class="title">Negozio Distintivi</h2>
<center>
<?php
if(isset($_GET["error"]))
{
if($_GET["error"] == "notexist")
{
echo "<font color='darkred'><b>Questo distintivo non esiste nel nostro server e quindi non puoi comprarlo.</font color></b><br>";
}
elseif($_GET["error"] == "notsold")
{
echo "<font color='darkred'><b>Questo distintivo non e' presente nel nostro negozio.</font color></b><br>";
}
elseif($_GET["error"] == "balance")
{
echo "<font color='darkred'><b>Non hai abbastanza crediti per comprare questo distintivo.</font color></b><br>";
}
echo "<br>Clicca <a href='badgeshop.php'>qui</a> Per ritornare allo shop.";
}
elseif(isset($_GET["bought"]))
{
echo "<b>Hai comprato il distintivo: " . $_GET["bought"] . " con successo.</b><br>";
echo "<br>Clicca <a href='badgeshop.php'>qui</a> per ritornare allo shop.";
}
else
{
?>Puoi comprare distintivi in questo negozio | I tuoi crediti: <b><?php echo $userAccount["credits"]; ?></b><br><b><h3><font color='darkred'>Ricarica il client affinche' l'acquisto abbia effetto.</font color></b><br>
</h3><?php
while($badgeShit = mysql_fetch_assoc($getBadges))
{
echo '<table border="0">
<tr>
<td><img src="./c_images/album1584/' . $badgeShit['badge_id'] . '.gif"> </td>
<td>- Costo: ' . $badgeShit['cost'] . ' crediti - <a href="badgeshop.php?buybadge=' . $badgeShit['badge_id'] . '">buy</a></td>
</tr></table>';
}
}
?>
</center>
</div></div>
Ora dobbiamo in qualche modo inserire i distintivi giusto?
ottimo andate in manage (o administracion come nel mio)
(la root del housekeeping)
andate in pages e create un file php di nome "addbadgetoshop"
e aggiungeteci
<?php
if (!defined('IN_HK') || !IN_HK)
{
exit;
}
if (!HK_LOGGED_IN || !$users->hasFuse(USER_ID, 'fuse_admin'))
{
exit;
}
if (isset($_POST['badge']))
{
$badge = $_POST['badge'];
$price = $_POST['price'];
dbquery("INSERT INTO badge_shop (badge_id, cost) VALUES ('" . $badge . "', '" . $price . "')");
}
require_once "top.php";
?>
<h1>Aggiungi un distintivo al negozio</h1>
<br />
<p>Aggiungi il codice del distintivo e il costo </i>
</p>
<br />
<p>
<?php if (isset($_POST['badge'])) { ?>
<h1 style="padding: 15px;">Fatto<br><a href="%www%/manage/index.php?_cmd=main"> Ritorna alla index</a></h1> <?php } else { ?>
<form method="post">Codice distintivo: <input type='text' name='badge' maxlength='20'><br>
Prezzo: <input type='text' name='price' maxlength='20'><br>
<input type="submit" value="Aggiungi!">
</form>
</p>
<?php
}
require_once "bottom.php";
?>
if (!defined('IN_HK') || !IN_HK)
{
exit;
}
if (!HK_LOGGED_IN || !$users->hasFuse(USER_ID, 'fuse_admin'))
{
exit;
}
if (isset($_POST['badge']))
{
$badge = $_POST['badge'];
$price = $_POST['price'];
dbquery("INSERT INTO badge_shop (badge_id, cost) VALUES ('" . $badge . "', '" . $price . "')");
}
require_once "top.php";
?>
<h1>Aggiungi un distintivo al negozio</h1>
<br />
<p>Aggiungi il codice del distintivo e il costo </i>
</p>
<br />
<p>
<?php if (isset($_POST['badge'])) { ?>
<h1 style="padding: 15px;">Fatto<br><a href="%www%/manage/index.php?_cmd=main"> Ritorna alla index</a></h1> <?php } else { ?>
<form method="post">Codice distintivo: <input type='text' name='badge' maxlength='20'><br>
Prezzo: <input type='text' name='price' maxlength='20'><br>
<input type="submit" value="Aggiungi!">
</form>
</p>
<?php
}
require_once "bottom.php";
?>
andate in top.php sempre nella root dell housekeeping
e inserite questa stringa dove volete che venga visualizzato il tastino "Aggiungi distintivi"
<li><a href="index.php?_cmd=addbadgetoshop"><b>Aggiungi distintivi</b></li>
Poi nel db aggiungete questo codice:
CREATE TABLE IF NOT EXISTS `badge_shop` (
`id` int(2) NOT NULL AUTO_INCREMENT,
`badge_id` varchar(6) NOT NULL,
`cost` int(1) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=17 ;
--
-- Dump dei dati per la tabella `badge_shop`
--
INSERT INTO `badge_shop` (`id`, `badge_id`, `cost`) VALUES
(0, 'BRA08', 50),
(1, 'NOC', 100),
(2, 'FAN', 75);
`id` int(2) NOT NULL AUTO_INCREMENT,
`badge_id` varchar(6) NOT NULL,
`cost` int(1) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=17 ;
--
-- Dump dei dati per la tabella `badge_shop`
--
INSERT INTO `badge_shop` (`id`, `badge_id`, `cost`) VALUES
(0, 'BRA08', 50),
(1, 'NOC', 100),
(2, 'FAN', 75);
Screen
Sito utenti
Perfavore,
Entra
oppure
Registrati
per vedere i Link!
Housekeeping
Perfavore,
Entra
oppure
Registrati
per vedere i Link!
Ricordo che l'ho tradotto al 100% io
Fonte: KekoMundo
Traduzione:mia al 100%
Ultima modifica: