Hi all, I will published a script adapted for the web: MPOG
But it is easily adaptable to other websites
Instructions:
- Download MPOG WEB and apply some fixes released on Ragezone
- Edit title.php search line:
PHP Code:
(case "login"; $pagetitle = "User Login"; break; )
and add this below:
PHP Code:
case "buycolorname";
$pagetitle = "Buy Color Name";
break;
- Add yours grades and colors:
E.G. :
PHP Code:
switch($grade){
case 10;
$grade = 10;
break;
case 11;
$grade = 11;
break;
case 12;
$grade = 12;
break;
If change it :
PHP Code:
switch($grade){
case CUSTOMGRADE;
$grade = CUSTOMGRADE;
break;
case CUSTROMGRADE2;
$grade = CUSTROMGRADE2;
break;
case CUSTROMGRADE3;
$grade = CUSTOMGRADE3;
break;
- If you edit the grades, also you need edit the colors in the FORM HTML.
Code:
<option class="red" value="10">RED</option>
<option class="white" value="11">WHITE</option>
<option class="blue" value="12">BLUE</option>
If change it:
Code:
<option class="colorcss" value="CUSTOGRADE">COLOR</option>..etc
- And add the css styles for the colors and.. edit
the two variables $price = intval(50);/<?=$infoacc->EventCoins( or euCoins)-50?> change "50" for a your price
mod_buycolorname.php(For MPOG )
PHP Code:
<?php
// Is logged?
if ($_SESSION['AID'] == "") {
re_dir("index.php?do=login");
}
$query00 = mssql_query("SELECT CID FROM Character(nolock) WHERE AID = '{$_SESSION['AID']}' AND CharNum != '-1' AND Name != '' ");
// Have characters?
if (mssql_num_rows($query00) < 1) {
msgbox("You dont have characters!", "index.php?do=buycolorname");
}
?>
<?php
if (isset($_POST['submit'])) {
$aid = antisql($_SESSION['AID']);
$grade = antisql($_POST['color']);
$price = intval(50);
// Color is valid?
switch($grade){
case 10;
$grade = 10;
break;
case 11;
$grade = 11;
break;
case 12;
$grade = 12;
break;
default:
msgbox("Invalid color name!", "index.php?do=buycolorname");
}
// Color is numeric?
if (!is_numeric($grade)) {
msgbox("Invalid color name!", "index.php?do=buycolorname");
}
// Color empty? useless
elseif (empty($grade)) {
msgbox("Invalid color name: Color is empty!", "index.php?do=buycolorname");
} else {
// Suficients coins ?
$query = mssql_query("SELECT euCoins FROM Login WHERE AID = '$aid'");
$info = mssql_fetch_assoc($query);
$updatecoins = $info['euCoins'] - $price;
if ($updatecoins < 0) {
msgbox("Insufficent coins!", "index.php?do=buycolorname");
} else {
// Update
$addcolor = mssql_query("UPDATE Account SET ugradeid = '$grade' WHERE AID = '$aid'");
$payingcoins = mssql_query("UPDATE Login SET euCoins = '$updatecoins' WHERE AID = '$aid'");
/*
OPTIONAL: Log the actions in DB
1. Run the query in sql server without the "////////"
2.Then add this line after $payingcoins: $logs = mssql_query("INSERT INTO Logbuycolor (AID,ColorBuy,RegDate) values ('$aid','$grade',GETDATE())");
3.Create a admin panel with the function to see logs actions: See buy color names, etc o Add the function to see buy color names
E.G: IfIsAdmin(){
// query select the logs... etc
}
Finish.
/////////////////////////////////////// table ////////////////////////////////////
USE [GunzDB]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Logbuycolor](
[AID] [int] NOT NULL,
[ColorBuy] [int] NOT NULL,
[RegDate] [datetime] NOT NULL,
CONSTRAINT [PK_Logbuycolor] PRIMARY KEY CLUSTERED
(
[AID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
/////////////////////////////////////////// end table ///////////////////////////////////////////////////
*/
if ($addcolor && $payingcoins) {
msgbox("Successfully purchased color name!", "index.php?do=buycolorname");
} else {
msgbox("There were problems with the server, try later", "index.php?do=buycolorname");
}
}
}
} else {
// Get some info
$query01 = mssql_query("SELECT euCoins,UserID FROM Login(nolock) WHERE AID = '{$_SESSION[AID]}'");
$infoacc = mssql_fetch_object($query01);
}
?>
<!-- Credits to mutter -->
<head>
<meta http-equiv="Content-Language" content="en">
<link rel="stylesheet" type="text/css" href="http://forum.ragezone.com/images/style.css">
<style type="text/css">
OPTION {
background-color:#666;
}
OPTION.red {
color:#F00;
font-weight:bold;
}
OPTION.white {
color:#FFF;
font-weight:bold;
}
OPTION.blue {
color:#00F;
font-weight: bold;
}
</style>
</head>
<form name="bcn" method="POST" action="index.php?do=buycolorname">
<body bgcolor="#323232">
<div align="center">
<table border="0" width="456" style="border-collapse: collapse">
<tr>
<td background="http://forum.ragezone.com/images/cont_up.jpg">
</td>
</tr>
<tr>
<td background="http://forum.ragezone.com/images/cont_bg.jpg">
<div align="center">
<table border="0" style="border-collapse: collapse" width="100%" height="100%">
<tr>
<td width="10" rowspan="10">
</td>
<td colspan="2" align="center">
<font color="#FFFFFF">Buy color name</font>
</td>
<td width="10" rowspan="10">
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td valign="middle" align="right">
<font color="#FFFFFF">Color</font>
</td>
<td width="204" valign="middle" align="left">
<select name="color">
<option selected value="">Select color</option>
<option class="red" value="10">RED</option>
<option class="white" value="11">WHITE</option>
<option class="blue" value="12">BLUE</option>
</select>
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td valign="middle" align="right">
<font color="#FFFFFF">Price:</font>
</td>
<td width="204" valign="middle" align="left">
<font color="#FFFFFF">50 Coins</font>
</td>
</tr>
<tr>
<td valign="middle" align="right">
<font color="#FFFFFF">Actual coins:</font>
</td>
<td width="204" valign="middle" align="left">
<?=$infoacc->euCoins?>
</td>
</tr>
<tr>
<tr>
<td valign="middle" align="right">
<font color="#FFFFFF">Coins remaining:</font>
</td>
<td width="204" valign="middle" align="left">
<?=$infoacc->euCoins-50?>
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td colspan="4" align="center">
<input type="submit" value="Buy Color Name" name="submit">
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td background="http://forum.ragezone.com/images/cont_top.jpg" height="27">
</td>
</tr>
</table>
</div>
</form>
<!-- Credits to mutter -->
module_buycolorname.php(for EuroGunz web)
PHP Code:
<?
if( $_SESSION['AID'] == "" )
{
SetURL("index.php?do=buycolorname");
SetMessage("Message from System", array("You must be logged in to buy Color name"));
header("Location: index.php?do=login");
die();
}
$query00 = mssql_query("SELECT CID FROM Character(nolock) WHERE AID = '{$_SESSION['AID']}' AND CharNum != '-1' AND Name != '' ");
// Have characters?
if (mssql_num_rows($query00) < 1) {
SetMessage("Message from System", array("You don't have any character!"));
header("Location: index.php");
die();
}
SetTitle("EuroGunz - Buy Color Name");
if (isset($_POST['submit'])) {
$aid = clean($_SESSION['AID']);
$grade = clean($_POST['color']);
$price = intval(50);
// Color is valid?
switch($grade){
case 10;
$grade = 10;
break;
case 11;
$grade = 11;
break;
case 12;
$grade = 12;
break;
default:
SetMessage("Message from System", array("The color id is invalid!"));
header("Location: index.php?do=shopitem");
die();
}
if (!is_numeric($grade)) {
SetMessage("Message from System", array("Invalid Color name!"));
header("Location: index.php?do=buycolorname");
die();
}
// Color empty? useless
elseif (empty($grade)) {
SetMessage("Message from System", array("You don't select a Color name!"));
header("Location: index.php?do=buycolorname");
die();
} else {
// Suficients coins ?
$query = mssql_query("SELECT EventCoins FROM Account(nolock) WHERE AID = '$aid'");
$info = mssql_fetch_assoc($query);
$updatecoins = $info['EventCoins'] - $price;
if ($updatecoins < 0) {
SetMessage("Message from System", array("You don't have suficient Event Coins"));
header("Location: index.php");
die();
} else {
// Update
$addcolor = mssql_query_logged("UPDATE Account SET ugradeid = '$grade', EventCoins = '$updatecoins' WHERE AID = '$aid'");
if ($addcolor) {
SetMessage("Message from System", array("Succesfully purchased color name!"));
header("Location: index.php");
die();
} else {
SetMessage("Message from System", array("There were problems with the server, try later!"));
header("Location: index.php");
die();
}
}
}
} else {
// Get some info
$query01 = mssql_query("SELECT EventCoins FROM Account(nolock) WHERE AID = '{$_SESSION[AID]}'");
$infoacc = mssql_fetch_object($query01);
}
?>
<style type="text/css">
OPTION {
background-color:#666;
}
OPTION.red {
color:#F00;
font-weight:bold;
}
OPTION.white {
color:#FFF;
font-weight:bold;
}
OPTION.blue {
color:#00F;
font-weight: bold;
}
</style>
<table border="0" style="border-collapse: collapse" width="100%">
<tr>
<td width="183" valign="top">
<div align="center">
<? include "blocks/block_ranking.php" ?>
</div>
</td>
<td valign="top">
<div align="center">
<table border="1" style="border-collapse: collapse" width="100%" bordercolor="#000000">
<tr>
<td background="http://forum.ragezone.com/images/content_bar.jpg" height="24" style="background-image: url('images/content_bar.jpg'); background-repeat: no-repeat; background-position: center top">
<div align="center">
<b><font face="Tahoma" size="2">Buy Color Name</font></b></td>
</tr>
<tr>
<td bgcolor="#2C2A2A">
<div align="center"><form method="POST" action="index.php?do=buycolorname" name="buycolorname">
<table border="0" style="border-collapse: collapse" width="414" height="100%">
<tr>
<td width="10"> </td>
<td width="315" colspan="3"> </td>
<td width="11"> </td>
</tr>
<tr>
<td width="10"> </td>
<td width="315" colspan="3">You can buy a Color name for Gunz.<br />
The price is 50 Event coins.</td>
<td width="11"> </td>
</tr>
<tr>
<td width="10"> </td>
<td width="315" colspan="3"><br /></td>
<td width="11"> </td>
</tr>
<tr>
<td width="10"> </td>
<td width="181">
<p align="right">Select the color</td>
<td width="13"> </td>
<td width="190">
<select name="color" class="cero">
<option selected value="">Select color</option>
<option class="red" value="10">RED</option>
<option class="white" value="11">WHITE</option>
<option class="blue" value="12">BLUE</option>
</select></td>
<td width="11"> </td>
</tr>
<tr>
<td width="10"> </td>
<td width="315" colspan="3"> </td>
<td width="11"> </td>
</tr>
<tr>
<td width="10"> </td>
<td width="181">
<p align="right">Price:</td>
<td width="13"> </td>
<td width="190"><b>50 Events Coins</b></td>
<td width="11"> </td>
</tr>
<tr>
<td width="10"> </td>
<td width="181">
<p align="right">Actual Event coins:</td>
<td width="13"> </td>
<td width="190"><b><?=$infoacc->EventCoins?></b></td>
<td width="11"> </td>
</tr>
<tr>
<td width="10"> </td>
<td width="181">
<p align="right">Coins remaining::</td>
<td width="13"> </td>
<td width="190"><b><?=$infoacc->EventCoins-50?></b></td>
<td width="11"> </td>
</tr>
<tr>
<td width="10"> </td>
<td width="315" colspan="3"> </td>
<td width="11"> </td>
</tr>
<tr>
<td width="10"> </td>
<td colspan="3">
<p align="center">
<input type="submit" value="Buy Color Name" name="submit"></td>
<td width="11"> </td>
</tr>
</table></form>
</div>
</td>
</tr>
</table>
</div>
<p align="center"> </td>
<td width="171" valign="top">
<div align="center">
<? include "blocks/block_login.php" ?>
</div>
</td>
</tr>
</table>
If you have problems please write it here (I don't have the sql server or xampp, I dont can test it )
P.S. : Sorry for my english
Guide to add custom grades 2008 files: http://forum.ragezone.com/f245/july-...tomize-688781/
Code:
Update v1.1:
Fixed: Filter color id
Fixed: A fetch_assoc
ByeBye