[Script] PHP Mssql Stats Laranja Perfeitos

01/10/2013 01:39 DjMarcioMarques#1
A Muito Tempo Procurava este Script e por fiz decidi escrever esse
The Very Time I tried this script and I decided to write this

Item a receber o Stats Laranja Perfeitos
Item Stats receiving the Perfect Orange
[Only registered and activated users can see links. Click Here To Register...]

Pagina Para Escolher o Stats Laranja Perfeitos
Stats Page To Choose the Perfect Orange
[Only registered and activated users can see links. Click Here To Register...]

Resultado Do Stats Laranja Perfeitos
Perfect Result Of Orange Stats
[Only registered and activated users can see links. Click Here To Register...]

Resultado Do Item
Results Of Item
[Only registered and activated users can see links. Click Here To Register...]

Em Armas Não Recebe HP SP MP
Not in Arms Receives HP SP MP
[Only registered and activated users can see links. Click Here To Register...]

Para que suas armas nao receba HP SP MP vc deve mudar a coluna "Server" em Item.SData Para "3"
For their weapons not receive HP SP MP you should change the column "Server" in Item.SData For "3"

Para as Roupas receberem Todos Stats Você deve Editar a Coluna "Server" para "4" de todas as roupas do Item.SData
Clothing For All Stats You should receive Edit Column "Server" to "4" all the clothes Item.SData
[Only registered and activated users can see links. Click Here To Register...]


Segue o Codigo Abaixo Das Edições:
Below follows the Code Of Editions:
PHP Code:
<?php
//Script modificado para adicionar Stats Laranja Perfeitos nos itens equipaveis os creditos
require_once('recaptchalib.config.php');
require_once(
'recaptchalib.php');
require_once(
'db.config.php');
$user_ip $_SERVER['REMOTE_ADDR'];
$username = isset($_POST['username']) ? mssql_escape_string(trim($_POST['username'])) : '';
$password = isset($_POST['password']) ? mssql_escape_string(trim($_POST['password'])) : '';
$password2 = isset($_POST['password2']) ? mssql_escape_string(trim($_POST['password2'])) : '';
$itemIDV38110// ID Do item que deseja usar Como Pagamento . (Crie um Item A Sua Escolha e adicione o ID dele Aqui).

require_once('db.php');
    
$resx     mssql_query("SELECT * FROM PS_UserData.dbo.Users_Master WHERE UserID = '$username'");
    
$detailx  mssql_fetch_array($resx);
$resx2 mssql_query("SELECT * FROM PS_GameData.dbo.UserStoredItems  WHERE UserUID= (SELECT [UserUID] FROM PS_UserData.dbo.Users_Master WHERE UserID='$username')  AND (Slot = '0')");
    
$detailx2  mssql_fetch_array($resx2);

$resx3 mssql_query("SELECT * FROM PS_GameDefs.dbo.Items  WHERE (ItemID = '$detailx2[ItemID]')");
    
$detailx3  mssql_fetch_array($resx3);
        
// Remove the @ symbol here to see what the SQL error message is when running the above query in $sql.
$level2 "$detailx3[ReqWis]";

switch( 
$level2 )// este switch é para adicionar modificar o bonus stats dos já existente nos itens.

case 
1:$bb '01';break;
case 
2:$bb '02';break;
case 
3:$bb '03';break;
case 
4:$bb '04';break;
case 
5:$bb '05';break;
case 
6:$bb '06';break;
case 
7:$bb '07';break;
case 
8:$bb '08';break;
case 
9:$bb '09';break;
case 
11:$bb '11';break;
case 
12:$bb '12';break;
case 
13:$bb '13';break;
case 
14:$bb '14';break;
case 
15:$bb '15';break;
case 
16:$bb '16';break;
case 
17:$bb '17';break;
case 
18:$bb '18';break;
case 
19:$bb '19';break;
case 
20:$bb '20';break;
case 
21:$bb '21';break;
case 
22:$bb '22';break;
case 
23:$bb '23';break;
case 
24:$bb '24';break;
case 
25:$bb '25';break;
case 
26:$bb '26';break;
case 
27:$bb '27';break;
case 
28:$bb '28';break;
case 
29:$bb '29';break;
case 
30:$bb '30';break;
case 
31:$bb '31';break;
case 
32:$bb '32';break;
case 
33:$bb '33';break;
case 
34:$bb '34';break;
case 
35:$bb '35';break;
case 
36:$bb '36';break;
case 
37:$bb '37';break;
case 
38:$bb '38';break;
case 
39:$bb '39';break;
case 
40:$bb '40';break;
case 
41:$bb '41';break;
case 
42:$bb '42';break;
case 
43:$bb '43';break;
case 
44:$bb '44';break;
case 
45:$bb '45';break;
case 
46:$bb '46';break;
case 
47:$bb '47';break;
case 
48:$bb '48';break;
case 
49:$bb '49';break;
case 
50:$bb '50';break;
}
        

