Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Development

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

Reply
 
Thread Tools Display Modes
  #91  
Old 09-05-2009, 12:55 AM
jimm0thy
Sarnak
 
Join Date: Jul 2002
Posts: 71
Default

While everything is technically working for me , anytime someone connects to the server I get a debugging error from EQEmuLoginServer.exe , however hitting ignore will allow me to connect.
Reply With Quote
  #92  
Old 09-05-2009, 03:15 AM
jimm0thy
Sarnak
 
Join Date: Jul 2002
Posts: 71
Default

Well solved my problem with a combination of compiling the exe to release instead of debug and using realse dll at same time.
Reply With Quote
  #93  
Old 12-31-2009, 04:17 PM
Magnus369
Fire Beetle
 
Join Date: Jun 2009
Location: Alaska
Posts: 2
Default

I'm getting the same error in regards to the crypto lib not loading:
-----------------------------
chatserver EQEmuLoginServer libcryptopp.la libEMuShareMem.so ms plugins tblServerListType.sql
cleanipc EQEmuLoginServerDBInstall.sql libcryptopp.so libEQEmuAuthCrypto.so patch_6.2.conf quests tblWorldServerRegistration.sql
commands.pl eqlaunch libcryptopp.so.7 log.ini patch_Anniversary.conf spells_en.txt templates
crashlog eqtime.cfg libcrypto++.so login_opcodes.conf patch_Live.conf spells_us.txt world
database libcrypt.a libcrypto.so.0.9.8 logs patch_SoF.conf start worldui
eqemu_config.xml libcrypto++.a libcrypto++.so.7 mailserver patch_Titanium.conf stop worldui.pl
eqemu_config.xml.full libcrypto++.la libcrypto++.so.7.0.0 Maps persist_world tblLoginServerAccounts.sql zone
eqemulogin.ini libcryptopp.a libcrypt.so mime.types plugin.pl tblServerAdminRegistration.sql
eqemu@linuxeq:~/server$ nm libcrypt* | grep _ZN8CryptoPP20AllocatorWithCleanupIhLb0EE8allocate EjPKv
00000000 W _ZN8CryptoPP20AllocatorWithCleanupIhLb0EE8allocate EjPKv
U _ZN8CryptoPP20AllocatorWithCleanupIhLb0EE8allocate EjPKv
U _ZN8CryptoPP20AllocatorWithCleanupIhLb0EE8allocate EjPKv
nm: libcrypto++.la: File format not recognized
00000000 W _ZN8CryptoPP20AllocatorWithCleanupIhLb0EE8allocate EjPKv
U _ZN8CryptoPP20AllocatorWithCleanupIhLb0EE8allocate EjPKv
U _ZN8CryptoPP20AllocatorWithCleanupIhLb0EE8allocate EjPKv
nm: libcryptopp.la: File format not recognized
nm: libcryptopp.so: no symbols
nm: libcryptopp.so.7: no symbols
nm: libcrypto++.so: no symbols
nm: libcrypto.so.0.9.8: no symbols
nm: libcrypto++.so.7: no symbols
nm: libcrypto++.so.7.0.0: no symbols
nm: libcrypt.so: no symbols
eqemu@linuxeq:~/server$ ./EQEmuLoginServer
EQEmuLoginServer

Using Port: 5998
Dumping Inbound packets.
Dumping Outbound packets.
Tracing ON.
Database Server: 192.168.1.23
Database Catalog: peq


[Error] Load of Security Library 'libEQEmuAuthCrypto.so' failed:
libEQEmuAuthCrypto.so: undefined symbol: _ZN8CryptoPP20AllocatorWithCleanupIhLb0EE8allocate EjPKv
Security Module Load Failed.
[Debug] Starting Log: logs/eqemu_debug_18551.log


----------------------

So, I went a little nuts and copied the libraries to the same directory the executable gets run from, the ld path is exported... but the library is still refusing to load due to error. is there anyway to get the source code for libEQEmuAuthCrypto.so, in order to continue trying to fix this headache? as far as I can tell, the rest is working, I can get to a client login before the program segfaults (go figure- no libEQEmuAuthCrypto loaded, no functions actually available for , boom), and of course it faults at line 157 in clientlist.cpp
char *CryptoBuffer = EQCrypto.DecryptUsernamePassword((const char*)app->pBuffer, app->Size(), 5);

any help would be greatly appreciated, and as always, thanks for the work on this project so far!
Reply With Quote
  #94  
Old 12-31-2009, 05:37 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

Sadly, the encryption and Linux don't mix. ATM, the only way to get it to work under Linux consistently is to use WINE. There is no native solution that works on every distro currently. :(
Reply With Quote
  #95  
Old 12-31-2009, 06:12 PM
Magnus369
Fire Beetle
 
Join Date: Jun 2009
Location: Alaska
Posts: 2
Default

Well, then here's a dumb question-

After login, what's responsible for maintaining the connection? ie, is there any reason I'd actually have to run the login server on a linux box if it's actually a low bandwidth/connection count service? if it's not responsible for anything more than just login brokering, then I don't see a reason to keep it on the same box.

Also- that error I posted occurs on ubuntu 8.10 server as well as fedora core 11, and I'm not entirely sure what the others were running, but no go eh?

What about the question of getting the source? I'd be more than happy to try to get it working.
Reply With Quote
  #96  
Old 01-29-2010, 06:44 PM
pfyon's Avatar
pfyon
Discordant
 
