Register for your free account! | Forgot your password?

You last visited: Today at 22:53

  • Please register to post and access all features, it's quick, easy and FREE!

 

[REQUEST]PHP Script

Reply
 
Old   #1
 
elite*gold: 0
Join Date: May 2010
Posts: 133
Received Thanks: 27
[REQUEST]PHP Script

Hello. Can someone, who's having a good knowledge about PHP, make a PHP script that's resets, to a desired character, the amount of money? Like 2 boxes one for Character Name and one for Password and then a button for "Reset" that reads the character money and reset him to 0 if his money are over 999k? If I didn't explained well I'll explain my request again and if it's to hard I request to close this topic.



WarpGeorge is offline  
Old   #2
 
elite*gold: 20
Join Date: Apr 2008
Posts: 2,281
Received Thanks: 908
This should be just about what you need, it's nothing great just made it real quick.
You'll have to edit it a bit to fit your database (table names etc) but should work.

Code:
<?php
	$mysql_hostname =  "localhost";
	$mysql_user = 	   "USERNAME";
	$mysql_password =  "PASSWORD";
	$mysql_database =  "DATABASE";
?>

<?php
	if (isset($_POST['uid']) && isset($_POST['gold'])) {
		$user = $_POST['uid'];
		$gold = $_POST['gold'];
		
		$mysql_con = mysql_connect($mysql_hostname, $mysql_user, $mysql_password)
		or die("Unable to connect to database.");
		mysql_select_db($mysql_database, $mysql_con) or die("Unable to select database.");
		
		$sql = "UPDATE characters SET Gold = 0 WHERE UID = '$uid'";
		
		if (!mysql_query($sql))
			die('Error: ' . mysql_error());
		echo "Updated!";
	}
	else if (isset($_POST['user']) && isset($_POST['pass'])) {
		$user = $_POST['user'];
		$pass = $_POST['pass'];
		
		$mysql_con = mysql_connect($mysql_hostname, $mysql_user, $mysql_password)
		or die("Unable to connect to database.");
		mysql_select_db($mysql_database, $mysql_con) or die("Unable to select database.");
		
		$sql = "SELECT UID FROM accounts WHERE Account = '$user' AND Password_Plain = '$pass'";
		
		$uid = mysql_result(mysql_query($sql), 0) or die("Invalid Username or password.");
		
		$sql2 = "SELECT Gold FROM characters WHERE UID = $uid";
		
		$result = mysql_query($sql2) or die("Invalid UID.");
		
		
		if ($row = mysql_fetch_array($result)) {
			$gold = $row['Gold'];
			echo "Money: $gold<br />";
			if ($gold >= 999999) {
				echo "<form method='post'>";
				echo "<input type='hidden' value=$uid name='uid' />";
				echo "<input type='hidden' value=$gold name='gold' />";
				echo "<input type='submit' value='Reset to 0' />";
				echo "</form>";
			}
		}
	}
?>

<form method="post">
<table>
	<tr>
		<td>Username:</td>
		<td><input type='text' name='user' /></td>
	</tr>
	<tr>
		<td>Password:</td>
		<td><input type='password' name='pass' /></td>
	</tr>
	<tr>
		<td></td>
		<td><input type='submit' value="Find" /></td>
	</tr>
</table>
<form>


kinshi88 is offline  
Old   #3
 
elite*gold: 0
Join Date: Apr 2007
Posts: 208
Received Thanks: 43
Kinshi, you cant really make it unless you know what source.
it could be flat file.
DePredaTe is offline  
Old   #4
 
elite*gold: 40
Join Date: Sep 2006
Posts: 1,892
Received Thanks: 804
Quote:
Originally Posted by DePredaTe View Post
Kinshi, you cant really make it unless you know what source.
it could be flat file.
You shouldn't criticise Kinshi..he did what the person asked for with the information he best could get.


gerble93 is offline  
Thanks
1 User
Old   #5
 
