Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Rappelz > Rappelz Private Server
You last visited: Today at 15:34

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

 

[help] how to echo online players

Reply
 
Old   #16
 
elite*gold: 0
Join Date: Sep 2013
Posts: 41
Received Thanks: 0
error
php

where is my problème ?



FlyffResu is offline  
Old   #17
 
elite*gold: 0
Join Date: Apr 2012
Posts: 99
Received Thanks: 34
you use $conn at mssql connection but you check result of $connect
use this :

you can't use mssql_connect or mssql_query
you need to use sqlsrv_connect and sqlsrv_query

read the Library sql_server driver for php i linked in precedent post , all functions are gived

with my php example you can make your php function easy


nimoht is offline  
Old   #18
 
elite*gold: 0
Join Date: Sep 2013
Posts: 41
Received Thanks: 0
the problem comes from Wamp then? I'll download IIS to track you're better explanation !
Again thank you for your help !
FlyffResu is offline  
Old   #19
 
elite*gold: 0
Join Date: Apr 2012
Posts: 99
Received Thanks: 34
If you use Windows 7 , IIS is already installed.
Just need to activate it , there is an tuto on EPVP working very well.

After ,
instal php for IIS
instal sql_server_driver for php
add the 4 rows in the php.ini to activate it
create a new website and configure it

i worked a little on the php function for players lv classement :

this function get the values in the order but not pretty to view
this need an table and show the values in the table.

You need to work a little , no ?


nimoht is offline  
Old   #20
 
elite*gold: 0
Join Date: Sep 2013
Posts: 41
Received Thanks: 0
( ! ) Fatal error: Call to undefined function FormatErrors() in C:\wamp\www\index.php on line 8

witch your code :s

---------------------------------------------------------------------------
So that your code works, I modified like this:

Quote:
<?php
$hostname = '*****-*****';
$connection_options = array('Database'=>'telecaster', 'UID'=>'sa', 'PWD'=>'******');
$conn = sqlsrv_connect($hostname, $connection_options);
if(!is_resource($conn)){ echo 'Could not connect: '; var_dump(sqlsrv_errors(SQLSRV_ERR_ALL)); exit(0); }
echo 'Connection established successfully. le serveur est actuellement en maintenance.';

$sql = "select top 10 name, lv from character order by lv desc";
$query = sqlsrv_query($conn, $sql);
if ($query === false)
die( FormatErrors( sqlsrv_errors() ));
while ($row = sqlsrv_fetch_array($query))
{
echo "<p>$row[name] $row[lv]</p>";
}
sqlsrv_free_stmt($query);

//Credit to nimoht & Icoderz\FlyffResu ranking


sqlsrv_close($conn);
?>
I thank you again for the job

I took the script to registration above, however how can it indicates a message if registration has run? I tested several ways but I do not understand too well ...
Here is my php code:

Quote:

<?php
@$pseudo = $_POST['pseudo'];
@$pass = $_POST['pass'];
$key = "univers";
$hdpass = md5("$key$pass");




$hostname = '*******';
$connection_options = array('Database'=>'auth', 'UID'=>'sa', 'PWD'=>'******');
$conn = sqlsrv_connect($hostname, $connection_options);

if( $conn === false )
{
echo "Impossible de se connecter au serveur .\n";
die( print_r( sqlsrv_errors(), true));
}
$tsql = "INSERT INTO [Accounts]
([login_name]
,[password]
,[referral_id]
,[referral_code]
,[pcbang]
,[block]
,[withdraw_remain_time]
,[age]
,[auth_ok]
,[last_login_server_idx]
,[event_code]
,[server_list_mask]
,[result]
,[ip]
,[game_code]
,[gamecode]
,[login_event]
,[email])
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);";
$params = array($pseudo,$hdpass,0,0,0,0,0,18,1,1,0,0,0,0,0,0 ,0,0);
$stmt = sqlsrv_query( $conn, $tsql, $params);
if( $stmt === false )
{
die( print_r( sqlsrv_errors(), true));
}
else if( $stmt === true )
{
$reponse="<p>valide</p>";
echo $reponse;
}
sqlsrv_free_stmt( $stmt);
sqlsrv_close( $conn);
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
Pseudo : <input type="text" size="20" name="pseudo" /><br />
Mot de passe : <input type="password" size="20" name="pass" /><br /><br/>
<strong> Notre système d'inscription est temporaire et ne présente aucun message de validation.<br/>
Cependant, votre compte est quand même inscrit sur notre service !<br/>
Un prochain script d'inscription verra le jour dans la semaine !<br/>
Si toute fois vous n'arrivez pas a vous connectez, modifié le nom de compte.</strong><br/>
<input type="submit" value="Inscrivez-vous !" name="senden" />
</form>
FlyffResu is offline  
Old   #21
 