Join Date: Mar 2009
Location: Ottawa
Posts: 495
Default

So one of the somewhat recent changes is the inclusion of EQCryptoAPI.h in clientlist.cpp, however, it isn't included in the source. Is it still under development and not ready for release, or is there some other reason it isn't there?
Reply With Quote
  #97  
Old 01-29-2010, 08:27 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

Code:
#ifndef EQEMUCAPI__H
#define EQEMUCAPI__H

char* DecryptUsernamePassword(const char* encryptedBuffer, unsigned int bufferSize, int mode);
char* Encrypt(const char* buffer, unsigned int bufferSize, unsigned int &outSize);
void _HeapDeleteCharBuffer(char *buffer);

#endif
Reply With Quote
  #98  
Old 01-30-2010, 12:53 AM
pfyon's Avatar
pfyon
Discordant
 
Join Date: Mar 2009
Location: Ottawa
Posts: 495
Default

Awesome, thanks KLS, compiles fine now.
Reply With Quote
  #99  
Old 04-04-2010, 01:08 PM
cubber
Discordant
 
Join Date: Apr 2006
Posts: 374
Default

Here is an Account Creation web front end tool I wrote for the SVN Loginserver. It can be added to a server webpage to allow users to create accounts, it then emails the server admin the new account information.

It consists of 2 files eqreg.php and insert.php

Note: Make sure to change the mysql server info and email address in insert.php before using.

eqreg.php

Code:
<!-- EQEMu SVN Loginserver PHP Account Registration Page - By: Cubber -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict/EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>EQEmu SVN Loginserver Account Registration Page</title>

<meta name="description" content="EQEmulator SVN Loginserver Account Registration Page.">

</head>

<body>

                        <h1>EQ Registration Form</h1>
                        <p>Please fill out the form below to create a new account.</p>
                        <br />
                                
                                        <form method="post" action="insert.php">
                                        Username: <i>(Max 16 chars)</i><br />
                                                <input name="username" type="text" id="username" maxlength="16" />
                                        <br /><br />
                                        Password: <i>(Max 16 chars)</i><br />
                                                <input name="pw" type="password" id="pw" maxlength="16" />
                                        <br /><br />
                                        Email:<br />
                                                <input name="email" type="text" id="email" maxlength="50" />
                                        <br /><br />
                                        <br />    
                                                <input name="Submit" type="submit" value="Create Account" />
                                        </form>
                                        <br />
                                                        
                                
</body>
</html>

insert.php

Code:
<!-- EQEMu SVN Loginserver PHP Account Registration Page - By: Cubber -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict/EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>>EQEmu SVN Loginserver Account Registration Page</title>

<meta name="description" content="EQEmulator SVN Loginserver Account Registration Page.">

<head>

<body>

                                <p>                             
                                <?php

                                        $DB_ADDY = "localhost"; //address:port for the MySQL server
                                        $DB_USER = "eqemu"; //username to login to MySQL with
                                        $DB_PASS = "eqemu"; //password to login to MySQL with
                                        $DB_DB = "peq"; //database name to use "peq" for default installation
                                        $user = $_POST['username'];
                                        $pass = $_POST['pw'];
                                        $acct_email = $_POST['email'];
                                        $sendto = "youremail@something.com";
                                        $subject = "New EQEmu Account Created";
                                        $message = "A new account has been created on the EQEmu Server.  Account details: - email: $acct_email\n - username: $user\n - password: $pass\n";
                                        
                                        
                                        function error_s($text) {
                                        echo("<p>" . $text);
                                        };      

                                        $user_chars = "#[^a-zA-Z0-9_\-]#";
                                        $email_chars = "/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[@][A-z0-9_]+([.][A-z0-9_]+)*[.][A-z]{2,4}$/";

                                        if ( !isset($_POST['username']) || !isset($_POST['pw']) || !isset($_POST['email']) )
                                        {
                                        echo "User/Pass/Email not passed.";
                                        return;
                                        }

                                        $con = @mysql_connect($DB_ADDY, $DB_USER, $DB_PASS);
                                        if (!$con) {
                                        error_s("Unable to connect to database: " . mysql_error());
                                        };

                                        if (!empty($_POST)) {
                                        if ((empty($_POST["username"]))||(empty($_POST["pw"]))||(empty($_POST["email"])) ) {
                                                error_s("You did not enter all the required information.");
                                                                exit();
                                        } else {

                                                $username = ($_POST["username"]);
                                                $pw = ($_POST["pw"]);
                                                $email = ($_POST["email"]);
                                                if (strlen($username) < 5) {
                                                        error_s("Username too short.");
                                                        exit();
                                                };
                                                if (strlen($username) > 16) {
                                                        error_s("Username too long.");
                                                        exit();
                                                };
                                                if (strlen($pw) < 6) {
                                                        error_s("Password too short.");
                                                        exit();
                                                };
                                                if (strlen($pw) > 16) {
                                                        error_s("Password too long.");
                                                        exit();
                                                };
                                                if (strlen($email) < 10) {
                                                        error_s("Email was too short.");
                                                       exit();
                                                };
                                                if (strlen($email) > 50) {
                                                        error_s("Email was too long.");
                                                        exit();
                                                };
                                                if (preg_match($user_chars,$username)) {
                                                        error_s("Username contained illegal characters.");
                                                        exit();
                                                };
                                                if (preg_match($user_chars,$pw)) {
                                                        error_s("Password contained illegal characters.");
                                                        exit();
                                                };
                                                if (!preg_match($email_chars,$email)) {
                                                        error_s("Email was in an incorrect format.");
                                                        exit();
                                                };
                                                
                                                $username = mysql_real_escape_string($username);
                                                $pw = mysql_real_escape_string($pw);
                                                $email = mysql_real_escape_string($email);
                                                $qry = @mysql_query("select AccountName from " . mysql_real_escape_string($DB_DB) . ".tblLoginServerAccounts where AccountName = '" . $username . "'", $con);
                                                                if (!$qry) {
                                                                        error_s("Error querying database: " . mysql_error());
                                                                };
                                               if ($existing_username = mysql_fetch_assoc($qry)) {
                                                        foreach ($existing_username as $key => $value) {
                                                                $existing_username = $value;
                                                        };
                                                };
                                                $existing_username = ($existing_username);
                                                if ($existing_username == ($_POST['username'])) {
                                                       error_s("That username is already taken.  Click <a href=eqreg.php>here</a> and try again.");
                                                        exit();
                                                };
                                                                unset($qry);

                                                $sha_pass_hash = sha1(($pw));
                                                $register_sql = "insert into " . mysql_real_escape_string($DB_DB) . ".tblLoginServerAccounts (AccountName,AccountPassword,AccountEmail) values ('" . $username . "','" . $sha_pass_hash . "','" . $email . "')";
                                                $qry = @mysql_query($register_sql, $con);
                                                                if (!$qry) {
                                                                        error_s("Error creating account: " . mysql_error());
                                                                };
                                                mail($sendto, $subject, $message);
                                               echo("Your account was successfully created!");
                                                                exit();
                                       };
                                } else {
                                        echo($page);
                                };

                        ?>
                        </p>


