Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Release] Cash Shop Code Generator (PHP)

Status
Not open for further replies.
Banned
Banned
Joined
Jun 21, 2008
Messages
143
Reaction score
0
Aeronux has already released a NX Code Generator that let's someone only get a Code once in evey 24 Hours.

A lot have been having difficulties with getting the script to work and implementing it. So I re-wrote it and cleaned up the Code.

Credits go to Aernoux for the original script.

PHP:
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="submit" name="GetNX" value="Generate">
</form>


<?php

/* ----------
RE-WRITTEN AND SIMPLIFIED BY BAVILO
ORIGINAL SCRIPT BY AERONUX

This script solution uses IP address and a MySQL Day field
to keep track of giving a user free NX every 24 hours by generating
a 14-digit NX code.
---------- */

/*DATABASE CONFIG: Please fill this out correctly or script will not work. */
$DB_host = "localhost"; //Host; usually localhost
$DB_user = "replace_with_username"; //User Name
$DB_pass = "replace_with_password"; //Password
$DB_db = "replace_with_database_name"; // Database name

if (isset($_POST['GetNX'])){

/*DATABASE CONNECT */
$connect = mysql_connect($DB_host,$DB_user,$DB_pass);
$db = mysql_select_db($DB_db);

/* FUNCTION FOR GENERATING CODES */
	function NXCode() {
    $chars = "abcdefghijkmnopqrstuvwxyz0123456789";
    srand((double)microtime()*1000000);
    $i = 0;
    $pass = '' ;

    while ($i <= 13) {
        $num = rand() % 33;
        $tmp = substr($chars, $num, 1);
        $pass = $pass . $tmp;
        $i++;
    }
    return $pass;
}

/* Get the IP Address */
$IP = $_SERVER['REMOTE_ADDR'];

/* Check to see if they've gotten their NX for the day */
$chk1 = @mysql_query("SELECT * FROM `nxcode_track` WHERE `ip`='$IP'");
$num = @mysql_num_rows($chk1);
$chk = @mysql_fetch_array($chk1);
$lasttime = $chk["Day"];

/* 24 hours? */
if (($num>0) && ($lasttime != date("j"))) 

/* It's been at least 24 hours */
{ $CANGET = true; }
else if($num == 0)

/* Never requested NX */
{ $CANGET = true; } 
else

/* Already received */
{ $CANGET = false; }

/* If you are allowed to get NX */
 if($CANGET == true) {
 
/* Get the NX Code */
$pass = NXCode();
 
/* Delete last IP entry after 24 hours have passed */
mysql_query("DELETE FROM `nxcode_track` WHERE `IP`='$IP' OR `ID`='$chk[ID]'");

/*Insert the NX Code into the DataBase */
mysql_query("INSERT INTO `nxcode` (code, valid, user, type, item) VALUES ('$pass', 1, NULL, 0, 30000)") or die(mysql_error());

/* Insert new entry to block you for 24 hours to get more NX */
mysql_query("INSERT INTO `nxcode_track` (ID,IP,Day) VALUES (NULL,'$IP',".date("j").")");

/* Display the NX Code */
echo "<p>Your NX Code is: <b>$pass</b></p>";
} else {

/* Otherwise, Display that you have already gotten NX within 24 hours */
echo "<p><b>You have already gotten NX today!</b></p>";
}
}
?>

You will also need to create a new table in your odinms database.
I have attached the sql script (Please rename the file to nxcode_track.sql). All you have to do is open it with MySQL Query Browser or w/e you use. And execute it.

To see a preview of the script go here:



Enjoy!
 

Attachments

You must be registered for see attachments list
Experienced Elementalist
Joined
Apr 13, 2008
Messages
298
Reaction score
1
Sweet, good job :p

Lol @ SavageSteez's sig
 
Junior Spellweaver
Joined
Jun 5, 2008
Messages
138
Reaction score
0
I do not understand why people need NX code generator's. If you are going to give NX to somebody, why not just make a custom code like their account name or their first and last name. Sorry if I mis-understood or I am missing a point in this NX code maker.
 
Banned
Banned
Joined
Jun 21, 2008
Messages
143
Reaction score
0
I do not understand why people need NX code generator's. If you are going to give NX to somebody, why not just make a custom code like their account name or their first and last name. Sorry if I mis-understood or I am missing a point in this NX code maker.

It doesn't work like that.

Since the release of the Actual Cash Shop there's been a new table in the database called NxCode. If somebody wanted to buy an item from the cash shop, they would need a way to get nx first. So basically all you have to do is enter some random string in the NxCode table and give the string to the person who wants to get nx. Once they use that code, the string is automatically invalid. So each time you would have to enter a new string into the table by hand.

What these generators do is automatically generate a random string, insert it into the database, and then give the code to the user.

Less work for everyone.
 
Initiate Mage
Joined
Aug 22, 2008
Messages
3
Reaction score
0
I got the code,but I dont know where to type that code..
Can anyone send me the spot link where to type the code,please?
And why it has only 14 numbers?
thanks :)
 
Experienced Elementalist
Joined
Aug 31, 2008
Messages
214
Reaction score
0
Nice release...SWEET....keep up good work.....JUST NOTICED U got baned....
 
Newbie Spellweaver
Joined
Mar 13, 2007
Messages
45
Reaction score
0
I got the code,but I dont know where to type that code..
Can anyone send me the spot link where to type the code,please?
And why it has only 14 numbers?
thanks :)


im pretty sure you go into da cashshop den click code/coupon and enter it in. hopefully it ll be valid and WOOT NX! if not iuno about 14numbers...


wtf do u do with da code he posted...and da sql i just injected...but wtf u do with da thingy...
 
Initiate Mage
Joined
Jan 3, 2009
Messages
1
Reaction score
0
does this work for combat arms because it says invalid were do i post the script
 

GTR

Newbie Spellweaver
Joined
Jan 25, 2009
Messages
63
Reaction score
0
the cashshop DUH what kind of person makes a ps that doesnt knwo what to do with a simple code .
 
Status
Not open for further replies.
Back
Top