$stat1 $_POST['stat1'];
$Str ='00';$Dex ='00';$Rec ='00';$Wis ='00';$Int ='00';$Luc ='00';$HP ='00';$MP ='00';$SP ='00';$En ='00';
switch( 
$stat1 )

case 
Str:$Str ''.$bb.'';break;
case 
Dex:$Dex ''.$bb.'';break;
case 
Rec:$Rec ''.$bb.'';break;
case 
Wis:$Wis ''.$bb.'';break;
case 
Int:$Int ''.$bb.'';break;
case 
Luc:$Luc ''.$bb.'';break;

$stat2 $_POST['stat2'];
switch( 
$stat2 )

case 
Str:$Str ''.$bb.'';break;
case 
Dex:$Dex ''.$bb.'';break;
case 
Rec:$Rec ''.$bb.'';break;
case 
Wis:$Wis ''.$bb.'';break;
case 
Int:$Int ''.$bb.'';break;
case 
Luc:$Luc ''.$bb.'';break;

$stat3 $_POST['stat3'];
switch( 
$stat3 )

case 
Str:$Str ''.$bb.'';break;
case 
Dex:$Dex ''.$bb.'';break;
case 
Rec:$Rec ''.$bb.'';break;
case 
Wis:$Wis ''.$bb.'';break;
case 
Int:$Int ''.$bb.'';break;
case 
Luc:$Luc ''.$bb.'';break;

$stat4 $_POST['stat4'];
switch( 
$stat4 )

case 
HP:$HP ''.$bb.'';break;
case 
MP:$MP ''.$bb.'';break;
case 
SP:$SP ''.$bb.'';break;