</body>
</html>

I also added captcha to the version I use on my website, I use an opensource captcha called securimage, you can find it here http://www.phpcaptcha.org/

It works rather well and is easily incorporated into the page. I did not put it into the posted code because I figured I would leave it very simple so that folks could customize it as they see fit.

Enjoy!
Reply With Quote
  #100  
Old 04-04-2010, 11:23 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Wow, thanks for sharing that, I might have to give it a try! It probably wouldn't hurt to have something like that on the SVN for people to use and update as needed Would have to see what the other devs think of putting something like that on the SVN though.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #101  
Old 04-05-2010, 09:28 AM
cubber
Discordant
 
Join Date: Apr 2006
Posts: 374
Default

Your welcome

I don't mind at all if it gets added to SVN
Reply With Quote
  #102  
Old 04-06-2010, 05:14 PM
cubber
Discordant
 
Join Date: Apr 2006
Posts: 374
Default Updates to Account Creation Tool

Version 1.1

Fixes:

- Added password confirmation box to eqreg.php and the logic to support it to insert.php

- The script now emails the user as well as the admin so the user gets a confirmation. ** Make sure you change the Bcc: address to your email address. **

- Updated error handling so all errors have a link to direct the user back to the main eqreg.php page to try again.

The code:

eqreg.php

Code:
 
<!-- EQEMu SVN Loginserver PHP Account Registration Page - By: Cubber -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict/EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>EQEmu SVN Loginserver Account Registration Page</title>

<meta name="description" content="EQEmulator SVN Loginserver Account Registration Page.">

</head>

<body>

                        <h1>EQ Registration Form</h1>
                        <p>Please fill out the form below to create a new account.</p>
                        <br />
                                
                                        <form method="post" action="insert.php">
                                        Username: <i>(Max 16 chars)</i><br />
                                                <input name="username" type="text" id="username" maxlength="16" />
                                        <br /><br />
                                        Password: <i>(Max 16 chars)</i><br />
                                                <input name="pw" type="password" id="pw" maxlength="16" />
                                        <br /><br />
                                        Confirm Password: <i>(Max 16 chars)</i><br />
                                                <input name="cpw" type="password" id="cpw" maxlength="16" />
                                        <br /><br />
                                        Email:<br />
                                                <input name="email" type="text" id="email" maxlength="50" />
                                        <br /><br />
                                        <br />    
                                                <input name="Submit" type="submit" value="Create Account" />
                                        </form>
                                        <br />
                                                        
                                
</body>
</html>
insert.php

Code:
<!-- EQEMu SVN Loginserver PHP Account Registration Page - By: Cubber -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict/EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>>EQEmu SVN Loginserver Account Registration Page</title>

<meta name="description" content="EQEmulator SVN Loginserver Account Registration Page.">

<head>

