Забрана за долна чарта

niksdevil

Registered
Здравейте, как мога да забраня долната чарта?

Ето кодовете с който разполагам

reg.php
Код:
<?php
include("include/session.php");
include("lang/bg.lang");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
	<meta name="author" content="http://waisys.net/">
	<title><?php echo $lang['title']; ?></title>
	<link rel="shortcut icon" href="i/icon.gif">
	<link href="facefiles/facebox.css" media="screen" rel="stylesheet" type="text/css">
	<script src="facefiles/jquery-1.2.2.pack.js" type="text/javascript"></script>
	<script src="facefiles/facebox.js" type="text/javascript"></script>
	<script type="text/javascript" src="js/comment.js"></script>
	<script type="text/javascript" src="js/over.js"></script>
	<script type="text/javascript" src="js/func.js"></script>
	<script type="text/javascript" src="js/prototype.js"></script>
	<link href="i/main.css" rel="stylesheet" type="text/css">
	<?php require_once('include/function.php'); ?>
</head>
<body>
<div id="container">
<?php include('include/header.php'); ?>
<div style="padding-left:0px;">
<div id="content" style="padding-top:70px;" align="center">
<div class="register">
<?
if($session->logged_in){
print "<script>";
print "self.location=('user.php')";
print "</script>";
}
else if(isset($_SESSION['regsuccess'])){
   if($_SESSION['regsuccess']){
      echo "<center>$lang[reg_succ]";
?>

<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div class="vhodbar"></div></td>
</tr>
<tr>
<td style="padding-left:31px;"><div class="vhodpanel" align="center">
<form action="process.php" method="POST">
<table align="center" border="0" cellspacing="5" cellpadding="3">
<tr><td><input id="user" type="text" name="user" maxlength="30" value=""></td></tr><tr><td><? echo $form->error("user"); ?></td></tr>
<tr><td><input id="pass" type="password" name="pass" maxlength="30" value=""></td></tr><tr><td><? echo $form->error("pass"); ?></td></tr><tr><td align="center">
<input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?>>
<font size="2"> Запомни ме</td></tr></table>
<input type="hidden" name="sublogin" value="1">
<input type="submit" value="" id="vhod">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><font size="2"><a href="forgotpass.php" id="reg">Забравена парола?</a></font></td>
<td style="padding-left:20px;"><a href="register.php" id="reg"><font size="2">Регистрирай се!</font></a></td>
</tr>
</table>
</form>
</div></td>
</tr>
</table>

</center>
<?php  
   }
   else{
      echo "<center>Съжеляваме, но възникна проблем при Вашата регистрация. Моля опитайте по-късно !<br>Извиняваме се за причиненото Ви неудобство</center>";
   }
   unset($_SESSION['regsuccess']);
   unset($_SESSION['reguname']);
}
else{
?>

<center>
<?
if($form->num_errors > 0){
   echo "<font size=\"2\" color=\"#C10037\">".$form->num_errors." $lang[errors_num]</font>";
}
?>

<form action="process.php" method="POST">
<table align="center" border="0" cellspacing="10" cellpadding="3">
<tr><td><?php echo $lang['username']; ?>*</td><td><input id="pole" type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
<tr><td><?php echo $lang['password']; ?>*</td><td><input id="pole" type="password" name="pass" maxlength="30"></td><td><? echo $form->error("pass"); ?></td></tr>
<tr><td><?php echo $lang['password2']; ?>*</td><td><input id="pole" type="password" name="pass2" maxlength="30"></td><td><? echo $form->error("pass2"); ?></td></tr>
<tr><td><?php echo $lang['email']; ?>*</td><td><input id="pole" type="text" name="email" maxlength="50" value="<? echo $form->value("email"); ?>"></td><td><? echo $form->error("email"); ?></td></tr>

<tr><td><?php echo $lang['sex']; ?>*</td><td><?php echo $lang['man']; ?><input type="radio" name="sex" value="m">    <?php echo $lang['female']; ?><input type="radio" name="sex" value="f"></td><td><? echo $form->error("sex"); ?></td></tr>
<tr><td><?php echo $lang['fname']; ?></td><td><input id="pole" type="text" name="fname"></td></tr>
<tr><td><?php echo $lang['lname']; ?></td><td><input id="pole" type="text" name="lname"></td></tr>
<tr><td><?php echo $lang['city']; ?></td><td><input id="pole" type="text" name="city"></td></tr>
<tr><td></td><td align="center"><img src="include/CaptchaSecurityImages.php?width=100&height=40&characters=5"><br></td></tr>
<tr><td><?php echo $lang['code']; ?>*</td> <td><input id="pole" id="security_code" name="security_code" type="text"></td><td><?php echo $form->error("code"); ?></td></tr>
<tr><td>Регистрация*</td><td><input type="radio" name="sport" value="dada"><font color=red>*имам 13 години*</font>

<tr><td colspan="2" align="right">
<input type="hidden" name="subjoin" value="1">
</td></tr>
</table>
<center><input type="submit" id="reg" value=""></center>
</form>

<?
}
?>
</center></div>
<?php echo $lang['regdes']; ?>
</div>
<?php include('include/footer.php'); ?>
</div></div>
</body>
</html>

