Location: PHPKode > projects > infoboard > infoboard/_req/userinfoboard.php
<?
session_start();
include("../data/connect.php");
include("../data/_uconfig.php");
include("../_class/lang.php");
include("../_class/lang_".$iscon["getlang"].".php");
include("../_class/_func.php");
include("../_class/class.global.php");
include("../_class/class.req.php");


if(isset($_POST["submit"])) $submit=$_POST["submit"]; else $submit="";

$infoboard = new req_infoboard();
$infoboard->checksess();
$infoboard->isconnect();

		  switch($submit){
		  case"REGISTER";
		        $user=$_POST["regname"];
				$pass=$_POST["regpass"];
				$repass=$_POST["regrepass"];
				$mail=$_POST["regmail"];
				if(!$user) refback($iscon["lang"][94]);
				if(!ismail($mail)) refback($iscon["lang"][95]);
				if(strlen($user) <= 2) refback($iscon["lang"][96]);
				if($infoboard->checkkeep($user)) refback(" ".$user.$iscon["lang"][97]);

				if($infoboard->checktb("_name", "_user", "", $user)) refback(" ".$user." ".$iscon["lang"][98]);
				if($infoboard->checktb("_mail", "_user", "", $mail)) refback($iscon["lang"][12]." ".$mail." ".$iscon["lang"][98]);
				if($infoboard->checktb("_mail", "_block", "", $mail)) refback($iscon["lang"][12]." ".$mail." ".$iscon["lang"][99]);
				
				$code = $infoboard->random(10);
				$fieldname="
				_name,
				_pass,
				_mail,
				_code
				";
				$fieldvalue="
				'".addslashes($user)."',
				'".md5(addslashes($pass))."',
				'".addslashes($mail)."',
				'".$code."'
				";
				if($cid = $infoboard->tbinsert("_user", $fieldname, $fieldvalue)){
					  if($iscon["lockuser"] > 0){
						    $subject =$user.$iscon["lang"][101]." ".$iscon["website"];
							$message ="\r\n".$user.$iscon["lang"][102]." \r\n".$iscon["fullpath"]."?infoboard=active".$iscon["_s"].$user.$iscon["_s"].base64_encode($code)."\n\n";
							if($txt=$infoboard->mailto($mail, $subject, $message)){
								  refurl($iscon["lang"][103]." ".$mail."", "../");
							}else{
								  $infoboard->tbdeleteuser($cid);
								  refback($iscon["lang"][104]);
							}
					  }else{
						   refurl($iscon["lang"][105], $_SERVER['HTTP_REFERER']);
					  }
				}
		  break;
		  case"LOGIN";
		       $user=$_POST["infoname"];
			   $pass=$_POST["infopass"];
			   if($result=$infoboard->checklogin($user, md5($pass))){

				    if($iscon["lockuser"] > 0) $lockuser=$result[1]; else $lockuser=1;
				    if($lockuser == 0){
						    if($infoboard->checktb("_mail", "_block", "", $result[4])) refback($iscon["lang"][12]." ".$result[4]." ".$iscon["lang"][99]);
						    $subject =$result[2].$iscon["lang"][101]." ".$iscon["website"];
							$message ="\r\n".$result[2].$iscon["lang"][102]." \r\n".$iscon["fullpath"]."?infoboard=active".$iscon["_s"].$result[2].$iscon["_s"].base64_encode($result[5])."\n\n";
							if($txt=$infoboard->mailto($result[4], $subject, $message)){
								 refback($iscon["lang"][106]." ".$result[4]."!");
							}else{
								 refback($iscon["lang"][106]." ".$result[4]."! (".$iscon["lang"][104].")");
							}
					}else{
						  session_register("iduser");
						  $_SESSION["iduser"] = $result[0];
						  session_register("user");
						  $_SESSION["user"] = $result[2];
						  session_register("mailuser");
						  $_SESSION["mailuser"] = $result[4];
						  refurl("", $_SERVER['HTTP_REFERER']);
					}
			   }else{
				     refback($iscon["lang"][107]);
			   }
		  break;
		  case"FORGET";
		       $mail=$_POST["forgetmail"];
			   if(!ismail($mail)) refback($iscon["lang"][95]);
			   if($result=$infoboard->checkforget($mail)){

					if($iscon["lockuser"] > 0) $lockuser=$result[1]; else $lockuser=1;

				    if($lockuser == 0){
						  refback($iscon["lang"][106]." ".$result[4]."!");
					}else{
						 $subject =$result[2].$iscon["lang"][108]."  ".$iscon["website"];
						 $message ="\r\n".$iscon["lang"][109]." \r\n".$iscon["fullpath"]."?infoboard=forget".$iscon["_s"].$result[2].$iscon["_s"].base64_encode($result[5])."\n\n";
						 if($txt=$infoboard->mailto($result[4], $subject, $message)){
							  refurl(" ".$result[2].$iscon["lang"][110]." ".$result[4]."", "../");
						 }else{
							  refback($iscon["lang"][104]);
						 }
					}
			   }else{
				    refback($mail.$iscon["lang"][111]);
			   }
			   
		  break;
		  default;
		  }

$infoboard->isclose();

refurl("", "../");

?>
Return current item: infoboard