<body>

                <p>                             
                        <?php
                                $DB_ADDY = "localhost"; //address:port for the MySQL server
                                $DB_USER = "eqemu"; //username to login to MySQL with
                                $DB_PASS = "eqemu"; //password to login to MySQL with
                                $DB_DB = "peq"; //database name to use "peq" for default installation
                                $user = $_POST['username'];
                                $pass = $_POST['pw'];
                                $cpass = $_POST['cpw'];
                                $acct_email = $_POST['email'];
                                $headers = 'Bcc: admin@somewhere.com' . "\r\n";
                                $sendto = $acct_email;
                                $subject = "New EQ Account Created";
                                $message = "Your new account has been created on the EQEmulator Server.  Account details:\n  email: $acct_email\n  username: $user\n password: $pass\n";

                                function error_s($text) 
                                        {
                                                echo("<p>" . $text);
                                        };

                                $user_chars = "#[^a-zA-Z0-9_\-]#";
                                $email_chars = "/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[@][A-z0-9_]+([.][A-z0-9_]+)*[.][A-z]{2,4}$/";

                                if ( !isset($_POST['username']) || !isset($_POST['pw']) || !isset($_POST['cpw']) || !isset($_POST['email']) )
                                        {
                                                echo "User/Pass/Email not passed. Click <a href=eqreg.php>here</a> and try again.";
                                                return;
                                        }

                                $con = @mysql_connect($DB_ADDY, $DB_USER, $DB_PASS);
                                if (!$con) 
                                        {
                                                error_s("Unable to connect to database: " . mysql_error());
                                        };

                                if (!empty($_POST)) 
                                        {
                                                if ((empty($_POST["username"]))||(empty($_POST["pw"]))||(empty($_POST["cpw"]))||(empty($_POST["email"])) ) 
                                                        {
                                                                error_s("You did not enter all the required information.  Click <a href=eqreg.php>here</a> and try again.");
                                                                exit();
                                                        } 
                                                else 
                                                        {

                                                                $username = ($_POST["username"]);
                                                                $pw = ($_POST["pw"]);
                                                                $cpw = ($_POST["cpw"]);
                                                                $email = ($_POST["email"]);

                                                                if (strlen($username) < 5) 
                                                                        {
                                                                                error_s("Username too short.  Click <a href=eqreg.php>here</a> and try again.");
                                                                                exit();
                                                                        };

                                                                if (strlen($username) > 16) 
                                                                        {
                                                                                error_s("Username too long.  Click <a href=eqreg.php>here</a> and try again.");
                                                                                exit();
                                                                        };

                                                                if (strlen($pw) < 6) 
                                                                        {
                                                                                error_s("Password too short.  Click <a href=eqreg.php>here</a> and try again.");
                                                                                exit();
                                                                        };

                                                                if (strlen($pw) > 16) 
                                                                        {
                                                                                error_s("Password too long.  Click <a href=eqreg.php>here</a> and try again.");
                                                                                exit();
                                                                        };
                                                                if (strlen($cpw) < 6) 
                                                                        {
                                                                                error_s("Password too short.  Click <a href=eqreg.php>here</a> and try again.");
                                                                                exit();
                                                                        };

                                                                if (strlen($cpw) > 16) 
                                                                        {
                                                                                error_s("Password too long.  Click <a href=eqreg.php>here</a> and try again.");
                                                                                exit();
                                                                        };

                                                                if (strlen($email) < 10) 
                                                                        {
                                                                                error_s("Email was too short.  Click <a href=eqreg.php>here</a> and try again.");
                                                                                exit();
                                                                        };

                                                                if (strlen($email) > 50) 
                                                                        {
                                                                                error_s("Email was too long.  Click <a href=eqreg.php>here</a> and try again.");
                                                                                exit();
                                                                        };

                                                                if (preg_match($user_chars,$username)) 
                                                                        {
                                                                                error_s("Username contained illegal characters.  Click <a href=eqreg.php>here</a> and try again.");
                                                                                exit();
                                                                        };

                                                                if (preg_match($user_chars,$pw)) 
                                                                        {
                                                                                error_s("Password contained illegal characters.  Click <a href=eqreg.php>here</a> and try again.");
                                                                                exit();
                                                                        };
                                                                if (preg_match($user_chars,$cpw)) 
                                                                        {
                                                                                error_s("Password contained illegal characters.  Click <a href=eqreg.php>here</a> and try again.");
                                                                                exit();
                                                                        };

                                                                if (!preg_match($email_chars,$email)) 
                                                                        {
                                                                                error_s("Email was in an incorrect format.  Click <a href=eqreg.php>here</a> and try again.");
                                                                                exit();
                                                                        };

                                                                if ($pw != $cpw)
                                                                        {
                                                                                error_s("Passwords do not match!  Click <a href=eqreg.php>here</a> and try again.");
                                                                                exit();
                                                                        }

                                                                $username = mysql_real_escape_string($username);
                                                                $pw = mysql_real_escape_string($pw);
                                                                $email = mysql_real_escape_string($email);
                                                                $qry = @mysql_query("select AccountName from " . mysql_real_escape_string($DB_DB) . ".tblLoginServerAccounts where AccountName = '" . $username . "'", $con);
                                                                if (!$qry) 
                                                                        {
                                                                                error_s("Error querying database: " . mysql_error());
                                                                        };

                                                                if ($existing_username = mysql_fetch_assoc($qry)) 
                                                                        {
                                                                                foreach ($existing_username as $key => $value) 
                                                                                        {
                                                                                                $existing_username = $value;
                                                                                        };
                                                                        };

                                                                $existing_username = ($existing_username);
                                                                if ($existing_username == ($_POST['username'])) 
                                                                        {
                                                                                error_s("That username is already taken.  Click <a href=eqreg.php>here</a> and try again.");
                                                                                exit();
                                                                        };
                                                
                                                                unset($qry);

                                                                $sha_pass_hash = sha1(($pw));
                                                                $register_sql = "insert into " . mysql_real_escape_string($DB_DB) . ".tblLoginServerAccounts (AccountName,AccountPassword,AccountEmail) values ('" . $username . "','" . $sha_pass_hash . "','" . $email . "')";
                                                                $qry = @mysql_query($register_sql, $con);
                                                                if (!$qry) 
                                                                        {
                                                                                error_s("Error creating account: " . mysql_error());
                                                                        }

                                                                else 
                                                                        {
                                                                                mail($sendto, $subject, $message, $headers);
                                                                                echo("Your account was successfully created!");
                                                                        }

                                                                exit();
                                                        };

                                        } 

                                else 
                                        {
                                                echo($page);
                                        };

                        ?>
                </p>