$errors = array();
$success false;
if(isset(
$_POST) && !empty($_POST)){
    require_once(
'db.php');
// Validar Nome de Usuario.
    
$useruid mssql_query("SELECT UserID,Pw FROM  PS_UserData.dbo.Users_Master WHERE UserID = '{$username}'");
    if(empty(
$username)){
        
$errors[] = 'Please provide a user name.';
    }else if(
strlen($username) < || strlen($username) > 16){
        
$errors[] = 'User name must be between 3 and 16 characters in length.';
    }else if(
ctype_alnum($username) === false){
        
$errors[] = 'User name must consist of numbers and letters only.';
    }else if (
mssql_num_rows($useruid) == 0){
        
$errors[] = 'usuario nao existe.';
    }
// Validar Senha do Usuario.
            
$useruid1 mssql_query("SELECT UserID,Pw FROM  PS_UserData.dbo.Users_Master WHERE UserID = '{$username}' and PW = '{$password}'");

    if(empty(
$password)){
        
$errors[] = 'Please provide a password.';
    }else if(
strlen($password) < || strlen($password) > 16){
        
$errors[] = 'Password must be between 3 and 16 characters in length.';
    }else if (
mssql_num_rows($useruid1) == 0){
        
$errors[] = 'Senha incorreta.';
    }
// Evitar Status repetidos.
if($stat1 == $stat2){$errors[] = 'Escolha um stat diferente.';    }
if(
$stat1 == $stat3){$errors[] = 'Escolha um stat diferente.';    }
if(
$stat2 == $stat3){$errors[] = 'Escolha um stat diferente.';    }
// Checar Se Usuario esta online.
$result  = @mssql_query("SELECT * FROM [PS_GameData].[dbo].[Chars] c INNER JOIN [PS_UserData].[dbo].[Users_Master] u ON  c.UserID='{$username}' WHERE c.LoginStatus=1"); 
if(@
mssql_num_rows($result)){
        
$errors[] = '<strong>Você deve fechar o jogo para continuar....</strong>';
    }
//Aviso se o item esta presente no slot '1' do Deposito.

$res02 =      mssql_query("SELECT ItemID FROM PS_GameData.dbo.UserStoredItems  WHERE UserUID= (SELECT [UserUID] FROM PS_UserData.dbo.Users_Master WHERE UserID='$username')  AND (Slot = '1') AND (ItemID = '{$itemIDV}')");
$resz2 =      mssql_query("SELECT * FROM PS_GameData.dbo.UserStoredItems  WHERE UserUID= (SELECT [UserUID] FROM PS_UserData.dbo.Users_Master WHERE UserID='$username')  AND (Slot = '1')");
$detailz2  =  mssql_fetch_array($resz2);
$resz3 =      mssql_query("SELECT * FROM PS_GameDefs.dbo.Items  WHERE (ItemID = '$detailz2[ItemID]')");
$detailz3  =  mssql_fetch_array($resz3);
$resz4 =      mssql_query("SELECT * FROM PS_GameDefs.dbo.Items  WHERE (ItemID = '{$itemIDV}')");
$detailz4  =  mssql_fetch_array($resz4);
$ItemName4"$detailz4[ItemName]";
$ItemName"$detailz3[ItemName]";
$count"$detailz2[Count]";
if(empty(
$itemIDV)){
        
$errors[] = 'Please provide a password.';
    }else if (
mssql_num_rows($res02) == 0){
        
$errors[] = 'O Item <u>'.$ItemName.'</u>  Não é Valido Para Continuar... <br /> Adicione o Item: <u>'.$ItemName4.'</u> No Segundo Slot do Deposito .';
    }

    
// Validate reCAPTCHA.  This is to prevent someone botting account creation.
    
$response recaptcha_check_answer($recaptcha_private_key,$_SERVER['REMOTE_ADDR'],$_POST['recaptcha_challenge_field'],$_POST['recaptcha_response_field']);
    if(!
$response->is_valid){
        if(
$response->error == 'incorrect-captcha-sol'){
            
$errors['recaptcha'] = 'Letras do reCAPTCHA Estao incorretos';
        }else{
            
$errors['recaptcha'] = $response->error;
        }
    }
//Leitura e Gravação na DB.
    
if(count($errors) == 0){

            
$res22 mssql_query("SELECT * FROM PS_GameData.dbo.UserStoredItems  WHERE UserUID= (SELECT [UserUID] FROM PS_UserData.dbo.Users_Master WHERE UserID='$username')  AND (Slot = '0')");
$detail22  mssql_fetch_array($res22);

            
$res33 mssql_query("SELECT * FROM PS_GameDefs.dbo.Items  WHERE (ItemID = '$detail22[ItemID]')");
$detail33  mssql_fetch_array($res33);
// Aqui Dará o numero do Server Do Item No Caso o Server 4  Receberá HP MP SP e o Server 3 Não Receberá HP MP SP ( Modifique seu Item.SData )
$zr=0;
switch( 
$zr )

case 
0:$ru "00";break;


$sv"$detail33[Server]"
switch( 
$sv )

case 
3:$ok "$Str$Dex$Rec$Wis$Int$Luc$ru$ru$ru$ru";break;
case 
4:$ok "$Str$Dex$Rec$Wis$Int$Luc$HP$MP$SP$ru";break;



            
$res mssql_query("SELECT * FROM PS_UserData.dbo.Users_Master WHERE UserID = '$username'");
$detail  mssql_fetch_array($res);
            
$del 'DELETE FROM PS_GameData.dbo.UserStoredItems WHERE
CharID in (SELECT CharID FROM PS_GameData.dbo.Chars WHERE UserUID=' 
$row1['UserUID'] . ')';
            
$res2 mssql_query("SELECT * FROM PS_GameData.dbo.UserStoredItems  WHERE UserUID= (SELECT [UserUID] FROM PS_UserData.dbo.Users_Master WHERE UserID='$username')  AND (Slot = '0')");
$detail2  mssql_fetch_array($res2);
$del3$count-1// Aqui Remove a Quantia De Item Do Slot'1'. No caso removerá 1 item do Monte.
            
$res3 mssql_query("SELECT * FROM PS_GameDefs.dbo.Items  WHERE (ItemID = '$detail2[ItemID]')");
$detail3  mssql_fetch_array($res3);
            
$del "DELETE  FROM PS_GameData.dbo.UserStoredItems  WHERE ItemID = '$itemIDV' AND Count='1' AND UserUID=(SELECT [UserUID] FROM PS_UserData.dbo.Users_Master WHERE UserID='$username')  AND (Slot = '1') ";
            
$sql2 "UPDATE PS_GameData.dbo.UserStoredItems SET Count ='$del3' WHERE UserUID= (SELECT [UserUID] FROM PS_UserData.dbo.Users_Master WHERE UserID='$username') AND (Slot = '1')";
            
$sql "UPDATE PS_GameData.dbo.UserStoredItems SET Craftname = '$ok' WHERE UserUID= (SELECT [UserUID] FROM PS_UserData.dbo.Users_Master WHERE UserID='$username') AND (Slot = '0')";

        
// Remove the @ symbol here to see what the SQL error message is when running the above query in $sql.
if($result3 = @mssql_query($del)){$success "Excluido";
        }else{    
$errors[] = 'Falha ao limpar!';    }        
            if(
$result2 = @mssql_query($sql2)){    $success "Limpo";
        }else{    
$errors[] = 'Falha ao limpar!';    }
        if(
$result = @mssql_query($sql)){ $success "O Item<strong> '{$detail3[ItemName]}' </strong>Foi Modificado com sucesso Nos Seguintes Stats:<br />Str:$Str<br />Dex:$Dex<br />Rec:$Rec<br />Wis:$Wis<br />Int:$Int<br />Luc:$Luc<br />HP:$HP<br />MP:$MP<br />SP:$SP<br />";
        }else{
            
// This means the insert statement is probably not valid for your database.  Fix the query or fix your database, your choice ;)
            
$errors[] = 'Falha ao criar sua conta, tente novamente!';
        }
        
    }
}
// Determine which view to show.
if($success === false){
    require_once(
'SLP.view.php');
}else{
    require_once(
'success.view.php');
}

?>
Desculpe-me Por Não Falar Ingles ^^
Sorry For Not Speaking English^^

Se Desejar ver uma demonstração veja em meu site:
If You want to see a demonstration on my site:
[Only registered and activated users can see links. Click Here To Register...]
01/10/2013 21:25 DjMarcioMarques#2
Atenção ! O Script esta Removendo o Enchant Das Armas e Armaduras !
Attention! The Script Removing this Enchant Weapons and Armor!

Para nao remover o Enchant dos itens siga as instruções abaixo:
To Enchant not remove the items follow the instructions below:
Line Original :
PHP Code:
$sv"$detail33[Server]"
switch( 
$sv )

case 
3:$ok "$Str$Dex$Rec$Wis$Int$Luc$ru$ru$ru$ru";break;
case 
4:$ok "$Str$Dex$Rec$Wis$Int$Luc$HP$MP$SP$ru";break;

Modify the line:

PHP Code:
$enchant=     substr("$detail22[Craftname]", -2) ;
$sv"$detail33[Server]"
switch( 
$sv )

case 
3:$ok "$Str$Dex$Rec$Wis$Int$Luc$ru$ru$ru$enchant";break;
case 
4:$ok "$Str$Dex$Rec$Wis$Int$Luc$HP$MP$SP$enchant";break;

01/11/2013 13:58 Old-School#3
Can anywone translate it in english?
01/11/2013 14:10 WildTaurus#4
every second line is english?^^
01/21/2013 21:05 [GM]SkyLine.™#5
Nice Work :) Thanks :))
01/23/2013 03:29 _Diavolino_#6
Hello, i just run the php and i would like to know if u cross the problem

