Jump to content

[Share]Name Color Change PHP Script


Recommended Posts

Hello Ladies.I want to share php script maded by me.it's for users. thay can change charaters name color with donate item.

 

Preview:

 

81425473.png

 

So Let's Start

 

First create Config.php and write there

 

<?php
$L2JBS_config["mysql_host"]="localhost";
$L2JBS_config["mysql_port"]="3306";
$L2JBS_config["mysql_db"]="l2jdb";
$L2JBS_config["mysql_login"]="root";
$L2JBS_config["mysql_password"]="master";
$price="250";
$item_id="6673";
$pricename="Festival Adena";

?>

 

Save and Close.

 

Now Create ColorChange.php and write there

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Character Name Color Change By Leki</title>
<style type="text/css">
<!--
body,td,th {
color: #FFFFFF;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
}
body {
background-color: #000000;
}
-->
</style>
</head>
<body>
<center>
<?php
require("Config.php");
?>
<?php
$submit = isset($HTTP_POST_VARS['submit'])?$HTTP_POST_VARS['submit']:false;
if ($submit)
{
$link = mysql_connect($L2JBS_config['mysql_host'].":".$L2JBS_config['mysql_port'], $L2JBS_config['mysql_login'], $L2JBS_config['mysql_password']);
  if (!$link)
    die("Couldn't connect to MySQL");
  @mysql_select_db($L2JBS_config['mysql_db'], $link)
    or die ('Error '.mysql_errno().': '.mysql_error());
$nick = $HTTP_POST_VARS['nick'];
$color = $HTTP_POST_VARS['color'];
$acc_name = $HTTP_POST_VARS['acc_name'];
$pass = $HTTP_POST_VARS['pass'];
$sql = "SELECT * FROM `accounts` WHERE `login` = '$acc_name'";
$res = mysql_query($sql);
$account = mysql_fetch_array($res);
if ($account['password'] != base64_encode(pack('H*',sha1(utf8_encode($pass))))) {die('Invalid password<br><br><a href="ColorChange.php">Back</a>');}


$res = mysql_query("SELECT `char_name` FROM `characters` WHERE `char_name` = '$nick'");
if (!@mysql_num_rows($res)) {die('You do not have such character<br><br><a href="ColorChange.php">Back</a>');}


$sql = "SELECT `account_name`,`obj_Id`,`online` FROM `characters` WHERE `char_name` = '$nick'";
$res = mysql_query($sql);
$nick = mysql_fetch_array($res);
if ($account['login'] != $nick['account_name']) {die('This character does not belong to you.<br><br><a href="ColorChange.php">Back</a>');}



$sql = "SELECT `owner_id`,`object_id`,`item_id`,`count` FROM `items` WHERE `item_id` = '$item_id' AND `owner_id` = ${nick['obj_Id']}";
$res = mysql_query($sql);
$money = mysql_fetch_array($res);
if ($money['count'] < $price) {die('Not enough money to change color <br><br><a href="ColorChange.php">Back</a>');}


if ($nick['online']) {die('Character must be offline mode!<br><br><a href="ColorChange.php">Back</a>');}
$tmp = $money['count'] - $price;
mysql_query("UPDATE `items` SET `count` = $tmp WHERE `item_id` = '$item_id' AND `owner_id` = ${nick['obj_Id']}");
mysql_query("UPDATE `characters` SET `name_color` = '$color' WHERE `obj_Id` = ${nick['obj_Id']}");
?>Name color changed<br><br><br><a href="ColorChange.php">Back</a> <?php
}
else
{
?>
<script language=javascript>
function isAlphaNumeric(value)
{
  if (value.match(/^[a-zA-Z0-9]+$/))
    return true;
  else
    return false;
}
function checkform(frm)
{
  if (frm.acc_name.value=="")
  {
    alert("Enter Account");
    return false;
  }
  if (!isAlphaNumeric(frm.acc_name.value))
  {
    alert("Invalid Account!");
    return false;
  }
  if (frm.nick.value=="")
  {
    alert("Enter Character Name");
    return false;
  }
  if (!isAlphaNumeric(frm.nick.value))
  {
    alert("Invalid Character Name");
    return false;
  }
  if (frm.pass.value=="")
  {
    alert("Enter Password");
    return false;
  }
  if (!isAlphaNumeric(frm.pass.value))
  {
    alert("Invalid Password");
    return false;
  }
  return true;
}
</script><br><br>

Here you can change your character's name color.<br><br> Price: <? echo $price; ?> <? echo $pricename; ?>.<br><br> 


<form action=ColorChange.php method=post onsubmit="return checkform(this)">
<table cellpadding=2 cellspacing=2>
<tr><td>Account:<td><input name=acc_name>
<tr><td>Password:<td><input name=pass type=password>
<tr><td>Character:<td><input name=nick>
<tr><td>Color:<td>  

Yellow<INPUT type=radio value="FFFF00" name=color maxlength="15">
Green  <INPUT type=radio value="00FF00" name=color maxlength="15">
Orange<INPUT type=radio value="FF8040" name=color maxlength="15">

<tr><td colspan=2><input type=submit name=submit value="Change Color">
</table></form>
<?php
}
?>
</center>
</body>
</html>

 

Credits to Me!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...