</body>
</html>
Reply With Quote
  #103  
Old 04-06-2010, 05:22 PM
cubber
Discordant
 
Join Date: Apr 2006
Posts: 374
Default

Here is a password reset tool I whipped up today for use with the SVN Login Server.

Same deal as the account creation tool, I stripped it down so it could be customized easily. Make sure to change the mysql info as well as the admin@somewhere.com to your email address. **Note: admin email is lower in the code.**

This script will email a confirmation to the user as well as Bcc the server admin once you change the Bcc: address. Once you verify it is working you may want to remove the $header from the mail line if you don't want users passwords mailed to you when they change them.


pwreset.php

Code:
<!-- EQEmulator SVN Login Server Account Password Reset Utility - By: Cubber -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict/EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>EQEmulator SVN Login Server Account Password Reset Utility</title>

<meta name="description" content="EQEmulator SVN Login Server Account Password Reset Utility.">

</head>

<body>

                        <h1>Password Reset Utility</h1>
                        <p>Please fill out the form below to change your login server password.</p>
                        <br />
                                
                                        <form method="post" action="insert.php">
                                        Username: <i>(Max 16 chars)</i><br />
                                                <input name="username" type="text" id="username" maxlength="16" />
                                        <br /><br />
                                        Current Password: <i>(Max 16 chars)</i><br />
                                                <input name="pw" type="password" id="pw" maxlength="16" />
                                        <br /><br />
                                        New Password: <i>(Max 16 chars)</i><br />
                                                <input name="npw" type="password" id="npw" maxlength="16" />
                                        <br /><br />
                                        Confirm New Password: <i>(Max 16 chars)</i><br />
                                                <input name="cnpw" type="password" id="cnpw" maxlength="16" />
                                        <br /><br />
                                                <input name="Submit" type="submit" value="Change Password" />
                                        </form>
                                        <br />
</body>
</html>

insert.php

Code:
<!-- EQEmulator SVN Login Server Account Password Reset Utility - By: Cubber  -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict/EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>EQEmulator SVN Login Server Account Password Reset Utility</title>

<meta name="description" content="EQEmulator SVN Login Server Account Password Reset Utility.">

<head>