Failed to select database PS_UserData.

i check password, and rest but i dont see from where can come the problem ...

Regards, and Thx u
01/23/2013 13:00 DjMarcioMarques#7
Edit : db.config.php add the User and Password of your mssql
PHP Code:
<?php
// Verify the php_mssql libary is installed and enabled.
if(!function_exists('mssql_connect')){
    echo 
'You must have the php_mssql library for Apache installed and enabled to connect to an MSSQL database.  Uncomment the line that says extension=php_mssql.dll in your php.ini (XAMPP/WAMP only).  This requires a restart of the Apache service to take effect.'; die();
}
// Database configuration parameters
$db_host '127.0.0.1';
$db_user 'shaiya';
$db_pass 'shaiya123';

/**
 * Sanitize user input to prevent SQL injection.  Use this on ALL user input!
 * This function is from CodeIgniter.
 * I researched other methods of doing this, and this looked the most solid to me - Abrasive
 * @param string $data
 * @return string
 */
function mssql_escape_string($data) {
    if(!isset(
$data) or empty($data)) return '';
    if(
is_numeric($data)) return $data;
    
$non_displayables = array(
        
'/%0[0-8bcef]/',            // url encoded 00-08, 11, 12, 14, 15
        
'/%1[0-9a-f]/',                // url encoded 16-31
        
'/[\x00-\x08]/',            // 00-08
        
'/\x0b/',                    // 11
        
'/\x0c/',                    // 12
        
'/[\x0e-\x1f]/'                // 14-31
    
);
    foreach(
$non_displayables as $regex)
        
$data preg_replace($regex,'',$data);
        
$data str_replace("'","''",$data);
    return 
$data;
}
?>
01/23/2013 15:25 _Diavolino_#8
Hello thx for ur answer i did this :) is not i willl get the first error Impossible to connect to ms sql... i put the pass and right id ...

