Jump to content
  • 0

[Request]ACM files for my website


gim

Question

3 answers to this question

Recommended Posts

  • 0
<?php

$mysql_host = "127.0.0.1";
$mysql_user = "root";
$mysql_passwd = "root";
$mysql_db = "l2jdb";

?>

<script type="text/javascript">//<![CDATA[
function isAlphaNumeric(value)
{
  if (value.match(/^[a-zA-Z0-9]+$/))
    return true;
  else
    return false;
}
function checkform(f)
{
  if (f.account.value=="")
  {
    alert("You have not entered a user name!");
    return false;
  }
  if (!isAlphaNumeric(f.account.value))
  {
    alert("Fill in all fields! Only alphanumeric characters!");
    return false;
  }
  if (f.password.value=="")
  {
    alert("You have not entered a password!");
    return false;
  }
  if (!isAlphaNumeric(f.password.value))
  {
    alert("444444");
    return false;
  }
  if (f.password2.value=="")
  {
    alert("You have not repeated the password!");
    return false;
  }
  if (f.password.value!=f.password2.value)
  {
    alert("The two password is not the same!");
    return false; 
  }
}
//]]></script>
<?php

$formtable = '
<form method="post" onsubmit="return checkform(this)">
<table>
<tr>
  <td><b><font color="#000000">Username:</font></b></td>
  <td><font face="Trebuchet MS" size="1"><b>
  <input type="text" name="account" maxlength="15" size="30" /></b></font></td>
</tr>
<tr>
  <td><b><font color="#000000">Password:</font></b></td>
  <td><font face="Trebuchet MS" size="1"><b>
  <input type="password" name="password" maxlength="15" size="30" /></b></font></td>
</tr>
<tr>
  <td><b><font color="#000000">Password Repty:</font></b></td>
  <td><font face="Trebuchet MS" size="1"><b>
  <input type="password" name="password2" maxlength="15" size="30" /></b></font></td>
</tr>
<tr>
  <td colspan="2" style="text-align: center;">
  <font size="1" face="Trebuchet MS"><b><br />
  <input type="submit" name="submit" value="Register" /></b></font></td>
</tr>
</table>
</form>
<br>
<center></center>
';
mysql_connect($mysql_host, $mysql_user, $mysql_passwd) or die ("Nem sikerült csatlakozni a MySQL szerverhez!");
mysql_select_db($mysql_db) or die("Nincs ilyen adatbázis: mySQL_database "); 

$bannedip=mysql_num_rows(mysql_query("SELECT * FROM accounts WHERE accessLevel='-100' and lastIP='".$_SERVER['REMOTE_ADDR']."'"));
if($bannedip<1){
if (isset($_POST['submit'])) {
    $error_str = '';
    if (!empty($error_str)) {
    print "<b><font color=red>Következő hibák léptek fel:</font></b><br>".$error_str."<br>".$formtable;
    exit; // die
    }
    $acc=mysql_num_rows(mysql_query("SELECT * FROM accounts WHERE login='".$_POST['account']."'"));
if( $acc > "0" ){ 
print '<p class="error"><b><font color=red>This name is already in use!</font></b></h2></p>';
} else { 
print'<p class="error"><b><font color=green>Registration Success!Have a good game! </font></b></h2></p>';
mysql_query ("INSERT INTO accounts (login, password, accessLevel) VALUES ('".$_POST['account']."', '".base64_encode(pack('H*', sha1($_POST['password'])))."', 0)");
     }
    } else { print $formtable; }
    } else {
    print '<p class="error"><b><font color=red>Sorry, but you cannot register!</font></b></h2></p>';
mysql_query ("UPDATE accounts SET accessLevel = '-100' WHERE accessLevel>='0' and lastIP='".$_SERVER['REMOTE_ADDR']."'");
}
?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock