Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

EP8 Registration - ODBC

Inactive
Joined
Jan 20, 2009
Messages
1,015
Reaction score
1,830
Here's a reg page for cabal based on ODBC, enjoy :)

Requirements:
Code:
<?php
define('MSSQL_HOST', 'IP');
define('MSSQL_USER', 'USER');
define('MSSQL_PASS', 'PASS');
$mssql = odbc_connect('Driver={SQL Server};Server='.MSSQL_HOST.';', MSSQL_USER, MSSQL_PASS);

require_once('ayah.php');
$ayah = new AYAH();

function mssql_escape_string($str){ 
    $str = htmlentities($str); 
    if (ctype_alnum($str))  
        return $str; 
    else 
        return str_ireplace(array(';', '%', "'"), "", $str);    
}  

foreach ($_GET as $key=>$getvar){ $_GET[$key] = mssql_escape_string($getvar); }
foreach ($_POST as $key=>$postvar){ $_POST[$key] = mssql_escape_string($postvar); }

if (!isset($_POST['reg_username']))
    $_POST['reg_username'] = '';

odbc_exec($mssql, 'USE [ACCOUNT]');
$checkacc  = odbc_exec($mssql, 'SELECT COUNT(*) as count FROM [cabal_auth_table] WHERE ID=\'' . mssql_escape_string($_POST['reg_username']) . '\'');
$errors    = array();

if (empty($_POST['reg_username']) || empty($_POST['reg_password']))
    $errors[] = 'You must fill out all fields.';

if (!empty($_POST['reg_username']) && odbc_result($checkacc, 'count') > 0)
    $errors[] = '' . $_POST['reg_username'] . ' is already in use.';

if (!empty($_POST['reg_username']) && (strlen($_POST['reg_username']) > 16 || strlen($_POST['reg_username']) < 6))
    $errors[] = 'Usernames must be between 6 - 16 characters.';

if (!empty($_POST['reg_password']) && (strlen($_POST['reg_password']) > 16 || strlen($_POST['reg_password']) < 6))
    $errors[] = 'Passwords must be between 6 - 16 characters.';

if (array_key_exists('reg_submit', $_POST)) {
    $score = $ayah->scoreResult();
    if ($score) {
        if (count($errors) > 0) {
            echo '<div class="fail">';
            foreach ($errors as $error) {
                echo $error . '<br/>';
            }
            echo '</div>';
        } else {
            odbc_exec($mssql, 'EXEC [dbo].[cabal_tool_registerAccount]"'.mssql_escape_string($_POST['reg_username']).'","'.mssql_escape_string($_POST['reg_password']).'"');
            echo '<div class="success">Your account has been successfully created.</div>';
        }
    } else {
        echo '<div class="fail">Invalid Captcha.</div>';
    }
}
?>
<!DOCTYPE html>
<head>
   <title>Cabal EP8 Registration</title>
   <meta charset="utf-8" />
</head>
<body>
   <form method="post" action="register.php">
      <table>
         <tr>
            <td>Username:</td>
            <td><input type="text" name="reg_username" autocomplete="off" maxlength="16"></td>
         </tr>
         <tr>
            <td>Password:</td>
            <td><input type="password" name="reg_password" autocomplete="off" maxlength="16"></td>
         </tr>
         <tr>
            <td><?php echo $ayah->getPublisherHTML(); ?></td>
            <td><input type="submit" name="reg_submit" value="Create Account"></td>
         </tr>
      </table>
   </form>
</body>
</html>
 
Joined
Jul 24, 2011
Messages
805
Reaction score
606
many complete web released already on cabal section.. i dont see a point of on this.. since im working with sqlsrv i dont see a point of using others...
odbc connect mainly work only on windows.. sqlsrv working on windows and linux too..
 
Trying to be developer ^^
Loyal Member
Joined
Jul 21, 2010
Messages
1,072
Reaction score
358
Here's a reg page for cabal based on ODBC, enjoy :)

Requirements:
Code:
<?php
define('MSSQL_HOST', 'IP');
define('MSSQL_USER', 'USER');
define('MSSQL_PASS', 'PASS');
$mssql = odbc_connect('Driver={SQL Server};Server='.MSSQL_HOST.';', MSSQL_USER, MSSQL_PASS);

