Просмотр файла motor_forum_unwors/inprof.php

Размер файла: 4.73Kb
<?php
#-----------------------------------------------------#
#          ********* WAP-MOTORS *********             #
#             Made by   :  VANTUZ                     #
#               E-mail  :  [email protected]             #
#                 Site  :  http://pizdec.ru           #
#             WAP-Site  :  http://visavi.net          #
#                  ICQ  :  36-44-66                   #
#  Вы не имеете право вносить изменения в код скрипта #
#-----------------------------------------------------#	
require_once"../template/start.php";
require_once"../template/regglobals.php";
require_once"../template/config.php";
require_once"../template/functions.php";
require_once"../template/antidos.php";
require_once"../template/gzip.php";
require_once"../template/header.php";

$text = file(BASEDIR."local/profil/$log.prof"); 
if ($text!=""){
$udata = explode(":||:",$text[0]);
$provlog=trim($udata[0]);
$provpar=trim($udata[1]);
$subnewss=$udata[34];
$randkey=$udata[35];}

if($udata[36]>=150){
if (!eregi("^[a-z0-9\._-]+@[a-z0-9\._-]+\.[a-z]{2,4}\$", $meil)){header ("Location: profil.php?isset=inmail&".SID); exit;}}
if (!empty($site) && !eregi("^(https?|ftp)://[a-z0-9\.-]+\.[a-z]{2,4}\$", $site)){header ("Location: profil.php?isset=insite&".SID); exit;} 
if (!empty($happy) && !preg_match("/^[0-9]{2}+\.[0-9]{2}+\.([0-9]{2}|[0-9]{4})$/",$happy)){header ("Location: profil.php?isset=inhappy&".SID); exit;} 


if (!$_SESSION['log']=="" && !md5($_SESSION['par'])=="" && md5($_SESSION['par'])==$provpar && $_SESSION['log']==$provlog ) {

$my_name = no_br(check($my_name));	
$otkel = no_br(check($otkel));
$infa = no_br(check($infa));
if($udata[36]>=150){$meil = htmlspecialchars(strtolower($meil));}
$site = no_br(check($site));
$mobila = no_br(check($mobila));
$ip = no_br(check($ip));
$pol = no_br(check($pol));
$rost = no_br(check($rost));
$ves = no_br(check($ves));
$happy = no_br(check($happy));
$icq= no_br(check($icq));
$podpis= no_br(check($podpis));
//------------------------------- блок подписки ----------------------------//
if($subnews=="yes"){
$lines=file("../local/sub.dat");
$count=count($lines);
for ($b=0; $b<$count; $b++) { list($mailsinbase)=explode("|",$lines[$b]); if ($meil == $mailsinbase) {
$result='error2'; //Ошибка! такой email уже есть в базе! Вы не подписаны на новости! 

$subnewss="0"; $randkey="";}}

if($result==""){
$randkey = generate_password();
$fp=fopen("../local/sub.dat","a");
flock($fp,LOCK_EX);
fputs ($fp,"$meil|$randkey|$currDate|$currTime|$log|\r\n");
fflush($fp);
flock($fp,LOCK_UN);
fclose ($fp);
chmod ($fp, 0666);
chmod ("local/sub.dat", 0666);
$result='ok'; //Вы успешно подписаны на рассылку!
 $subnewss="1"; }}

//------------------------------- блок отписки ----------------------------//
if($subnews=="no"){
$kod=$udata[35];
$lines=file("../local/sub.dat"); 
$count=count($lines);
for ($b=0; $b<$count; $b++) {$dt=explode("|",$lines[$b]); if ($dt[1]==$kod) {$jjj=$b;}}

if ($jjj=="") {$result='error'; //Произошла ошибка c отпиской от новостей
$subnewss="0"; $randkey="";}else{

$file=file("../local/sub.dat"); $i=count($file); // удаляем юзера из БД
$fp=fopen("../local/sub.dat","w");
flock ($fp,LOCK_EX);
for ($i=0; $i< sizeof($file);$i++) { if ($i==$jjj) {unset($file[$i]);} }
fputs($fp, implode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);
chmod ($fp, 0666);
chmod ("../local/sub.dat", 0666);
$result='no'; // Вы успешно отписаны от рассылки!
$subnewss="0"; $randkey="";}}
////////////////////////

//------------------------------ Запись в профиль ----------------------------//
$ufile = file(BASEDIR."local/profil/$log.prof"); 
$udata = explode(":||:",$ufile[0]);

$udata[2]=$otkel;
$udata[3]=$infa;
if($udata[36]>=150){$udata[4]=$meil;}
$udata[5]=$site;
$udata[13]=$mobila;
$udata[14]=$ip;
$udata[15]=$pol;
$udata[16]=$rost;
$udata[17]=$ves;
$udata[18]=$happy;
$udata[19]=$icq;
$udata[29]=$my_name;
$udata[34]=$subnewss;
$udata[35]=$randkey;
$udata[69]=$podpis;


for ($u=0; $u<$config_userprofkey; $u++){
$utext.=$udata[$u].':||:';}

if($udata[0]!="" && $udata[1]!="" && $udata[4]!="" && $utext!=""){
$fp=fopen(BASEDIR."local/profil/$log.prof","a+");
flock($fp,LOCK_EX);           
ftruncate($fp,0);                                                                 
fputs($fp,$utext);
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp); 
unset($utext); 
}
header ("Location: ../index.php?isset=editprofil&result=$result&".SID);

}else {header ("Location: ../index.php?isset=inputoff&".SID); exit;}
                  
?>