pass: $vars[pass], must: ".my_decrypt($row[1],$SECRET_STRING); $row=mysql_fetch_row($result); if($vars[pass] != my_decrypt($row[1],$SECRET_STRING))// || $row[3]=='d' return false; setcookie('id',$row[0]); $GLOBALS['vars']['id']=$row[0]; $GLOBALS['vars']['status'] = $row[3]; setcookie('login', $vars[login]); setcookie('id_hash',crypt($row[0].$SECRET_STRING,$SECRET_STRING)); $msg=''; return true; } //-- END: authorize /** * Gets the filesize of a remotely located file * * @access public * @param string $url URL to file * @return integer filesize in bytes */ function getRemoteSize($url) { $u=parse_url($url); $text=''; if (!$u[port]) $u[port]=80; $size=0; if($fp=fsockopen($u[host],$u[port],$errno,$errstr,30)) { $request="HEAD $u[path] HTTP/1.0\015\012"; $request.="Host: {$u[host]}\015\012"; $request.="\015\012"; fputs($fp,$request); $buf=fread($fp, 1024); if (preg_match("/Content-Length:\s(\d+)/",$buf,$match)) $size=$match[1]; fclose($fp); } return $size; } function getlink() { global $vars,$PATH_TPL; echo "Please send your traffic to $GLOBALS[URL_IN]?$vars[login]
"; if (is_file("$PATH_TPL/wmbanner.txt")) readfile("$PATH_TPL/wmbanner.txt"); } //-- BEGIN: check_field_values function check_field_values() { global $vars, $msg, $field_errors, $HTTP_POST_FILES; $ok=true; if($vars[go]=='new' && $vars[agree]!='on') { $msg.='You must agree with our terms
'; $ok=false; } $allowed_symbols='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; $is_banned=0; for($i=0;$i','=',"\'",'"','/',"\\",'&','`','$','[',']','_','-'); $vars[title]=preg_replace("/([<>\=\\\"\/\&\`\$\[\]\_\-\#])+/","$1",$vars[title]); $vars[title]=preg_replace("/(\.\.)+/","$1",$vars[title]); $vars[title]=preg_replace("/(<>=\\\"\/&`\$\[\]_-){2,}/","\\$1",$vars[title]); $vars[title]=str_replace($forbsyms,'',$vars[title]); $vars[description]=str_replace($forbsyms,'',$vars[description]); $vars[wm_email]=strtolower($vars[wm_email]); $vars[url]=str_replace(array('"',' ', '<', '>', "'"),'', $vars[url]); if (isset($vars['url_banner'])) { $vars['url_banner'] = str_replace(array('"',' ', '<', '>', "'"),'', $vars['url_banner']); } if (isset($vars['url_sample'])) { $vars['url_sample'] = str_replace(array('"',' ', '<', '>', "'"),'', $vars['url_sample']); } $result=db_query('SELECT word,type FROM bans'); while($row=mysql_fetch_row($result)) { if (empty($row[0])) continue; $wordlen=strlen($row[0]); if ($row[1]=='u') { if (strpos($vars[url],$row[0])!==false) { $is_banned=1; $field_errors[url]='banned'; } } elseif ($row[1]=='b') { if ($vars[url_banner] && strpos($vars[url_banner],$row[0])!==false) { $is_banned=1; $field_errors[url_banner]='banned'; } if ($vars[url_sample] && strpos($vars[url_sample],$row[0])!==false) { $is_banned=1; $field_errors[url_sample]='banned'; } } elseif ($row[1]=='e') { if (strpos($vars[wm_email],$row[0])!==false) { $is_banned=1; if (strpos($row[0],'@')==0) $field_errors[wm_email]=$row[0].' banned'; else $field_errors[wm_email]='banned'; } } else { if ($vars[go]=='new' && strcasecmp($vars[login],$row[0])==0) { $is_banned=1; $field_errors[login]='banned'; } if ($end=stristr($vars[description],$row[0])) { $vars[description]=substr_replace($vars[description],'',strlen($vars[description])-strlen($end),$wordlen); $field_errors[description]='censored'; } if ($end=stristr($vars[title],$row[0])) { $vars[title]=substr_replace($vars[title],'',strlen($vars[title])-strlen($end),$wordlen); $field_errors[title]='censored'; } } } if ($is_banned) { $msg.="Error: information you submitted is banned"; return false; } // проверяем мыло на корректность if (!preg_match("/([\w.\-_]+)@([\w.\-_]+)\.(\w{2,4})$/i",$vars[wm_email])) $field_errors[wm_email]='not correct'; // добавляем пробел после знака препинания $vars[title]=preg_replace("/([,.])(\w)/","$1 $2",$vars[title]); $vars[description]=preg_replace("/([,.])(\w)/","$1 $2",$vars[description]); // checking fields for emptyness $fields_list=array('url','title','description','wm_email'); if ($vars[go]=='new') array_push($fields_list,'login','pass','wm_email'); foreach($fields_list as $param) if($vars[$param]=='') $field_errors[$param]='empty'; // add http:// if ($vars[url] && substr($vars[url],0,7)!='http://') $vars[url]='http://'.$vars[url]; if ($vars[url_banner] && substr($vars[url_banner],0,7)!='http://') $vars[url_banner]='http://'.$vars[url_banner]; if ($vars[url_sample] && substr($vars[url_sample],0,7)!='http://') $vars[url_sample]='http://'.$vars[url_sample]; if ($vars[url]) { $h=parse_url($vars[url]); if ($h[path]=='') $vars[url].='/'; } if ($GLOBALS[ASK_RECIP] && $vars[url_recip]) { if (substr($vars[url_recip],0,7)!='http://') $vars[url_recip]='http://'.$vars[url_recip]; $h=parse_url($vars[url_recip]); if ($h[path]=='') $vars[url_recip].='/'; } // checking for existence of same login if($vars[go]=='new' && !$field_errors[login]) { $result=db_query("SELECT id FROM accounts_s WHERE login='{$vars[login]}'"); if(mysql_num_rows($result)) { $field_errors[login]='error'; $msg.='Error: requested login is already taken
'; } } if ($GLOBALS['DESC_TITLE_LENGTH'] && strlen($vars[title]) > $GLOBALS['DESC_TITLE_LENGTH']) $vars[title] = substr($vars[title], 0, $GLOBALS['DESC_TITLE_LENGTH']); if ($GLOBALS['DESC_DESC_LENGTH'] && strlen($vars[description]) > $GLOBALS['DESC_DESC_LENGTH']) $vars[description] = substr($vars[description], 0, $GLOBALS['DESC_DESC_LENGTH']); if ($GLOBALS[UNCAPITALIZE]) { $vars[title]=ucfirst(strtolower($vars[title])); $vars[description]=ucfirst(strtolower($vars[description])); } // checking sample parameters if($GLOBALS[SAMPLE_SHOW]) { if($vars[sample_width]<=0 || $vars[sample_width]>$GLOBALS[SAMPLE_MAX_WIDTH]) $field_errors[sample_width]='incorrect'; if($vars[sample_height]<=0 || $vars[sample_height]>$GLOBALS[SAMPLE_MAX_HEIGHT]) $field_errors[sample_height]='incorrect'; if($field_errors[sample_height] !='' || $field_errors[sample_width] !='') { $msg.="Your sample cannot be larger {$GLOBALS[SAMPLE_MAX_WIDTH]}x{$GLOBALS[SAMPLE_MAX_HEIGHT]}
"; $ok=false; } } if ($vars[url]) { $url=mysql_escape_string($vars[url]); $q="SELECT login FROM accounts_s AS a LEFT JOIN accounts_u AS u ON(a.id=u.id) WHERE a.login<>'$vars[login]' AND (a.url='$url' OR u.url='$url')"; $result=db_query($q); if (mysql_num_rows($result)>0) $field_errors[url]='duplicate'; } if ($GLOBALS[BANNERS_SHOW]) { // check uploaded banner $banner_bad=0; if ($GLOBALS[BANNERS_UPLOAD]) { if ($HTTP_POST_FILES[bannerupl][tmp_name] && is_uploaded_file($HTTP_POST_FILES[bannerupl][tmp_name])) { if ($HTTP_POST_FILES[bannerupl][size]>($GLOBALS[BANNERS_LENGTH]*1024)) { $msg.="Banner is too large(must be no greater {$GLOBALS[BANNERS_LENGTH]}Kb)"; $ok=false; } else { $bansize=@getimagesize($HTTP_POST_FILES[bannerupl][tmp_name]); if ($bansize==NULL) { $msg.="Cannot download banner
"; $ok=false; } elseif ($bansize[2]<1 || $bansize[2]>3) { $msg.="Type of the banner is not recognized(required GIF or JPG)
"; $ok=false; } else { $exts=array(1=>'gif',2=>'jpg',3=>'png'); if (!is_dir($GLOBALS[PATH_BANNERS])) mkdir($GLOBALS[PATH_BANNERS],0666); $filename="$vars[login].{$exts[$bansize[2]]}"; // проверяем уникальность баннера if ($GLOBALS[BANNERS_UPLOADUNIQ]) { if($dir=opendir($GLOBALS[PATH_BANNERS])) { while(($file=readdir($dir))!==false) { if (is_file("{$GLOBALS[PATH_BANNERS]}$file") && $file!=$filename) { if (filesize("{$GLOBALS[PATH_BANNERS]}$file")==$HTTP_POST_FILES[bannerupl][size]) { $msg.="Banner similar to yours is already used by another webmaster
"; $ok=false; $banner_bad=1; break; } } } closedir($dir); } } if ($banner_bad==0) { // всё ок, добавляем move_uploaded_file($HTTP_POST_FILES[bannerupl][tmp_name],$GLOBALS[PATH_BANNERS].$filename); chmod($GLOBALS[PATH_BANNERS].$filename,0666); $vars[url_banner]=$GLOBALS[URL_BANNERS].$filename; } } } } } else {// был указан баннер if ($vars['url_banner'] && preg_match("/(jpg)|(jpeg)|(gif)|(png)$/i",$vars[url_banner],$match)==0) { $msg.="Banner must have JPG, JPEG, GIF or PNG extension
"; $field_errors[url_banner]='error'; $ok=false; } if ($vars['url_banner'] && $GLOBALS[BANNERS_CHECKSIZE] && !$field_errors[url_banner]) { $bansize=getRemoteSize($vars[url_banner]); if ($bansize==0) { $field_errors[url_banner]='error'; $msg.="Cannot download banner
"; $ok=false; } if ($GLOBALS[BANNERS_SIZE]>0 && $bansize>$GLOBALS[BANNERS_SIZE]*1024) { $bansize=round($bansize/1024); $field_errors[url_banner]='error'; $msg.="Your banner is $bansize Kb(Maximum size is $GLOBALS[BANNERS_SIZE] Kb)
"; $ok=false; } $bansize=@getimagesize($vars[url_banner]); if ($bansize==NULL) { $field_errors[url_banner]='error'; $msg.="Cannot download banner
"; $ok=false; } elseif ($bansize[2]>=1 && $bansize[2]<=3) { if ($bansize[0]!=$GLOBALS[BANNERS_WIDTH] || $bansize[1]!=$GLOBALS[BANNERS_HEIGHT]) { $field_errors[url_banner]='error'; $msg.="Your banner is {$bansize[0]}x{$bansize[1]}(required {$GLOBALS[BANNERS_WIDTH]}x{$GLOBALS[BANNERS_HEIGHT]})
"; $ok=false; } } else { $field_errors[url_banner]='error'; $msg.="Type of the banner is not recognized(required GIF or JPG)
"; $ok=false; } } } if ($vars[url_banner]=='') $vars[url_banner]=$GLOBALS[BANNERS_DEFAULT]; } // check back link if ($GLOBALS[BACK_REQUIRED]) { include_once('admin/check.inc.php'); if (!get_url($vars[url_recip],$GLOBALS[URL_MAIN])) { if (!get_url($vars[url],$GLOBALS[URL_MAIN])) { $msg.='Back link not found'; $ok=false; } } $vars[backlink]=1; $vars[backchecked]=time(); } if(count($field_errors)>0) { $msg.='Errors found. Please check your submission'; $ok=false; } return $ok; } //-- END: check_field_values //-- BEGIN: show_login_form function show_login_form() { global $vars, $msg; DisplayMessage($msg); echo "
Please enter your login and password
Login:
Password:
Action:

Register new account"; } //-- END: show_login_form //-- BEGIN: show_details_form function show_details_form($details=false) { global $vars, $field_errors, $PATH_TPL, $GLOBALS; if($details[status]=='s') echo "
Your account is suspended.
Possible reason: {$GLOBALS[REASON_SUSP][$details[s_r]]}"; if($vars[go]=='new') readfile("$PATH_TPL/rules.txt"); if ($GLOBALS[BANNERS_UPLOAD]) echo "
"; else echo ""; echo "".($vars[go]=='modify'?"":'').""; if($vars[go]=='new') { echo ""; } if($GLOBALS[ASK_NICK]) { echo ""; } echo ""; if($GLOBALS[ASK_ICQ]) { echo ""; } echo ""; if ($GLOBALS[ASK_FAKEURL]) { echo ""; } if ($GLOBALS[ASK_RECIPURL]) { echo ""; } if ($GLOBALS[BANNERS_SHOW]) { if ($GLOBALS[BANNERS_UPLOAD]) echo ""; else echo ""; } if ($GLOBALS[SAMPLE_SHOW]) { echo ""; } if ($GLOBALS[USE_CATEGORIES]) { $m=db_query("SELECT id,name FROM cats ORDER BY name"); if (mysql_num_rows($m)) { echo ""; } } echo "
 I agree
Login(At most 10 symbols) ".($field_errors[login]?"{$field_errors[login]}":'')."
Nickname ".($field_errors[wm_nick]?"{$field_errors[wm_nick]}":'')."
E-mail ".($field_errors[wm_email]?"{$field_errors[wm_email]}":'')."
ICQ ".($field_errors[wm_icq]?"{$field_errors[wm_icq]}":'')."
Site URL ".($field_errors[url]?"{$field_errors[url]}":'')."
Site title ".($field_errors[title]?"{$field_errors[title]}":'')."
Site description ".($field_errors[description]?"{$field_errors[description]}":'')."
Fake URL ".($field_errors[url_fake]?"{$field_errors[url_fake]}":'')."
Recip URL ".($field_errors[url_recip]?"{$field_errors[url_recip]}":'')."
Upload banner(Size less {$GLOBALS[BANNERS_LENGTH]}Kb and {$GLOBALS[BANNERS_WIDTH]}x{$GLOBALS[BANNERS_HEIGHT]} only)
Banner URL({$GLOBALS[BANNERS_WIDTH]}x{$GLOBALS[BANNERS_HEIGHT]} only) ".($field_errors[url_banner]?"{$field_errors[url_banner]}":''),"
Sample URL ".($field_errors[url_sample]?"{$field_errors[url_sample]}":'')."
Sample width ".($field_errors[sample_width]?"{$field_errors[sample_width]}":'')."
Sample height ".($field_errors[sample_height]?"{$field_errors[sample_height]}":'')."
Category
Password ".($field_errors[pass]?"{$field_errors[pass]}":'')."
"; if ($GLOBALS[SUPEND_NEW_BANNERS] && $details[b_a]=='n') { echo "
Your banner is not allowed to be shown. Please contact webmaster."; } echo "

"; echo "
"; if($vars[go]=='modify') { if ($details[url_banner]) echo "Your current banner

"; echo "
Send your traffic to: $GLOBALS[URL_IN]?$details[login]"; } } //-- END: show_details_form function show_header() { global $vars, $status_line, $msg; $title='

'; $menu=''; if($vars[go]=='modify') { $title.="Account details

"; $menu.='view statistics '; } elseif($vars[go]=='new') $title.='Creating new account'; elseif($vars[go]=='stat') { $title.='Account statistics'; $menu.='edit details '; } else $title.=''; if($vars[go]=='modify' || $vars[go]=='stat') $menu.='| logout'; echo "$title$menu
$status_line"; DisplayMessage($msg); } //-- END: show header function show_old_approved() { global $accounts_s_details, $vars; echo "
"; if ($GLOBALS[ASK_NICK]) echo ""; if ($GLOBALS[ASK_ICQ]) { echo ""; } echo ""; if ($GLOBALS[SAMPLE_SHOW]) echo ""; echo "
Your old approved information
Nickname$accounts_s_details[wm_nick]
ICQ ".($accounts_s_details[wm_icq]?$accounts_s_details[wm_icq]:'')."
Site URL $accounts_s_details[url]
Title $accounts_s_details[title]
Description $accounts_s_details[description]
Banner URL $accounts_s_details[url_banner]
Sample URL$accounts_s_details[url_sample]
"; } //-- END: show_old_approved function show_account_created() { global $vars; echo 'Congratulations! Your information has been recorded.
'; if ($GLOBALS[SUSPEND_NEW]) echo 'Your account will be reviewed by the administrator as soon as possbile.'; else echo 'You may begin sending hits to our toplist.'; echo "


Here is the information you submitted:

"; if ($GLOBALS[ASK_NICK]) { echo ""; } echo ""; if ($GLOBALS[ASK_ICQ]) { echo ""; } echo ""; if ($GLOBALS[ASK_FAKEURL]) { echo ""; } if ($GLOBALS[ASK_RECIPURL]) { echo ""; } echo ""; if ($GLOBALS[BANNERS_SHOW]) { echo ""; } echo "
Login: $vars[login]
Password: $vars[pass]
Nickname: $vars[wm_nick]
E-mail: $vars[wm_email]
ICQ: $vars[wm_icq]
Site URL: $vars[url]
Fake URL: $vars[url_fake]
Recip URL: $vars[url_recip]
Description: $vars[description]
Site title: $vars[title]
Banner URL: $vars[url_banner]

Linking information
Place the link on your site that points to:
{$GLOBALS[URL_IN]}?{$vars[login]}

If you need to make changes to your account, or want
to see your statistics use the following direct links:
For statistics click at: {$GLOBALS[URL_ACCOUNTS]}?go=stat&login={$vars[login]}&pass={$vars[pass]}
For make changes click at : {$GLOBALS[URL_ACCOUNTS]}?go=modify&login={$vars[login]}&pass={$vars[pass]}

Account has been created at ".TimeToStr(time())."
"; } //-- END: show_account_created function fetch_account_statistic() { global $msg, $vars,$RANK_OUTGROW; $today_start=TodayStart(); $query="SELECT ". "SUM(IF(time>=$today_start,raw,0)) as raw_today, ". "SUM(IF(time>=$today_start,sent_in,0)) as in_today, ". "SUM(IF(time>=$today_start,sent_out,0)) as out_today, ". "SUM(raw) as raw_total, ". "SUM(sent_in) as in_total, ". "SUM(sent_out) as out_total ". "FROM stat WHERE id_acc='{$vars[id]}'"; if ($RANK_OUTGROW<1) $RANK_OUTGROW=1; $resultday=db_query("SELECT SUM(raw),SUM(sent_in),SUM(sent_out) FROM daystat WHERE id_acc='{$vars[id]}'"); list($raw,$sent_in,$sent_out)=mysql_fetch_row($resultday); if(!($result=db_query($query))) { $msg='Error: cannot fetch statistics info'; return false; } else { $array=mysql_fetch_array($result); $array[raw_total]+=0+$raw; $array[in_total]+=0+$sent_in; $array[out_total]+=0+$sent_out; $array[out_total]=0+$array[out_total]>1?(int)($array[out_total]*$RANK_OUTGROW):$array[out_total]; $array[out_today]=0+$array[out_today]>1?(int)($array[out_today]*$RANK_OUTGROW):$array[out_today]; $array[raw_today]+=0; $array[in_today]+=0; $array[out_today]+=0; return $array; } } function show_statistic($array) { $today_start=TodayStart(); global $vars; // Current rank if($result=db_query("SELECT rank FROM rank WHERE id_acc='{$vars[id]}' LIMIT 1")) { list($rank)=mysql_fetch_row($result); if ($rank>0) echo "Current rank: $rank

"; } // $ts_string=substr($today_start,3,2).".".substr($today_start,1,2).".200".substr($today_start,0,1)." ".substr($today_start,5).":00"; echo "

Since ".OurTimeToStr($today_start).''.($GLOBALS[RANK_RESET]?"
(Last {$GLOBALS[RANK_RESET]}h)":'')."

Raw hits $array[raw_today]
In$array[in_today]
Out$array[out_today]
Ratio ".($array[in_today]?round($array[out_today]*100/$array[in_today]):'0')."%

Total

Raw $array[raw_total]
In $array[in_total]
Out $array[out_total]
Ratio ".($array[in_total]?round($array[out_total]*100/$array[in_total]):'0')."%
"; } //-- END: show_statistic function create() { global $fields_checked, $vars, $SUSPEND_NEW, $SUSPEND_NEW_BANNERS, $saved; if ($vars[change]=='yes') { if($fields_checked=check_field_values()) { // echo join(',',$vars); $vars[review]=1; if($SUSPEND_NEW) $vars[status]='s'; else $vars[status]='a'; if($SUSPEND_NEW_BANNERS) $vars[b_a]='n'; else $vars[b_a]='y'; $vars[signup_date]=time(); $vars[pass_hash]=my_crypt($vars[pass],$GLOBALS[SECRET_STRING]); // saving $a_s_fields=array( 'login', 'wm_nick', 'wm_icq', 'wm_email', 'url', 'description', 'title', 'url_fake', 'url_recip', 'url_banner', 'url_sample', 'sample_width', 'sample_height', 'id_cat', 'signup_date', 'status', 'pass_hash', 'review', 'b_a'); if ($GLOBALS[BACK_CHECK]) { $a_s_fields[]='backlink'; $a_s_fields[]='backchecked'; } $query="INSERT INTO accounts_s(".join(',',$a_s_fields).") VALUES("; $first=true; foreach($a_s_fields as $field) { if($first) $first=false; else $query.=', '; $query.="'".addslashes($vars[$field])."'"; } $query.=')'; // echo $query; $result=db_query($query); if(!$result) { $msg="Sorry, unable to create account. Try later"; return false; } else { $saved=1; $vars[id]=mysql_insert_id(); // sending emails send_email('add',$vars); if ($GLOBALS[SENDMAILNEW]) send_email('add_admin',$vars); } } show_header(); if($saved) show_account_created(); else show_details_form($vars); } else show_details_form(); } // -- 'modify' functions function modify() { global $accounts_s_details, $fields_checked, $vars, $SUSPEND_NEW, $SUSPEND_NEW_BANNERS,$msg; $fields_checked=false; $loadfromdb=true; show_header(); if ($vars[change]=='yes') { if($fields_checked=check_field_values()) { $accounts_s_details=load_details('accounts_s', $vars[id]); if ($accounts_s_details[review]) $review=$accounts_s_details[review]; else $review=2; $accounts_u_details=load_details('accounts_u', $vars[id]); if ($SUSPEND_NEW) $u_data=$vars; else $u_data=$accounts_s_details; /* $vars[b_a]=$accounts_s_details[b_a]; if ($SUSPEND_NEW_BANNERS) { if($accounts_s_details[url_banner]!=$vars[url_banner]) $vars[b_a]='n'; } */ // setting password if($vars[pass]!='') $vars[pass_hash]=my_crypt($vars[pass],$GLOBALS[SECRET_STRING]); // setting login and email $vars[login]=$accounts_s_details[login]; // $vars[wm_email]=$accounts_s_details[wm_email]; // saving old info $accounts_u_fields=array('id','url','description','title','url_fake','url_recip','url_banner'); if ($GLOBALS[USE_CATEGORIES]) { array_push($accounts_u_fields,'id_cat'); } if ($GLOBALS[SAMPLE_SHOW]) { array_push($accounts_u_fields,'url_sample'); array_push($accounts_u_fields,'sample_width'); array_push($accounts_u_fields,'sample_height'); } if (!$accounts_u_details) { $query="INSERT INTO accounts_u(".join(',',$accounts_u_fields).") VALUES("; $first=true; foreach($accounts_u_fields as $field) { if($first) $first=false; else $query.=', '; $query.="'".addslashes($u_data[$field])."'"; } $query.=')'; $result=db_query($query,1); if(!$result) { $msg="Sorry, unable to modify account. Try later"; return false; } } else { $parts=array(); foreach($accounts_u_fields as $field) { if ($SUSPEND_NEW) { if ($accounts_u_details[$field]!=$vars[$field]) {// новое изменение $parts[]="$field='".addslashes($vars[$field])."'"; } } else { if ($accounts_s_details[$field]!=$vars[$field]) {// новое изменение $parts[]="$field='".addslashes($accounts_s_details[$field])."'"; } } } if (count($parts)) { $query="UPDATE accounts_u SET ".join(',',$parts)." WHERE id='{$vars[id]}'"; $result=db_query($query); if(!$result) { $msg="Sorry, unable to modify account. Try later"; return false; } } } ///////////////////////////////////////// // Saving accounts_s $parts=array("review='$review'"); if ($GLOBALS[ASK_NICK] && $accounts_s_details[wm_nick]!=$vars[wm_nick]) $parts[]="wm_nick='$vars[wm_nick]'"; if ($GLOBALS[ASK_ICQ] && $accounts_s_details[wm_icq]!=$vars[wm_icq]) $parts[]="wm_icq='$vars[wm_icq]'"; if ($vars[pass_hash]) $parts[]="pass_hash='$vars[pass_hash]'"; if ($vars[wm_email]) $parts[]="wm_email='$vars[wm_email]'"; if ($SUSPEND_NEW && $accounts_s_details[status]=='a') { } else { if ($SUSPEND_NEW_BANNERS && $accounts_s_details[url_banner]!=$vars[url_banner]) $parts[]="b_a='n'"; foreach($accounts_u_fields as $field) { if ($accounts_s_details[$field]!=$vars[$field]) {// новое изменение $parts[]="$field='".addslashes($vars[$field])."'"; } } } if (count($parts)) { $query="UPDATE accounts_s SET ".join(',',$parts)." WHERE id='{$vars[id]}'"; $result=db_query($query); if(!$result) { DisplayMessage('Sorry, unable to modify account. Try later'); return false; } $msg='All changes have been saved successfully'; // sending email to admin if ($GLOBALS[SENDMAILCHANGED]) send_email('edit_admin',$vars); } /* // make saving action if($keys_changed || $accounts_u_details) { $result=save_details($vars, 'accounts_s', $vars['id'], true); $result&=save_details($vars, 'accounts_u', $vars['id']); } else $result=save_details($vars, 'accounts_s', $vars['id']); if($result) { $msg='All changes have been saved successfully'; // sending email to admin send_email('edit_admin',$vars); } else $msg="Error: cannot save changes"; */ } else $loadfromdb=false; } DisplayMessage($msg); if ($loadfromdb) { $accounts_s_details=load_details('accounts_s', $vars[id]); if($SUSPEND_NEW) { $accounts_u_details=load_details('accounts_u', $vars['id']); if ($accounts_u_details) show_old_approved(); show_details_form(array_merge($accounts_s_details, $accounts_u_details), $field_errors); } else show_details_form($accounts_s_details, $field_errors); } else { show_details_form($vars, $field_errors); } } function show_deleted() { global $vars, $msg, $details; setcookie('id'); setcookie('id_hash'); setcookie('login'); $details = load_details('accounts_s', $vars['id']); show_header(); echo "Your account is deleted.
Possible reason: {$GLOBALS['REASON_DEL'][$details['d_r']]}
"; return; } // -- 'stat' functions function show_stat() { global $vars, $msg; show_header(); if($stat=fetch_account_statistic($vars['id'])) show_statistic($stat); else DisplayMessage($msg); } //-- END: stat_action function lostpass($vars) { if ($vars[login]=='' && $vars[wm_email]=='') { echo "

Restore password

Your login:


"; if ($GLOBALS[REMIND_BYMAIL]) echo "
Your email:

"; echo "Your password will be mailed shortly"; } else { if ($vars[login]) $query="SELECT wm_email,login,pass_hash FROM accounts_s WHERE login='$vars[login]'"; elseif ($GLOBALS[REMIND_BYMAIL] && $vars[wm_email]) $query="SELECT wm_email,login,pass_hash FROM accounts_s WHERE wm_email='$vars[wm_email]'"; $result=db_query($query); if (mysql_num_rows($result)) { $row=mysql_fetch_assoc($result); $row[pass]=my_decrypt($row[pass_hash],$GLOBALS[SECRET_STRING]); if (send_email('remind',$row)) echo "Login information was sent to your email"; else echo "Sorry, cannot send mail"; } else { echo "Sorry, login not found. Contact webmaster"; } } } function logout() { setcookie('id'); setcookie('id_hash'); setcookie('login'); show_login_form(); } //---- END: functions //---- BEGIN: main code // registering necessary variables in GP order $vars_names=array( 'id', 'login', 'change', 'go', 'agree', 'wm_nick', 'wm_email', 'wm_icq', 'url', 'description', 'title', 'url_fake', 'url_recip', 'url_banner', 'url_sample', 'sample_width', 'sample_height', 'pass', 'id_cat' ); register_vars($vars_names); //----- ?> accounts manager
contact webmaster."; if ($footbanner) { echo "

"; readfile("$PATH_TPL/wmbanner.txt"); } ?>