elite*gold: 0
Join Date: Apr 2007
Posts: 208
Received Thanks: 43
i wasn't criticizing kinshi at all.
if i was going to criticize anyone it should be the poster. Kinshi was just trying to help.
I don't understand how people expect people to write PHP script for their server if you don't even post the information needed. He posted what he wanted, not what he needed.
DePredaTe is offline  
Old   #6
 
elite*gold: 0
Join Date: Nov 2009
Posts: 744
Received Thanks: 539
Quote:
Originally Posted by kinshi88 View Post
This should be just about what you need, it's nothing great just made it real quick.
You'll have to edit it a bit to fit your database (table names etc) but should work.
MysqlConfig.cs
Code:
<?php

$mysql_hostname =  "localhost";
$mysql_user = 	   "USERNAME";
$mysql_password =  "PASSWORD";
$mysql_database =  "DATABASE";

?>
MysqlBase.cs
Code:
<?php

public class MysqlBase
{
   var $_Connection = null;
   var $_Reader = null;
   var $_Command = null;
   var $_Query = null;
   var $_Result = null;

   public function MysqlBase()
   {
     $this->_Connection = mysql_connect($mysql_hostname, $mysql_user, $mysql_password)
		or die("Unable to connect to database.");
   }
    
   public function Select($Table, $Section, $FromSection, $FromValue)
   {
     mysql_select_db($mysql_database, $this->_Connection) or die("Unable to select database.");
     $this->_Command = "SELECT $Section FROM $TABLE WHERE $FromSection = '$FromValue'";
     $this->_Reader = mysql_result(mysql_query($this->_Command), (0) or die("Data not found.");
     $this->_Query = mysql_query($this->_Command) or die("Data not found.");
   }
   
   public function Read($Section)
   {
     var $_Value = null;

     if($this->_Result = mysql_fetch_array($this->_Query)
     {
       $_Value = $this->_Result['$Section']; 
     }
     return $_Value;
   }
}

?>
I don't see the point of recreating the connection everytime
ImmuneOne is offline  
Old   #7
 
elite*gold: 0
Join Date: May 2010
Posts: 133
Received Thanks: 27
Request was for a 5095 database (binaries). I'll try to edit where needed to get this script working. Thanks anyway kinshi even this will not work. I'm trying out now
WarpGeorge is offline  
Old   #8
 
elite*gold: 0
Join Date: May 2010
Posts: 133
Received Thanks: 27
Neah doesn't work ! I wanted this PHP script to prevent people making money glitch ( getting over 2,5 billions gold) but I had an idea and re-scripted the Exchanger (NPC which's exchanging your CPs for gold and made a line which's it's reading the value of your character money and if you have more or equal to 999kk give you a fail msg and stop exchanging you money). I request to close this topic but don't delete it because maybe some people will need that kinshi work or Immuneone. ty and sorry for disturbing you people with that script. i`ll never ask again for something that can be done with another methods that i have knowledge about them sorry again


WarpGeorge is offline  
Reply



« Previous Thread | Next Thread »

Similar Threads
[Request]pvp script
hi can some1 know script with who i can reset all char pvp point
1 Replies - Dekaron Private Server
script request
Hello, I'm playing on a server with stack sub and im using pr/bd. I was wondering how to set l2w to equip duals, dance and equip bow back after...
1 Replies - Lin2 Exploits, Hacks, Bots, Tools & Macros
[Request] Script help 2
Ok guys, I got a new idea for a script :p but Im not sure if this 1 is possible either. Since im on a private servers where u have full buffs...
0 Replies - Lineage 2
[REQUEST] Can i Request A Acc/Char PHP Script
hello i was wondering if anyone have made a acc/char creation page in one yet? is so can anyone release itplease?
6 Replies - CO2 PServer - Discussions / Questions
[Request] PHP Script
@Request #Close #Delete
8 Replies - CO2 PServer - Discussions / Questions



All times are GMT +2. The time now is 22:53.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2018 elitepvpers All Rights Reserved.