Notice: Undefined variable: connect in C:\wamp\www\rank.php on line 5
Warning: mssql_query() [function.mssql-query]: message: Impossible d'envoyer des données Unicode à classement exclusivement Unicode ou des données ntext à des clients utilisant DB-Library (par exemple ISQL) ou ODBC version 3.7 ou antérieure. (severity 16) in C:\wamp\www\rank.php on line 10
1
Fatal error: Call to undefined function sqlsrv_close() in C:\wamp\www\rank.php on line 17
( ! ) 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:
<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>
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);