elite*gold: 0
Join Date: Apr 2012
Posts: 99
Received Thanks: 34
If the insert command don't abort :
if this sql command return >= 1 the account exist , else it didn't exist.

I think you check the login_name before create the new account , else you can have most of 1 account with the same login_name...
nimoht is offline  
Old   #22
 
elite*gold: 0
Join Date: Sep 2013
Posts: 41
Received Thanks: 0
I do not understand.

I have trouble configuring my customer area (login system) and registration ...

The instructions do not work anymore since I'm under sql_srv: s
FlyffResu is offline  
Old   #23
 
elite*gold: 0
Join Date: Apr 2012
Posts: 99
Received Thanks: 34
post your script please
nimoht is offline  
Old   #24
 
elite*gold: 0
Join Date: Sep 2013
Posts: 41
Received Thanks: 0
In my index for login and password (php) :
In index for my login and password (html) :
FlyffResu is offline  
Old   #25
 
elite*gold: 0
Join Date: Apr 2012
Posts: 99
Received Thanks: 34
Sorry but i think you don't read my examples and the php sqlsrv_driver Library i linked for you.

i give you your code correction but you need to learn before work else your work is already wrong !

not included in this :
session_id
session_username
session_password

i don't know if you use it; at you to update this code if you need it.

edit (20/06/15 21:05): delete optional string for sqlsrv_errors , don't work.
i think there is a way but don't know it [ die( print_r("SQL Server is down:" sqlsrv_errors(), true)); ]

PHP Code:
 <?php
 
 session_start
();
 
 if(isset(
$_POST['submit']) == true)
 {
    
$error "";
    if (
preg_match("/[^a-zA-Z0-9\-\_\!\$\#\@\^\&\*\(\)\^\+\ \.\?]/"$_POST['username']))
    {
        
$_SESSION['islogged'] = false;
        
$error "Sorry, invalid char(s) in your username.";
    }
    else
    {
        if (
preg_match("/[^a-zA-Z0-9\-\_\!\$\#\@\^\&\*\(\)\^\+\ \.\?]/"$_POST['password']))
        {
            
$_SESSION['islogged'] = false;
            
$error "Sorry, invalid char(s) in your password.";
        }
        else
        {
            
$username $_POST['username'];
            
$password $_POST['password'];
            
$hash "*****";
            
$encryptedpw md5($hash$password);
    
            
$sqlsrv_server "****";
            
$sqlsrv_username "sa";
            
$sqlsrv_password "*******";
            
$connection_infos = array( "UID"=>$sqlsrv_username,"PWD"=>$sqlsrv_password,"Database"=>"Auth");
            
$conn sqlsrv_connect($sqlsrv_server$connection_infos);
            
            if( 
$conn === false )
            {
                die( 
print_r(sqlsrv_errors(), true));
            }
            else
            {
                
$sql "SELECT * FROM Accounts WHERE login_name = ?";
                
$params = array($username);
        
                
$get01 sqlsrv_query($conn$sql$params);
                
                if( 
$get01 === false )
                {
                    die( 
print_r(sqlsrv_errors(), true));
                }
                else
                {
                    
$row01 sqlsrv_fetch_array($get01);
                    if(
$encryptedpw == $row01['password'])
                    {
                        
$_SESSION['islogged'] = true;
                        
header("location:login_success.php"); 
                    }
                    else
                    {
                        
$_SESSION['islogged'] = false;
                        
$error "Password is incorrect";
                    }
                    
sqlsrv_free_stmt($get01);
                }
                
sqlsrv_close$conn );
            }
        }
    }
 }
 
 
?>
Last point : i see you don't set your username and password textbox 'required' , the user can send empty values !

not with this in your html :

HTML Code:
<form name="form" method="post">

 <li><a href='#'>Identifiant:</a></li> 
 <li><input name="username" value=""  required  /> </li>

 <li><a href='#'>Mot de passe:</a></li>
 <li><input type="password" name="password" value=""  required  ></li>

 <input type="submit" value="Connexion" name='submit' class="login" /><br/>
 <?php echo $error; ?>

 </form>
nimoht is offline  
Old   #26
 
elite*gold: 0
Join Date: Sep 2013
Posts: 41
Received Thanks: 0
Thanks you
FlyffResu is offline  
Old   #27
 
elite*gold: 0
Join Date: Apr 2012
Posts: 99
Received Thanks: 34
thanks


nimoht is offline  
Reply



« Previous Thread | Next Thread »



All times are GMT +2. The time now is 15:34.


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

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