process.php
Код:
<?
/**
 * Process.php
 * 
 * The Process class is meant to simplify the task of processing
 * user submitted forms, redirecting the user to the correct
 * pages if errors are found, or if form is successful, either
 * way. Also handles the logout procedure.
 *
 * Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)
 * Last Updated: August 19, 2004
 */
include("include/session.php");

class Process
{
   /* Class constructor */
   function Process(){
      global $session;
      /* User submitted login form */
      if(isset($_POST['sublogin'])){
         $this->procLogin();
      }
      /* User submitted registration form */
      else if(isset($_POST['subjoin'])){
         $this->procRegister();
      }
      /* User submitted forgot password form */
      else if(isset($_POST['subforgot'])){
         $this->procForgotPass();
      }
      /* User submitted edit account form */
      else if(isset($_POST['subedit'])){
         $this->procEditAccount();
      }
      /**
       * The only other reason user should be directed here
       * is if he wants to logout, which means user is
       * logged in currently.
       */
      else if($session->logged_in){
         $this->procLogout();
      }
      /**
       * Should not get here, which means user is viewing this page
       * by mistake and therefore is redirected.
       */
       else{
          header("Location: http://site.com/");
       }
   }

   /**
    * procLogin - Processes the user submitted login form, if errors
    * are found, the user is redirected to correct the information,
    * if not, the user is effectively logged in to the system.
    */
   function procLogin(){
      global $session, $form;
      /* Login attempt */
      $retval = $session->login($_POST['user'], $_POST['pass'], isset($_POST['remember']));
      
      /* Login successful */
      if($retval){
          header("Location: http://site.com/news.php");
      }
      /* Login failed */
      else{
         $_SESSION['value_array'] = $_POST;
         $_SESSION['error_array'] = $form->getErrorArray();
         header("Location: ".$session->referrer);
      }
   }
   
   /**
    * procLogout - Simply attempts to log the user out of the system
    * given that there is no logout form to process.
    */
   function procLogout(){
      global $session;
      $retval = $session->logout();
      header("Location: main.php");
   }
   
   /**
    * procRegister - Processes the user submitted registration form,
    * if errors are found, the user is redirected to correct the
    * information, if not, the user is effectively registered with
    * the system and an email is (optionally) sent to the newly
    * created user.
    */
   function procRegister(){
      global $session, $form;
      /* Convert username to all lowercase (by option) */
      if(ALL_LOWERCASE){
         $_POST['user'] = strtolower($_POST['user']);
      }
      /* Registration attempt */
      $retval = $session->register($_POST['user'], $_POST['pass'], $_POST['pass2'], $_POST['email'], $_POST['sex'], $_POST['fname'], $_POST['lname'], $_POST['city'], $_SESSION['security_code'], $_POST['security_code']);

      /* Registration Successful */
      if($retval == 0){
         $_SESSION['reguname'] = $_POST['user'];
		 $usernameget = $_POST['user'];
         $_SESSION['regsuccess'] = true;
         header("Location: ".$session->referrer);
	
      }
      /* Error found with form */
      else if($retval == 1){
         $_SESSION['value_array'] = $_POST;
         $_SESSION['error_array'] = $form->getErrorArray();
         header("Location: ".$session->referrer);
      }
      /* Registration attempt failed */
      else if($retval == 2){
         $_SESSION['reguname'] = $_POST['user'];
         $_SESSION['regsuccess'] = false;
         header("Location: ".$session->referrer);
      }
   }
   
