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] PHP NX Cash seller for Cash Shop

Experienced Elementalist
Joined
Apr 13, 2008
Messages
298
Reaction score
1
Well I released this on OdinMS forums, forgot about releasing it here =o

So here it is!

<?php
// process the script only if the form has been submitted
if (array_key_exists('reset', $_POST)) {
// start the session
include('config.php');
$username = trim($_POST['username']);
$password = trim($_POST['password']);
$username = mysql_real_escape_string($username);
$char = trim($_POST['char']);
$mesocheck = mysql_query('SELECT * FROM meso FROM characters');
$result = mysql_query("SELECT meso, accountid FROM characters WHERE name = '$char' LIMIT 1");
list($meso, $accountid) = mysql_fetch_row($result);

$result = mysql_query("SELECT id, password, salt FROM accounts WHERE name = '$username' LIMIT 1");
list($id, $realpass, $salt) = mysql_fetch_row($result);

$sql = "SELECT * FROM accounts WHERE name = '$username'";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);

if($realpass == hash('sha512',$password.$salt) && $accountid == $id && $meso >= 100000000 && $loggedin < 1) {
mysql_query("UPDATE accounts SET nxcash = nxcash + 30000 WHERE name = '$username' LIMIT 1");
mysql_query("UPDATE characters SET meso = meso - 100000000 WHERE name = '$char' LIMIT 1");
echo "You have payed 100 mil from $char to get 30k NX for $username !";
} else
echo "There was an error getting you NX. Either 1. You do not have enough money. 2. You do not have the char you listed on that account. 3. You are logged in."; }
// if no match, destroy the session and prepare error message
else {
$message[] = 'Invalid username or password. Please try again.';
}
?>
<!-- start content -->
<div class='welcome'><br>Welcome to the NX Cash shop! 100,000,000 mesos for 30,000 NX! Credits to Spyker710 of RageZone, Spyker of OdinMS.de and xDimMak of OdinMS.de for helping fix the bugs!</div>
<div align="center">
<div class="display">
<?php
if (isset($message)) {
echo '<ul>';
foreach ($message as $item) {
echo "<li>$item</li>";
}
echo '</ul>';
}
?>
</div>
<form id="form1" name="form1" method="post" action="">
<table cellspacing="0" cellpadding="5" width="100%">
<tr>
<td width="50%" align="right" class="list">Username :</td>
<td class="list"><input id="username" type="text" name="username" maxlength="12"></td>
</tr>
<tr>
<td width="50%" align="right" class="list">Password :</td>
<td class="list"><input id="password" type="password" name="password" maxlength="20" /></td>
</tr>
<tr>
<td width="50%" align="right" class="list">Character paying 100 mil :</td>
<td class="list"><input id="char" type="text" name="char" maxlength="12"></td>
</tr>
<tr>
<td align="right" colspan="2"><input id="reset" name="reset" type="submit" value="Buy 30k NX!" /></td>
</tr>
</table>
</form>
</div>
<!-- end content -->

Right now the price is 100 mil for 30k NX. If you wanna change the price or the NX just find these lines

mysql_query("UPDATE accounts SET nxcash = nxcash + 30000 WHERE name = '$username' LIMIT 1");
mysql_query("UPDATE characters SET meso = meso - 100000000 WHERE name = '$char' LIMIT 1");

Change the 100000000 in the meso to whatever price you want.
Change the 30000 in nxcash to whatever NX you want to sell.

Credits to me for making it, (I'm also Spyker from OdinMS.de, so I didn't copy it from him/me)
Huge thanks to xDimMak of OdinMS.de for helping me fix the bugs.

(Well, the old OdinMS.de =| )

This is a PHP script, so put it in your www folder or wherever you put your PHP stuff.


This is for OdinMS source.

If you use this, please leave in the credits!

<?php
//-----------Database Details------------------------------------

$host['naam'] = 'localhost'; // my host
$host['gebruikersnaam'] = 'root'; // my database username
$host['wachtwoord'] = ''; // my database password
$host['databasenaam'] = 'odinms'; // my database name

//-----------Status Details--------------------------------------

$serverip = "localhost"; //Replace with your WAN IP if public
$loginport = "7575"; //Don't change
$worldport = "8484"; //Dont' Change
$sql_db = "odinms"; //DB Name
$sql_host = "localhost"; //DB Host
$sql_user = "root"; //DB User
$sql_pass = ""; //DB Password
$logserv_name = "<b>Login Server</b>: "; //Login Status Server Name
$worldserv_name = "<b>World Server</b>: "; // World Status Name
$offline = "<font color =red>Offline</font>"; //Displays Offline Status
$online = "<font color = green>Online</font>"; //Displays Online Status

//-----------Dont Touch This-------------------------------------

$db = mysql_connect($host['naam'], $host['gebruikersnaam'], $host['wachtwoord']) OR die ('Cant connect to the database');
mysql_select_db($host['databasenaam'], $db);
?>

That's the config.php I use lol.

If you get the wrong password error, you may need to change this line

if($realpass == hash('sha512',$password.$salt)

To this

if($realpass == hash('sha1',$password.$salt)

Basicly, just change the sha512 to sha1. Although sha512 works for me, it might not for you.

Thanks to Shaun166 for figuring that out.
 
Last edited:
Experienced Elementalist
Joined
Apr 13, 2008
Messages
298
Reaction score
1
Wow this wasn't as popular as it was in OdinMS o.o
 
Junior Spellweaver
Joined
Apr 6, 2007
Messages
146
Reaction score
0
haha sadly no one uses odin source here, or maybe they just dont understand by your title

give me a more description to noob out there

and btw, awesome release, im using it on my server =]
 
Experienced Elementalist
Joined
Apr 13, 2008
Messages
298
Reaction score
1
Oh yea =o

Apparantly my config.php didn't "work" for some people so somone made one, but it got wiped out along with the odinms forum. I'll post mine anyways though.
 
Junior Spellweaver
Joined
Dec 9, 2007
Messages
162
Reaction score
0
Seems to work just fine, except it says "Invalid username or password. Please try again" even when you don't put anything in.
 
Newbie Spellweaver
Joined
Nov 15, 2006
Messages
40
Reaction score
0
Could any php pro tell me, after you click the submit button to link auto to an other website. Because now when someone clicked submit it just refreshes.

Thank you for your help.
 
Newbie Spellweaver
Joined
Jun 8, 2008
Messages
6
Reaction score
0
When I press "Buy 30k NX" I got this errors.
I realy need help!

Errors:

Warning: include(config.php) [function.include]: failed to open stream: No such file or directory in C:\Program Files\Abyss Web Server\htdocs\cashshop.php on line 5

Warning: include() [function.include]: Failed opening 'config.php' for inclusion (include_path='.;C:\php5\pear') in C:\Program Files\Abyss Web Server\htdocs\cashshop.php on line 5

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\Program Files\Abyss Web Server\htdocs\cashshop.php on line 8

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:\Program Files\Abyss Web Server\htdocs\cashshop.php on line 8

Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\Program Files\Abyss Web Server\htdocs\cashshop.php on line 10

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\Program Files\Abyss Web Server\htdocs\cashshop.php on line 10

Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\Program Files\Abyss Web Server\htdocs\cashshop.php on line 11

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\Program Files\Abyss Web Server\htdocs\cashshop.php on line 11

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in C:\Program Files\Abyss Web Server\htdocs\cashshop.php on line 12

Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\Program Files\Abyss Web Server\htdocs\cashshop.php on line 14

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\Program Files\Abyss Web Server\htdocs\cashshop.php on line 14

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in C:\Program Files\Abyss Web Server\htdocs\cashshop.php on line 15

Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\Program Files\Abyss Web Server\htdocs\cashshop.php on line 18

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\Program Files\Abyss Web Server\htdocs\cashshop.php on line 18

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\Program Files\Abyss Web Server\htdocs\cashshop.php on line 19
There was an error getting you NX. Either 1. You do not have enough money. 2. You do not have the char you listed on that account. 3. You are logged in.
 
Experienced Elementalist
Joined
Apr 13, 2008
Messages
298
Reaction score
1
Your config.php is not the right info for your MySQL DB user and pass.
 
Newbie Spellweaver
Joined
Jun 1, 2008
Messages
83
Reaction score
0
if($realpass == hash('sha512',$password.$salt) && $accountid == $id && $meso >= 100000000 && $loggedin < 1) {

the sha512 should be sha1 or u will be getting error =D pls update it
 
Experienced Elementalist
Joined
Apr 13, 2008
Messages
298
Reaction score
1
sha512 works fine for me o.o

I'll post it up there that you might need sha1 though.
 
Newbie Spellweaver
Joined
Nov 15, 2006
Messages
40
Reaction score
0
Could any php pro tell me, after you click the submit button to link auto to an other website. Because now when someone clicked submit it just refreshes.

Thank you for your help.
 
Elite Diviner
Joined
Feb 28, 2007
Messages
446
Reaction score
4
haha sadly no one uses odin source here, or maybe they just dont understand by your title

give me a more description to noob out there

and btw, awesome release, im using it on my server =]

No one use's odinMs source? Are you stupid.
 
Junior Spellweaver
Joined
Jan 21, 2008
Messages
168
Reaction score
1
Hmm....this thread is a tad old..
But yea..a lot of people use odinms source
 
Back
Top