<body>

                <p>                             
                        <?php
                                $DB_ADDY = "localhost"; //address:port for the MySQL server
                                $DB_USER = "eqemu"; //username to login to MySQL with
                                $DB_PASS = "eqemu"; //password to login to MySQL with
                                $DB_DB = "peq"; //database name to use "peq" for default installation
                                $user = $_POST['username'];
                                $pass = $_POST['pw'];
                                $npass = $_POST['npw'];
                                $cnpass = $_POST['cnpw'];


                                function error_s($text) 
                                        {
                                                echo("<p>" . $text);
                                        };      

                                $user_chars = "#[^a-zA-Z0-9_\-]#";

                                if ( !isset($_POST['username']) || !isset($_POST['pw']) || !isset($_POST['npw']) || !isset($_POST['cnpw']) )
                                        {
                                                echo "User/Pass/Email not passed. Click <a href=pwreset.php>here</a> and try again.";
                                                return;
                                        }

                                $con = @mysql_connect($DB_ADDY, $DB_USER, $DB_PASS);
                                if (!$con)
                                        {
                                                error_s("Unable to connect to database: " . mysql_error());
                                        };

                                if (!empty($_POST)) 
                                        {
                                                if ((empty($_POST["username"]))||(empty($_POST["pw"]))||(empty($_POST["npw"]))||(empty($_POST["cnpw"])) ) 
                                                        {
                                                                error_s("You did not enter all the required information. Click <a href=pwreset.php>here</a> and try again.");
                                                                exit();
                                                        }
                                                else 
                                                        {

                                                                $username = ($_POST["username"]);
                                                                $pw = ($_POST["pw"]);
                                                                $npw = ($_POST["npw"]);
                                                                $cnpw = ($_POST["cnpw"]);
                                                
                                                                if (strlen($username) < 5) 
                                                                        {
                                                                                error_s("Username too short. Click <a href=pwreset.php>here</a> and try again.");
                                                                                exit();
                                                                        };
                                                
                                                                if (strlen($username) > 16) 
                                                                        {
                                                                                error_s("Username too long. Click <a href=pwreset.php>here</a> and try again.");
                                                                                exit();
                                                                        };

                                                                if (strlen($pw) < 6) 
                                                                        {
                                                                                error_s("Password too short. Click <a href=pwreset.php>here</a> and try again.");
                                                                                exit();
                                                                        };
                                            
                                                                if (strlen($pw) > 16) 
                                                                        {
                                                                                error_s("Password too long. Click <a href=pwreset.php>here</a> and try again.");
                                                                                exit();
                                                                        };

                                                                if (strlen($npw) < 6) 
                                                                        {
                                                                                error_s("New password too short. Click <a href=pwreset.php>here</a> and try again.");
                                                                                exit();
                                                                        };

                                                                if (strlen($npw) > 16) 
                                                                        {
                                                                                error_s("New password too long. Click <a href=pwreset.php>here</a> and try again.");
                                                                                exit();
                                                                        };
                                         
                                                                if (strlen($cnpw) < 6) 
                                                                        {
                                                                                error_s("New password too short. Click <a href=pwreset.php>here</a> and try again.");
                                                                                exit();
                                                                        };

                                                                if (strlen($cnpw) > 16) 
                                                                        {
                                                                                error_s("New password too long. Click <a href=pwreset.php>here</a> and try again.");
                                                                                exit();
                                                                        };

                                                                if (preg_match($user_chars,$username)) 
                                                                        {
                                                                                error_s("Username contained illegal characters. Click <a href=pwreset.php>here</a> and try again.");
                                                                                exit();
                                                                        };

                                                                if (preg_match($user_chars,$pw)) 
                                                                        {
                                                                                error_s("Password contained illegal characters. Click <a href=pwreset.php>here</a> and try again.");
                                                                                exit();
                                                                        };

                                                                if (preg_match($user_chars,$npw)) 
                                                                        {
                                                                                error_s("New password contained illegal characters. Click <a href=pwreset.php>here</a> and try again.");
                                                                                exit();
                                                                        };

                                                                if (preg_match($user_chars,$cnpw)) 
                                                                        {
                                                                                error_s("New password contained illegal characters. Click <a href=pwreset.php>here</a> and try again.");
                                                                                exit();
                                                                        };

                                                                 if ($npw != $cnpw)
                                                                        {
                                                                                error_s("Passwords do not match!  Click <a href=pwreset.php>here</a> and try again.");
                                                                                exit();
                                                                        }

                                                                $username = mysql_real_escape_string($username);
                                                                $pw = mysql_real_escape_string($pw);
                                                                $npw = mysql_real_escape_string($npw);
                                                                $cnpw = mysql_real_escape_string($cnpw);
                                                                $qry = @mysql_query("select AccountName from " . mysql_real_escape_string($DB_DB) . ".tblLoginServerAccounts where AccountName = '" . $username . "'", $con);
                                                                if (!$qry) 
                                                                        {
                                                                                error_s("Error querying database: " . mysql_error());
                                                                        };

                                                                if ($existing_username = mysql_fetch_assoc($qry)) 
                                                                        {
                                                                                foreach ($existing_username as $key => $value) 
                                                                                        {
                                                                                                $existing_username = $value;
                                                                                        };
                                                                        };

                                                                $pwqry = @mysql_query("select AccountPassword from " . mysql_real_escape_string($DB_DB) . ".tblLoginServerAccounts where AccountName = '" . $username . "'", $con);
                                                                if (!$pwqry) 
                                                                        {
                                                                                error_s("Error querying database: " . mysql_error());
                                                                        };
                                                                
                                                                if ($pw_check = mysql_fetch_assoc($pwqry)) 
                                                                        {
                                                                                foreach ($pw_check as $key => $value) 
                                                                                        {
                                                                                                $pw_check = $value;
                                                                                        };
                                                                        };

                                                                $sha_oldpass_hash = sha1(($pw));
                                                                if ($sha_oldpass_hash != $pw_check)
                                                                        {
                                                                                error_s("Your account password was incorrect Click <a href=pwreset.php>here</a> and try again."); 
                                                                                exit(); 
                                                                        }

                                                                $existing_username = ($existing_username);
                                                                if ($existing_username == ($_POST['username'])) 
                                                                        {
                                                                                $sha_pass_hash = sha1(($npw));
                                                                                $register_sql = "UPDATE " . mysql_real_escape_string($DB_DB) . ".tblLoginServerAccounts SET AccountPassword='$sha_pass_hash' WHERE AccountName='$username' ";
                                                                        };

                                                                $mailqry = @mysql_query("select AccountEmail from " . mysql_real_escape_string($DB_DB) . ".tblLoginServerAccounts where AccountName = '" . $username . "'", $con);
                                                                if (!$mailqry) 
                                                                        {
                                                                                error_s("Error querying database: " . mysql_error());
                                                                        };

                                                                if ($acct_email = mysql_fetch_assoc($mailqry)) 
                                                                        {
                                                                                foreach ($acct_email as $key => $value) 
                                                                                        {
                                                                                                $acct_email = $value;
                                                                                        };
                                                                        };

                                                                $headers = 'Bcc: admin@somewhere.com' . "\r\n";
                                                                $sendto = $acct_email;
                                                                $subject = "Your Login Server Password Has Been Changed";
                                                                $message = "Your Login Server password for the EQEmulator game server has been changed.  Account details:\n  username: $user\n  password: $npass\n";
                                                                unset($mailqry);
                                                                unset($qry);
                                                                unset($pwqry);

                                                                $qry = @mysql_query($register_sql, $con);
                                                                if (!$qry) 
                                                                        {
                                                                                error_s("Error changing password: " . mysql_error());
                                                                        }
                                                                else 
                                                                        {
                                                                                mail($sendto, $subject, $message, $headers);
                                                                                echo("Your password was successfully changed!");
                                                                        };

                                                                exit();
                                                       };
                                        } 
                                else 
                                        {
                                                echo($page);
                                        };

                        ?>
                </p>
</body>
</html>
Reply With Quote
  #104  
Old 04-13-2010, 01:06 PM
cubber
Discordant
 
Join Date: Apr 2006
Posts: 374
Default

Here is a modified version that was requested by Akkadius in PM.