   /**
    * procForgotPass - Validates the given username then if
    * everything is fine, a new password is generated and
    * emailed to the address the user gave on sign up.
    */
   function procForgotPass(){
      global $database, $session, $mailer, $form;
      /* Username error checking */
      $subuser = $_POST['user'];
      $field = "user";  //Use field name for username
      if(!$subuser || strlen($subuser = trim($subuser)) == 0){
         $form->setError($field, "* Username not entered<br>");
      }
      else{
         /* Make sure username is in database */
         $subuser = stripslashes($subuser);
         if(strlen($subuser) < 5 || strlen($subuser) > 30 ||
            !eregi("^([0-9a-z])+$", $subuser) ||
            (!$database->usernameTaken($subuser))){
            $form->setError($field, "* Username does not exist<br>");
         }
      }
      
      /* Errors exist, have user correct them */
      if($form->num_errors > 0){
         $_SESSION['value_array'] = $_POST;
         $_SESSION['error_array'] = $form->getErrorArray();
      }
      /* Generate new password and email it to user */
      else{
         /* Generate new password */
         $newpass = $session->generateRandStr(8);
         
         /* Get email of user */
         $usrinf = $database->getUserInfo($subuser);
         $email  = $usrinf['email'];
         
         /* Attempt to send the email with new password */
         if($mailer->sendNewPass($subuser,$email,$newpass)){
            /* Email sent, update database */
            $database->updateUserField($subuser, "password", md5($newpass));
            $_SESSION['forgotpass'] = true;
         }
         /* Email failure, do not change password */
         else{
            $_SESSION['forgotpass'] = false;
         }
      }
      
      header("Location: ".$session->referrer);
   }
   
   /**
    * procEditAccount - Attempts to edit the user's account
    * information, including the password, which must be verified
    * before a change is made.
    */
   function procEditAccount(){
      global $session, $form;
      /* Account edit attempt */
			$retval = $session->editAccount($_POST['curpass'], $_POST['newpass'], strip_tags($_POST['email']), strip_tags($_POST['fname']), strip_tags($_POST['lname']), strip_tags($_POST['day']), strip_tags($_POST['month']), 
			strip_tags($_POST['year']), strip_tags($_POST['city']), 
strip_tags($_POST['sex']), strip_tags($_POST['sport']), strip_tags($_POST['movie']), strip_tags($_POST['music']), 
strip_tags($_POST['book']), strip_tags($_POST['eyes']), strip_tags($_POST['drink']), strip_tags($_POST['smoke']), 
strip_tags($_POST['rast']), strip_tags($_POST['teglo']), strip_tags($_POST['views']), strip_tags($_POST['info']));

      /* Account edit successful */
      if($retval){
         $_SESSION['useredit'] = true;
         header("Location: ".$session->referrer);
      }
      /* Error found with form */
      else{
         $_SESSION['value_array'] = $_POST;
         $_SESSION['error_array'] = $form->getErrorArray();
         header("Location: ".$session->referrer);
      }
   }
};

/* Initialize process */
$process = new Process;

?>
 
И по кое описание трябваше да се разбере, че е долната черта при регистрация на потребител или ти щом знаеш, че е тя и всички във форума знаят?!?!?! Та и на всичкото отгоре се нервиш като зададох въпроса за коя долна "чарта" става въпрос.

замени тоя целия метод


Код:
function procRegister(){
      global $session, $form;
      /* Convert username to all lowercase (by option) */
      if(ALL_LOWERCASE){
         $_POST['user'] = strtolower($_POST['user']);
         $_POST['user'] = eregi("^[a-z0-9]+$", $_POST['user']);
      }
      /* Registration attempt */
      $retval = $session->register($_POST['user'], $_POST['pass'], $_POST['pass2'], $_POST['email'], $_POST['sex'], $_POST['fname'], $_POST['lname'], $_POST['city'], $_SESSION['security_code'], $_POST['security_code']);

      /* Registration Successful */
      if($retval == 0){
         $_SESSION['reguname'] = $_POST['user'];
       $usernameget = $_POST['user'];
         $_SESSION['regsuccess'] = true;
         header("Location: ".$session->referrer);
   
      }
      /* Error found with form */
      else if($retval == 1){
         $_SESSION['value_array'] = $_POST;
         $_SESSION['error_array'] = $form->getErrorArray();
         header("Location: ".$session->referrer);
      }
      /* Registration attempt failed */
      else if($retval == 2){
         $_SESSION['reguname'] = $_POST['user'];
         $_SESSION['regsuccess'] = false;
         header("Location: ".$session->referrer);
      }
   }
 

Back
Горе