require_once('ayah.php');
$ayah = new AYAH();

function mssql_escape_string($str){ 
    $str = htmlentities($str); 
    if (ctype_alnum($str))  
        return $str; 
    else 
        return str_ireplace(array(';', '%', "'"), "", $str);    
}  

foreach ($_GET as $key=>$getvar){ $_GET[$key] = mssql_escape_string($getvar); }
foreach ($_POST as $key=>$postvar){ $_POST[$key] = mssql_escape_string($postvar); }

if (!isset($_POST['reg_username']))
    $_POST['reg_username'] = '';

odbc_exec($mssql, 'USE [ACCOUNT]');
$checkacc  = odbc_exec($mssql, 'SELECT COUNT(*) as count FROM [cabal_auth_table] WHERE ID=\'' . mssql_escape_string($_POST['reg_username']) . '\'');
$errors    = array();

if (empty($_POST['reg_username']) || empty($_POST['reg_password']))
    $errors[] = 'You must fill out all fields.';

if (!empty($_POST['reg_username']) && odbc_result($checkacc, 'count') > 0)
    $errors[] = '' . $_POST['reg_username'] . ' is already in use.';

if (!empty($_POST['reg_username']) && (strlen($_POST['reg_username']) > 16 || strlen($_POST['reg_username']) < 6))
    $errors[] = 'Usernames must be between 6 - 16 characters.';

if (!empty($_POST['reg_password']) && (strlen($_POST['reg_password']) > 16 || strlen($_POST['reg_password']) < 6))
    $errors[] = 'Passwords must be between 6 - 16 characters.';

if (array_key_exists('reg_submit', $_POST)) {
    $score = $ayah->scoreResult();
    if ($score) {
        if (count($errors) > 0) {
            echo '<div class="fail">';
            foreach ($errors as $error) {
                echo $error . '<br/>';
            }
            echo '</div>';
        } else {
            odbc_exec($mssql, 'EXEC [dbo].[cabal_tool_registerAccount]"'.mssql_escape_string($_POST['reg_username']).'","'.mssql_escape_string($_POST['reg_password']).'"');
            echo '<div class="success">Your account has been successfully created.</div>';
        }
    } else {
        echo '<div class="fail">Invalid Captcha.</div>';
    }
}
?>
<!DOCTYPE html>
<head>
   <title>Cabal EP8 Registration</title>
   <meta charset="utf-8" />
</head>
<body>
   <form method="post" action="https://forum.ragezone.com/register.php">
      <table>
         <tr>
            <td>Username:</td>
            <td><input type="text" name="reg_username" autocomplete="off" maxlength="16"></td>
         </tr>
         <tr>
            <td>Password:</td>
            <td><input type="password" name="reg_password" autocomplete="off" maxlength="16"></td>
         </tr>
         <tr>
            <td><?php echo $ayah->getPublisherHTML(); ?></td>
            <td><input type="submit" name="reg_submit" value="Create Account"></td>
         </tr>
      </table>
   </form>
</body>
</html>

Good job, every kind of release is welcome here dont listen Dexter :) I gonna use it on my website i hope u will not be angry :D
 
Junior Spellweaver
Joined
Jan 24, 2013
Messages
183
Reaction score
80
many complete web released already on cabal section.. i dont see a point of on this.. since im working with sqlsrv i dont see a point of using others...
odbc connect mainly work only on windows.. sqlsrv working on windows and linux too..

The SQLSRV extension can be used on the following operating systems:

  • Windows Vista Service Pack 2 or later
  • Windows Server 2008 Service Pack 2 or later
  • Windows Server 2008 R2
  • Windows 7
 
Inactive
Joined
Jan 20, 2009
Messages
1,015
Reaction score
1,830
many complete web released already on cabal section.. i dont see a point of on this.. since im working with sqlsrv i dont see a point of using others...
odbc connect mainly work only on windows.. sqlsrv working on windows and linux too..