It allows a user to input their current Public EQEmulator LS account for servers that support both login methods, so that the two servers can be synced and users can use both to login to their account. Note this is optional and if the space is left empty it will just assign the next available ID in the DB. This probably can be improved on more, I just don't have the time right now, got a baby on the way in the next week or so...

eqreq.php

Code:
<!-- EQEMu SVN Loginserver PHP Account Registration Page - By: Cubber -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict/EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>EQEmu SVN Loginserver Account Registration Page</title>

<meta name="description" content="EQEmulator SVN Loginserver Account Registration Page.">

</head>

<body>

                        <h1>EQ Registration Form</h1>
                        <p>Please fill out the form below to create a new account.</p>
                        <br />
                                
                                        <form method="post" action="insert.php">
                                        Username: <i>(Max 16 chars)</i><br />
                                                <input name="username" type="text" id="username" maxlength="16" />
                                        <br /><br />
                                        Password: <i>(Max 16 chars)</i><br />
                                                <input name="pw" type="password" id="pw" maxlength="16" />
                                        <br /><br />
                                        Confirm Password: <i>(Max 16 chars)</i><br />
                                                <input name="cpw" type="password" id="cpw" maxlength="16" />
                                        <br /><br />
                                        Email:<br />
                                                <input name="email" type="text" id="email" maxlength="50" />
                                        <br /><br />
                                        <font color=green><i>Optional</i></font><br />
                                        Current EQEmulator Pubic<br />
                                        Login Server Account Number:<br />
                                                <input name="optls" type="text" id="optls" size="10" maxlength="10" />
                                        <br /><br />
                                        <br />
                                                <input name="Submit" type="submit" value="Create Account" />
                                        </form>
                                        <br />
                                                        
                                
</body>
</html>
insert.php

Code:
<!-- EQEMu SVN Loginserver PHP Account Registration Page - By: Cubber -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict/EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>>EQEmu SVN Loginserver Account Registration Page</title>

<meta name="description" content="EQEmulator SVN Loginserver Account Registration Page.">

<head>

