i have a nooby question though but that question took 5 long days of searching and looking testing bla bla to find the answer but still i couldent find it so i need your help guys .and the question is .
how come every time i try to create a user using the register page that i have and than try to log in the game it dosent work but if i created an acc using the /newacc thing it works fine the
this is the error message that appears every time i use the register page acc
here is the thing when i open the new acc that i made using the Rpage with a notepad the password in side that file is goona look like this
with the /newacc it looks like this
and another example
with Rpage
with the /newacc thing
i think its the way the COserver generate and crypt the passwords to the .usr files but i cant get to make the Register page generate the same password to the .usr file or the Game to read the passwords form the register page
the Register page code
Code:
<?php
define ("MaxNameLength", 32);
define ("WrongChars", "\r\n"); // Type other Chars, which shouldn't be in the Names, behind \r\n, but before "
define ("AccountFilesPath", "C:\OldCODB\Users\\");
define ("AccountFilesEnding", ".usr");
?>
<html>
<head>
</head>
<body><body bgcolor="Black">
<body text="Red"
<h1><center></center></h1>
<?php // New Account?
if(isset($_POST["account"]["password"])) {
// Variables
$Account = $_POST["account"];
$Password = $_POST["password"];
$Password2 = $_POST["password2"];
$AllRight = True;
if($Password == $Password2){
$NewPass = $Password;
// Wrong Chars?
For ($I=0; $I<StrLen(WrongChars); $I++) {
If (StrPos($Account, SubStr(WrongChars,$I,1))) {
Echo "<p>Your Name musn't contain the char \"".SubStr(WrongChars,$I,1)."\"</p>";
$AllRight = False;
}
}
// File Exists?
If (file_exists(AccountFilesPath.$Account.AccountFilesEnding)) {
Echo "<p>This Account already exists!</p>";
$AllRight = False;
}
// All Right?
If ($AllRight) {
// File-Data
$CrankKey = "CrankCo\n";
$CrankCoPass = "$Password ";
$Text .= " $Password ";
// Create File
File_Put_Contents (AccountFilesPath.$Account.AccountFilesEnding, $CrankCoKey); //key
File_Put_Contents (AccountFilesPath.$Account.AccountFilesEnding, $CrankCoPass, FILE_APPEND); //password
// Check File
if(!file_exists(AccountFilesPath.$Account.AccountFilesEnding)) {
echo "<p>Error!</p>";
}
echo "<p>The account was created succesfully!</p>";
}
}
else
echo "The two passwords you typed are not the same.";
}
?>
<center></FONT>
<form action="" method=post>
<label for="name">Account:<div></label> <input type=text id="name" name="account" size=20 maxlength=10/>
<br>
<label for="name">Password:<div></label> <input type=password id="password" name="password" size=20 maxlength=14/>
<br>
<label for="name">Retype password:<div></label> <input type=password id="password" name="password2" size=20 maxlength=14 />
<br>
<button type="submit">Register</button>
</form>
</body>
</center>
</html>
Code:
public static Main.AuthWorker.AuthInfo Authenticate(string User, string Password)
{
Main.AuthWorker.AuthInfo Info = new NewestCOServer.Main.AuthWorker.AuthInfo();
Info.Account = User;
try
{
while (File.Exists(@"C:\OldCODB\Users\" + User + ".usr"))
{
StreamReader SR = new StreamReader(@"C:\OldCODB\Users\" + User + ".usr");
if (SR.ReadLine().Equals("CrankCo"))
{
string _pass = SR.ReadLine();
SR.Close();
File.Delete(@"C:\OldCODB\Users\" + User + ".usr");
CreateAccount(User, _pass, "");
}
else
{
SR.Close();
}
FileStream FS = new FileStream(@"C:\OldCODB\Users\" + User + ".usr", FileMode.Open);
BinaryReader BR = new BinaryReader(FS);
string RealPassword = Main.PassCrypto.EncryptPassword(Encoding.ASCII.GetString(BR.ReadBytes(BR.ReadByte())));
string[] FileCaseSensitive = Directory.GetFiles(@"C:\OldCODB\Users\", User + ".usr");
string RealAccount = Path.GetFileNameWithoutExtension(FileCaseSensitive[0]);
if (RealPassword == Password && RealAccount == User)
{
Info.Status = Encoding.ASCII.GetString(BR.ReadBytes(BR.ReadByte()));
Info.Character = "";
if (BR.BaseStream.Position != BR.BaseStream.Length)
{
byte len = BR.ReadByte();
Info.Character = Encoding.ASCII.GetString(BR.ReadBytes(len));
}
if (Info.Character == "")
Info.LogonType = 2;
else
Info.LogonType = 1;
if (CheckBan(RealAccount))
Info.LogonType = 3;
}
else
Info.LogonType = 255;
BR.Close();
FS.Close();
return Info;
}
Info.LogonType = 255;
}
catch (Exception Exc) { Console.WriteLine(Exc); }
return Info;
}
public static void CreateAccount(string Name, string Password, string Status)
{
if (!File.Exists(@"C:\OldCODB\Users\" + Name + ".usr"))
{
FileStream FS = new FileStream(@"C:\OldCODB\Users\" + Name + ".usr", FileMode.CreateNew);
BinaryWriter BW = new BinaryWriter(FS);
BW.Write(Password);
BW.Write(Status);
BW.Close();
FS.Close();
}
}
idk is some one can fix my Register page code but any help well be appreciated
thanks for your time guys