It was released because all i see in this section is php 5.2 dinosaur. This was a bit more motivation for people to learn and possibly start upgrading. If you know anything about security, you'll know that running 5.2 is not so wise and it requires old stacks to run lol. You also do know you'll be stuck with some rigged insecure scripts becuase you can't upgrade due to php 5.3+ not support mssql on linux anymore at all. To each is their own really.

Good job, every kind of release is welcome here dont listen Dexter :) I gonna use it on my website i hope u will not be angry :D

Thanks, was quick and just a conversion is all :p

The SQLSRV extension can be used on the following operating systems:

  • Windows Vista Service Pack 2 or later
  • Windows Server 2008 Service Pack 2 or later
  • Windows Server 2008 R2
  • Windows 7

^ made my day, did it make yours to DeXtR?
 
Joined
Jul 24, 2011
Messages
805
Reaction score
606
On my project im using adodb and smarty + fully mvc based site.. and sqlsrv can be use with some linux package.. and lot of server using my old website.. which was good for beginning... but now i feel my code so ugly :D anyway odbc solution is useless on my mind.. but gl to use it..
 
Inactive
Joined
Jan 20, 2009
Messages
1,015
Reaction score
1,830
On my project im using adodb and smarty + fully mvc based site.. and sqlsrv can be use with some linux package.. and lot of server using my old website.. which was good for beginning... but now i feel my code so ugly :D anyway odbc solution is useless on my mind.. but gl to use it..

I cant argue that ODBC isn't poop because it is poop truthfully, more secure sure but in the end its super restrictive and quite a pain in the butt lol. I was only honestly trying to get others to get on the ball here and maybe upgrade some stuff. Lots of old stuff, seems like that's all this section seems to offer and i'm sure u know what i mean by this.

GL with your project, hopefully you'll drop me a pm so i can check it out when your near completion as i would be interested in checking it out :)
 
Trying to be developer ^^
Loyal Member
Joined
Jul 21, 2010
Messages
1,072
Reaction score
358
On my project im using adodb and smarty + fully mvc based site.. and sqlsrv can be use with some linux package.. and lot of server using my old website.. which was good for beginning... but now i feel my code so ugly :D anyway odbc solution is useless on my mind.. but gl to use it..

fully mvc? the fallen script was not even close to MVC architecture :p
MVC = Model - View - Controller
Ur script is focused on one file, where u have all code.
for futhure do not mix html/css with php code for that u have mvc to load templates from other file.

edit://
but yea respect for release :) no offense.
 
Joined
Jul 24, 2011
Messages
805
Reaction score
606
fully mvc? the fallen script was not even close to MVC architecture :p
MVC = Model - View - Controller
Ur script is focused on one file, where u have all code.
for futhure do not mix html/css with php code for that u have mvc to load templates from other file.

edit://
but yea respect for release :) no offense.


on my CURRENT project... fallen is based old structured language and using mssql_query-s..
i think so i will be done on middle of summer..
 
Trying to be developer ^^
Loyal Member
Joined
Jul 21, 2010
Messages
1,072
Reaction score
358
on my CURRENT project... fallen is based old structured language and using mssql_query-s..
i think so i will be done on middle of summer..

U want to release it? Maybe make thread in develop section so we can improve ur script, who knows :D
I have already also done the engine, fully MVC system + Rain Template (this is real MVC ^^) currently have finished basic things, login, register, and the frontpage (news system, svr status, channel status, tg times, arcane times, saint holders, bringer holders, submenus downloads fully auto from db, etc etc). But the problem is i am out of ideas for design :F
 
Inactive
Joined
Jan 20, 2009
Messages
1,015
Reaction score
1,830
U want to release it? Maybe make thread in develop section so we can improve ur script, who knows :D
I have already also done the engine, fully MVC system + Rain Template (this is real MVC ^^) currently have finished basic things, login, register, and the frontpage (news system, svr status, channel status, tg times, arcane times, saint holders, bringer holders, submenus downloads fully auto from db, etc etc). But the problem is i am out of ideas for design :F

If he was willing to do this per-say, release to the public or the intention to and actually release it, i wouldn't mind contributing to it.

With that said, using a stable framework for most of it would be wise something like Laravel or even Yii with a templating engine like Twig would be quite a nice project.
 
Back
Top