<body>

                <p>                             
                        <?php
                                $DB_ADDY = "localhost"; //address:port for the MySQL server
                                $DB_USER = "eqemu"; //username to login to MySQL with
                                $DB_PASS = "eqemu"; //password to login to MySQL with
                                $DB_DB = "peq"; //database name to use "peq" for default installation
                                $user = $_POST['username'];
                                $pass = $_POST['pw'];
                                $cpass = $_POST['cpw'];
                                $acct_email = $_POST['email'];
                                $optls = $_POST['optls'];
                                $headers = 'Bcc: admin@somewhere.com' . "\r\n";
                                $sendto = $acct_email;
                                $subject = "New EQ Account Created";
                                $message = "Your new account has been created on the EQEmulator Server.  Account details:\n  email: $acct_email\n  username: $user\n password: $pass\n";

                                function error_s($text) 
                                        {
                                                echo("<p>" . $text);
                                        };

                                $user_chars = "#[^a-zA-Z0-9_\-]#";
                                $email_chars = "/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[@][A-z0-9_]+([.][A-z0-9_]+)*[.][A-z]{2,4}$/";

                                if ( !isset($_POST['username']) || !isset($_POST['pw']) || !isset($_POST['cpw']) || !isset($_POST['email']) )
                                        {
                                                echo "User/Pass/Email not passed. Click <a href=eqreg.php>here</a> and try again.";
                                                return;
                                        }

                                $con = @mysql_connect($DB_ADDY, $DB_USER, $DB_PASS);
                                if (!$con) 
                                        {
                                                error_s("Unable to connect to database: " . mysql_error());
                                        };

                                if (!empty($_POST)) 
                                        {
                                                if ((empty($_POST["username"]))||(empty($_POST["pw"]))||(empty($_POST["cpw"]))||(empty($_POST["email"])) ) 
                                                        {
                                                                error_s("You did not enter all the required information.  Click <a href=eqreg.php>here</a> and try again.");
                                                                exit();
                                                        } 
                                                else 
                                                        {

                                                                $username = ($_POST["username"]);
                                                                $pw = ($_POST["pw"]);
                                                                $cpw = ($_POST["cpw"]);
                                                                $email = ($_POST["email"]);
                                                                $optls = ($_POST["optls"]);

                                                                if (strlen($username) < 5) 
                                                                        {
                                                                        error_s("Username too short.  Click <a href=eqreg.php>here</a> and try again.");
                                                                        exit();
                                                                        };

                                                                if (strlen($username) > 16) 
                                                                        {
                                                                        error_s("Username too long.  Click <a href=eqreg.php>here</a> and try again.");
                                                                        exit();
                                                                        };

                                                                if (strlen($pw) < 6) 
                                                                        {
                                                                        error_s("Password too short.  Click <a href=eqreg.php>here</a> and try again.");
                                                                        exit();
                                                                        };

                                                                if (strlen($pw) > 16) 
                                                                        {
                                                                          error_s("Password too long.  Click <a href=eqreg.php>here</a> and try again.");
                                                                        exit();
                                                                        };
                                                                if (strlen($cpw) < 6) 
                                                                        {
                                                                        error_s("Password too short.  Click <a href=eqreg.php>here</a> and try again.");
                                                                        exit();
                                                                        };

                                                                if (strlen($cpw) > 16) 
                                                                        {
                                                                          error_s("Password too long.  Click <a href=eqreg.php>here</a> and try again.");
                                                                        exit();
                                                                        };

                                                                if (strlen($email) < 10) 
                                                                        {
                                                                        error_s("Email was too short.  Click <a href=eqreg.php>here</a> and try again.");
                                                                        exit();
                                                                        };

                                                                if (strlen($email) > 50) 
                                                                        {
                                                                        error_s("Email was too long.  Click <a href=eqreg.php>here</a> and try again.");
                                                                        exit();
                                                                        };

                                                                if (preg_match($user_chars,$username)) 
                                                                        {
                                                                        error_s("Username contained illegal characters.  Click <a href=eqreg.php>here</a> and try again.");
                                                                        exit();
                                                                        };

                                                                if (preg_match($user_chars,$pw)) 
                                                                        {
                                                                        error_s("Password contained illegal characters.  Click <a href=eqreg.php>here</a> and try again.");
                                                                        exit();
                                                                        };
                                                                if (preg_match($user_chars,$cpw)) 
                                                                        {
                                                                        error_s("Password contained illegal characters.  Click <a href=eqreg.php>here</a> and try again.");
                                                                        exit();
                                                                        };

                                                                if (!preg_match($email_chars,$email)) 
                                                                        {
                                                                        error_s("Email was in an incorrect format.  Click <a href=eqreg.php>here</a> and try again.");
                                                                        exit();
                                                                        };

                                                                if ($pw != $cpw)
                                                                        {
                                                                        error_s("Passwords do not match!  Click <a href=eqreg.php>here</a> and try again.");
                                                                        exit();
                                                                        }

                                                                $username = mysql_real_escape_string($username);
                                                                $pw = mysql_real_escape_string($pw);
                                                                $email = mysql_real_escape_string($email);
                                                                $optls = mysql_real_escape_string($optls);
                                                                $qry = @mysql_query("select AccountName from " . mysql_real_escape_string($DB_DB) . ".tblLoginServerAccounts where AccountName = '" . $username . "'", $con);
                                                                if (!$qry) 
                                                                        {
                                                                        error_s("Error querying database: " . mysql_error());
                                                                        };

                                                                if ($existing_username = mysql_fetch_assoc($qry)) 
                                                                        {
                                                                        foreach ($existing_username as $key => $value) 
                                                                        {
                                                                        $existing_username = $value;
                                                                        };
                                                                        };

                                                                $existing_username = ($existing_username);
                                                                if ($existing_username == ($_POST['username'])) 
                                                                        {
                                                                        error_s("That username is already taken.  Click <a href=eqreg.php>here</a> and try again.");
                                                                        exit();
                                                                        };
                                                
                                                                unset($qry);

                                                                if($optls != "")
                                                                        {
                                                                        $lsqry = @mysql_query("select LoginServerID from " . mysql_real_escape_string($DB_DB) . ".tblLoginServerAccounts where LoginServerID = '" . $optls . "'", $con);
                                                                        if (!$lsqry) 
                                                                        {
                                                                        error_s("Error querying database: " . mysql_error());
                                                                        };

                                                                        if ($existing_lsaccount = mysql_fetch_assoc($lsqry)) 
                                                                        {
                                                                        foreach ($existing_lsaccount as $key => $value) 
                                                                        {
                                                                        $existing_lsaccount = $value;
                                                                        };
                                                                        };

                                                                        $existing_lsaccount = ($existing_lsaccount);

                                                                        if ($existing_lsaccount == ($_POST['optls'])) 
                                                                        {
                                                                        error_s("That login server account ID is already taken.  Click <a href=eqreg.php>here</a> and try again.");
                                                                        exit();
                                                                        };
                                                                        
                                                                        unset($qry);
                                                                        }

                                                                $sha_pass_hash = sha1(($pw));
                                                                if($optls == "")
                                                                        {
                                                                        $register_sql = "insert into " . mysql_real_escape_string($DB_DB) . ".tblLoginServerAccounts (AccountName,AccountPassword,AccountEmail) values ('" . $username . "','" . $sha_pass_hash . "','" . $email . "')";
                                                                        }
                                                                else
                                                                        {
                                                                        $register_sql = "insert into " . mysql_real_escape_string($DB_DB) . ".tblLoginServerAccounts (LoginServerID,AccountName,AccountPassword,AccountEmail) values ('" . $optls . "','" . $username . "','" . $sha_pass_hash . "','" . $email . "')";
                                                                        }

                                                                $qry = @mysql_query($register_sql, $con);
                                                                if (!$qry) 
                                                                        {
                                                                        error_s("Error creating account: " . mysql_error());
                                                                        }

                                                                else 
                                                                        {
                                                                        mail($sendto, $subject, $message, $headers);
                                                                        echo("Your account was successfully created!");
                                                                        }

                                                                exit();
                                                        };

                                        } 

                                else 
                                        {
                                                echo($page);
                                        };

                        ?>
                </p>

</body>
</html>
Reply With Quote
  #105  
Old 04-13-2010, 03:03 PM
cubber
Discordant
 
Join Date: Apr 2006
Posts: 374
Default

I started a googlecode page for my SVN Login Server PHP Utilities here:

https://code.google.com/p/eqemuphpls...ource/checkout

Note in the registration folder there is an eqreg.php and an eqreg_optional.php. Same with the insert files.

The optional versions are for those that want to use the dual login server version, otherwise if you don't use the public LS just use the regular version. If you do decide to use the optional version make sure to remove the _optional from both the eqreg_optional.php and insert_optional.php and rename them to just eqreg.php and insert.php, since the code within calls for those filenames.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 08:54 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3