EDIT : Resolved ! by replacing the db.config from abrasive old registration :D
Thx U
01/24/2013 05:11 _Diavolino_#9
/deleted cuz was mistake of me :D

Regards, and good work for this php hehe

next step u can try to build it in ODBC as the registration pvp ranking etc
as me i get not yet knowledge to write in ODBC hehe

again Thx
01/24/2013 08:20 X-51#10
Quote:
Originally Posted by _Diavolino_ View Post
/deleted cuz was mistake of me :D

Regards, and good work for this php hehe

next step u can try to build it in ODBC as the registration pvp ranking etc
as me i get not yet knowledge to write in ODBC hehe

again Thx
Yes please, thank you this is what most need because we do not use wampp we use xammp this is gonna help a ton in advance thanks.
[ODBC script needed!]
01/26/2013 20:04 DjMarcioMarques#11
tente colocar o '@' a frente de mssql_query("SELECT.... Assim : @mssql_query("SELECT ...
eu uso Xammp mas nao em odbc

try putting the '@' in front of mssql_query ("SELECT .... Thus: @mssql_query (" SELECT ...
I use XAMMP but not in odbc
02/06/2013 19:16 [GM]SkyLine.™#12
Notice: Use of undefined constant Str - assumed 'Str' in C:\wamp\www\SLP\SLP.php on line 81

Notice: Undefined variable: bb in C:\wamp\www\SLP\SLP.php on line 81

Notice: Use of undefined constant Str - assumed 'Str' in C:\wamp\www\SLP\SLP.php on line 91

Notice: Undefined variable: bb in C:\wamp\www\SLP\SLP.php on line 91

Notice: Use of undefined constant Str - assumed 'Str' in C:\wamp\www\SLP\SLP.php on line 101

Notice: Undefined variable: bb in C:\wamp\www\SLP\SLP.php on line 101

Notice: Use of undefined constant HP - assumed 'HP' in C:\wamp\www\SLP\SLP.php on line 111

Notice: Undefined variable: bb in C:\wamp\www\SLP\SLP.php on line 111

Any 1 idea ?
06/09/2013 06:14 bruno9280#13
Caro amigo como fasso pra deixar a recriação com 20 de status?
06/10/2013 23:57 nofear43#14
Quote:
Originally Posted by [GM]SkyLine.™ View Post
Notice: Use of undefined constant Str - assumed 'Str' in C:\wamp\www\SLP\SLP.php on line 81

Notice: Undefined variable: bb in C:\wamp\www\SLP\SLP.php on line 81

Notice: Use of undefined constant Str - assumed 'Str' in C:\wamp\www\SLP\SLP.php on line 91

Notice: Undefined variable: bb in C:\wamp\www\SLP\SLP.php on line 91

Notice: Use of undefined constant Str - assumed 'Str' in C:\wamp\www\SLP\SLP.php on line 101

Notice: Undefined variable: bb in C:\wamp\www\SLP\SLP.php on line 101

Notice: Use of undefined constant HP - assumed 'HP' in C:\wamp\www\SLP\SLP.php on line 111

Notice: Undefined variable: bb in C:\wamp\www\SLP\SLP.php on line 111

Any 1 idea ?
Ömer önce case değerlerini giriceksin :)
İstiklal den ben serdar.
03/28/2014 16:04 minhxh#15
[Only registered and activated users can see links. Click Here To Register...]




Hi! thanks for ur answer i did this is not i willl get the first error Impossible to connect to ms sql i put the pass and right id

please help!!

Thanks so much