I don't understand what you mean by "host required a registration page". If you've got a dedicated or a VPS, then there's really no requirement for you to install anything on it.
Post the code here, make sure you surround it with [php][/php] tags to preserve the formatting. Its too hard to read there.
Then you need to tell us what the actual issue is. Nobody will rewrite the code or convert the database engine or anything like that, but if you have an error then we can help you fix that.
$sqlLink = mssql_connect($cfg[sql_host],$cfg[sql_user],$cfg[sql_pass]);
if(!$sqlLink) die("MSSQL server is not accessable, why should we try to select database ?");
else
{
mssql_select_db($cfg[sql_db],$sqlLink);
}
?>
Okay, don't use mssql at all. The package is old, and I don't believe they intend to keep it around much longer. I'd recommend for a concrete implementation that you use SQLSRV.
Other than that, you didn't really specify what you are needing to do / the error you have with the above. Although lacking the mssql extension wouldn't surprise me which is why I suggested looking into the SQLSRV. You can also look into PDO, but I'm not sure what the SQLServer drivers are like for support on it.
if(!$sqlLink) die("MSSQL server is not accessable, why should we try to select database ?");
To this:
PHP Code:
if(!$sqlLink) die("Failed to connect: " . mssql_get_last_message());
I assume you can fetch an error off of a mssql_connect. If it produces no cause for the failed to connect message, you'll need to check your sqlserver logs.
<?php /* Simple registration page for silkroad server, by Chernobyl * Settings are at _inc/config.php * If you get an mssql connection error, while defining totally correct data * Just use older ntwdblib.dll for your webserver */ require_once('_inc/security.class.php'); require_once('_inc/config.php');
if(!isset($_POST['submit'])) { echo "<table border='1'> <form method='post'> <td>Username</td><td><input type='text' name='username' maxlength='16'></td><tr/> <td>Password[1]</td><td><input type='password' name='pw1' maxlength='32'></td><tr/> <td>Password[2]</td><td><input type='password' name='pw2' maxlength='32'></td><tr/> <td></td><td><input type='submit' name='submit' value='Register'></td> </form> </table>"; } else { if(is_array($user) == true) $err[] = "Username is array, n00p"; if(is_array($pass1) == true) $err[] = "Pw1 is array, n00p"; if(is_array($pass2) == true) $err[] = "Pw2 is array, n00p"; if(strlen($_POST['username']) < 3) $msg[] = "Username too short"; if(strlen($_POST['username']) > 16)$msg[] = "Username too long"; if(strlen($_POST['pw1']) < 6) $msg[] = "Password [1] too short"; if(strlen($_POST['pw1']) > 32)$msg[] = "Password [1] too long"; if(strlen($_POST['pw2']) < 6) $msg[] = "Password [2] too short"; if(strlen($_POST['pw']) > 32) $msg[] = "Password [2] too long"; if($_POST['pw1'] != $_POST['pw2']) $msg[] = "Passwords are not the same";
Fatal error: Call to undefined function mssql_connect() in D:\Hosting\9503144\html\_inc\config.php on line 9
You don't have mssql installed. You'll need to consult the documentation here for installing it. The requirements section is the most important part of this package; installation on windows is a simple matter of uncommenting the line in php.ini to enable it, but you require the dll's on the system path to run it.
I have mssql installed on my server pc that is what my server is running off of.
The error says you do not have mssql extension installed.
You may have SQLServer installed as a database, but you need to configure PHP to use mssql extension.
Thanks for the help so far ill test and see what i can do
thanks again
Your welcome.
Interesting note I hadn't seen:
Quote:
This extension is not available anymore on Windows with PHP 5.3 or later.
According to this, you need to use 5.2x or older version of PHP in order to use mssql extension. Otherwise you'll need to rewrite the code in PDO or SQLSrv (even odbc would work). I knew it was going away, but I didn't think it was actually gone.