key = $key; $this->status($status); $sql = "SELECT * FROM $this->table WHERE id = -1"; $result = $conn->Execute($sql); $obj_vars = $result->FetchObj(); if (array_key_exists($key, $obj_vars)) { $query = "SELECT * from $this->table where $key='$sid'"; $result = $conn->GetAll($query); if (! is_array($result[0])) $result[0] = array();//return 0; $row = $result[0]; foreach ($row as $property_name=>$value) { $this->$property_name = $value; } $this->password = encordec($this->password); $this->email = encordec($this->email); $this->keyword = $this->make_key(); } if($key == 'assoc' && is_array($sid)){ $query = "SELECT * from $this->table where "; $wlist = array(); foreach ($sid as $key => $value){ if(array_key_exists($key, $obj_vars)){ $wlist[] = "$key='$value'"; } } if(count($wlist)){ $query.= ' '.implode(' AND ', $wlist); $result = $conn->GetAll($query); if (!is_array($result[0])) $result[0] = array();//return 0; $row = $result[0]; foreach ($row as $property_name=>$value) { $this->$property_name = $value; } $this->password = encordec($this->password); $this->email = encordec($this->email); $this->keyword = $this->make_key(); } } if (!$this->id && $create && $key=='username') { $this->username = $sid; $this->create(); } if ($key=='check') { $csite = null; if(is_array($sid)){ $this->username = $sid['username']; $csite = $sid['site']; }else{ $this->username = $sid; } $this->status('active'); $this->read_username($csite); if ($this->id) return 0; $this->status('pending'); $this->read_username($csite); if ($this->id) return 0; $this->status('inactive'); $this->read_username($csite); if ($this->id) return 0; $this->status('old'); $this->read_username($csite); if ($this->id) return 0; // } } public function status($status) // Inicializira statusa na membera kato avtomatichno izbira s koya members tablica shte raboti { $this->table = TBL_PREFIX.$status."_members"; $this->status = $status; } public function read_username($site = null) // Chetene ot DB pri zadaden username { global $conn, $ADODB_FETCH_MODE; $query = "SELECT * from $this->table where username='$this->username'"; if($site){ $query.=" AND site='$site'"; } $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $result = $conn->GetAll($query); if (! is_array($result[0])) { $this->id=0; return 1; } $row = $result[0]; //90% sure this should delete old inactive members of the same usename that are 2 weeks old //or that are cancelled greater than 4 days if($this->table == TBL_PREFIX."inactive_members" && $this->key == 'check'){ $delaytime = date("Y-m-d", strtotime("-4 days")); if(( ($row['deleted'] != '1' && $row['deleted'] != '0') || ($row['cancelled'] != '1' && $row['cancelled'] != '0') ) || ($row['deleted'] == '1' && ($row['deleted_date']<$delaytime || $row['deleted_date']==NULL)) || ($row['cancelled'] == '1' && ($row['cancelled_date']<$delaytime || $row['cancelled_date']==NULL)) ){ $i_mem = array(); foreach ($row as $property_name=>$value) { if($property_name != 'id'){ $i_mem[$property_name] = $value; } } $i_mem['id'] = 0; $sql = "SELECT * FROM ".TBL_PREFIX."former_members WHERE id = -1"; $res = $conn->Execute($sql); $insertSQL = $conn->GetInsertSQL($res, $i_mem); $conn->Execute($insertSQL); $query = "DELETE from $this->table where username=?"; $conn->Execute($query, array($this->username)); $this->id=0; return 1; } } foreach ($row as $property_name=>$value) { $this->$property_name = $value; } $this->password = encordec($this->password); $this->email = encordec($this->email); } public function read_subscription() // Chetene ot DB pri zadaden subscription_id { global $conn, $ADODB_FETCH_MODE; if ($id) $this->id=$id; $query = "SELECT * from $this->table where subscription_id='$this->subscription_id'"; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $result = $conn->GetAll($query); if (! is_array($result[0])) { return 0; } $row = $result[0]; foreach ($row as $property_name=>$value) { $this->$property_name = $value; } $this->password = encordec($this->password); $this->email = encordec($this->email); } public function read() // Chete ot DB pri zadadeno id na member (id e autoincrement index v tablicite) { global $conn, $ADODB_FETCH_MODE; if ($id) $this->id=$id; $query = "SELECT * from $this->table where id='$this->id'"; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $result = $conn->GetAll($query); if (! is_array($result[0])) { return 0; } $row = $result[0]; foreach ($row as $property_name=>$value) { $this->$property_name = $value; } $this->password = encordec($this->password); $this->email = encordec($this->email); } public function save() // zapisva v bazata danni { global $conn; $this->date_edited = date("Y-m-d h:i:s"); $this->keyword = $this->make_key(); $sql = "SELECT * FROM $this->table WHERE id='$this->id'"; $result = $conn->Execute($sql); $obj_vars = $result->FetchObj(); foreach($obj_vars as $var=>$val) if (! isset($this->$var)) $this->$var = ''; $this->password = encdec(encordec($this->password)); $this->email = encdec(encordec($this->email)); if ($this->massmail=='')$this->massmail=1; $updateSQL = $conn->GetUpdateSQL($result, get_object_vars($this)); if ($updateSQL) $conn->Execute($updateSQL); $this->password = encordec($this->password); $this->email = encordec($this->email); } public function del() // trie ot bazata danni { global $conn; $sql = "DELETE FROM $this->table WHERE id='$this->id'"; $conn->Execute($sql); $this->id = 0; return $conn->Affected_Rows(); } public function update($properties,$save_it=1) // $properties e asociativen array, $save_it = 0 | 1 - pri 1 avtomatichno zapisva v bazata danni napravenite promeni { if(!is_array($properties)) return false; foreach($properties as $property=>$value) { if ($this->$property != $value) { $this->$property = $value; } } $this->keyword = $this->make_key(); if ($save_it) $this->save(); } public function create($properties=null) // sazdava membera, moje da se forsira s asociativen array ot stoynosti za membera - fname, lname, email... { global $conn; define('ADODB_FORCE_NULLS',0); if ($this->id) return 0; if (! $properties) $properties = get_object_vars($this); foreach ($properties as $property_name=>$value) { $this->$property_name = $value; } $this->password = encdec($this->password); $this->email = encdec($this->email); $this->keyword = $this->make_key(); $sql = "SELECT * FROM $this->table WHERE id = -1"; $result = $conn->Execute($sql); $obj_vars = $result->FetchObj(); foreach($obj_vars as $var=>$val) if (! isset($this->$var)) $this->$var = ''; if ($conn->no_autoincrement) $this->id = $conn->GenID("seq_".$this->table,1); $insertSQL = $conn->GetInsertSQL($result, get_object_vars($this)); $conn->Execute($insertSQL); if (! $this->id) {$this->id = $conn->Insert_ID();} $this->password = encordec($this->password); $this->email = encordec($this->email); } public function fix_address() // Opravya addressa na member-a kato popalva vsichki countries poleta sas saotvetnite codes // Griji se da oznachi dali membera e ot Asia ili Europe za rabota s 2000charge { require_once(CLASSES_PATH."state.class.php"); require_once(CLASSES_PATH."country.class.php"); $country = new Country($this->country,'iso_2'); $state = new State($this->state); $geo_tracing = ($country->continent=='Asia' || $country->continent=='Europe')?1:0; if ($this->country!='US' && $this->country!='CA' && $this->site <> 35 && $this->webmaster <>'102651' && $this->site <> 55) { $geo_tracing = 1; } else { $geo_tracing=0; } $this->update(array('fcountry' => $country->name, 'iso_country' => $country->iso_no, 'fstate' => $state->name, 'geo_tracing' => $geo_tracing)); unset($country); unset($state); } public function make_key() // Sazdava unique keyword za saotvetniya member - izpolzva se pri signups za verifikaciya { return abs(crc32("$this->username:$this->password - tralala")); } public function toString($delimiter = "
\n") { $asArray = get_object_vars($this); foreach ($asArray as $key=>$val) $str.="$key = $val".$delimiter; return $str; } public function grant_access() // Razreshava dostap na membera do saotvetniya site { global $conn; include_once (CLASSES_PATH."site.class.php"); if ($this->password=='') return 1; if ($this->site) { $theSite = new Site($this->site); $res = $theSite->addMember($this->username, $this->password); unset($theSite); } else { $q = "select id from ". TBL_PREFIX ."sites where deleted=0 and id!='70'"; $result = $conn->GetAll($q); $res = 1; $processed_sites = array(); foreach ($result as $s) { $theSite = new Site($s[id]); if (array_key_exists($theSite->htpasswd.$theSite->adp, $processed_sites)) { if($conn->debug) $conn->outp("The member has already been added to this adp_url/htpasswd combination. Check above add commands for SiteID ".$processed_sites[$theSite->htpasswd.$theSite->adp]); continue; } $processed_sites[$theSite->htpasswd.$theSite->adp] = $theSite->id; $res1 = $theSite->addMember($this->username, $this->password); if (! $res1) $res = $res1; unset($theSite); } } return $res; } public function revoke_access() // Otkazva dostap na membera do site-a { global $conn; include_once (CLASSES_PATH."site.class.php"); if ($this->site) { $theSite = new Site($this->site); $res = $theSite->deleteMember($this->username, $this->password); unset($theSite); } else { $q = "select id from ". TBL_PREFIX ."sites"; $result = $conn->GetAll($q); $res = 1; foreach ($result as $s) { $theSite = new Site($s[id]); $res1 = $theSite->deleteMember($this->username, $this->password); if (! $res1) $res = $res1; unset($theSite); } } return $res; } public function activate($sdate,$edate) // aktivira membera (sled uspeshen signup) kato se zadavat start i expiration date // metoda unishtojava saotvetniya pending member i go sazdava nanovo v tablicata s active members // sled koeto mu dava access do members areata na site-a { include_once(CLASSES_PATH."upgradeplus.class.php"); include_once(CLASSES_PATH."mem_defs.class.php"); include_once(CLASSES_PATH."active_members.class.php"); if ($this->status != 'active') { $res = $this->del(); if (!$res) exit; $this->status('active'); $this->sdate = $sdate; $this->edate = $edate; $this->deleted = 0; $this->create(); $countMembers = new cMembers($this, 'ADD'); } else { $this->sdate = $sdate; $this->edate = $edate; $this->deleted = 0; $this->save(); } $res = $this->grant_access(); $uplus_member = new UpgradePlusMember(null,$this->subscription_id); if ($uplus_member->id && $uplus_member->upgrade_date!='0000-00-00') $uplus = new UpgradePlus($uplus_member->upgradeplus_id); if ($uplus_member->id && $uplus_member->upgrade_date!='0000-00-00') $uplus->addMember($this->username,$this->password); $memdefs=new MemDefs(); $memdefs->process_memdefs($this,$action="ADD"); return $res; } public function inactivate() // pri expire se otkazva access na membera do site-a i toy se premestva v tablicata za inactive members { include_once(CLASSES_PATH."upgradeplus.class.php"); include_once(CLASSES_PATH."mem_defs.class.php"); include_once(CLASSES_PATH."active_members.class.php"); if ($this->status != 'inactive') { $res = $this->del(); if (!$res) exit; $this->status('inactive'); $this->create(); $countMembers = new cMembers($this, 'DEL'); } $this->revoke_access(); $uplus_member = new UpgradePlusMember(null,$this->subscription_id); if ($uplus_member->id) $uplus = new UpgradePlus($uplus_member->upgradeplus_id); if ($uplus_member->id) $uplus->deleteMember($this->username); $memdefs=new MemDefs(); $memdefs->process_memdefs($this,$action="DELETE"); } public function cancel() { include_once (CLASSES_PATH."site.class.php"); $already_cancelled = $this->cancelled; if (!$already_cancelled && $this->site>0) { include_once (CLASSES_PATH."stats.class.php"); $this->cancel_date=date("Y-m-d"); $this->save(); $stats = new PrgMemberStats($this); $stats->add_cancel(); } $this->update(array('cancelled' => 1)); $site = new Site($this->site); $transaction = (object) 'transaction'; $transaction->cancelled = "1"; $site->send_postback($transaction, $this); } public function get_transactions_history($member = null) { global $conn,$currency_sign; include_once(FUNCTIONS_PATH."tables_funcs.php"); //this is made permanent below (AND member = '$this->username') /*if(isset($member)) { $member_check = "AND member='$member'"; }*/ $query = " SELECT trn_date, transaction_id, subscription_id, title, CASE WHEN free_trial =1 THEN 'initial free trial' WHEN trial =1 THEN 'initial trial' WHEN full_price =1 THEN 'initial full membership' WHEN conversion =1 THEN 'conversion' WHEN rebill =1 THEN 'rebill' WHEN chargeback =1 THEN 'chargeback' WHEN credit =1 THEN 'credit' END AS trn_type, amount FROM ".TBL_PREFIX."transactions t, mpa3_sites s WHERE s.id = t.site AND member = '$this->username' AND processor = '$this->processor' ORDER BY trn_date"; $result = $conn->GetAll($query); $rows = array(); foreach ($result as $row) { $rows[] = array(date("M jS, Y", strtotime($row[trn_date])),$row[transaction_id],$row[trn_type],$row[title],$row[subscription_id],$currency_sign.$row[amount]); } $xml_container = getXMLContainer(); $titles = array ( $xml_container->table_headers->th_trans_date, $xml_container->table_headers->th_trans_id, $xml_container->table_headers->th_trans_type, $xml_container->table_headers->th_site, $xml_container->table_headers->th_subscription_id, $xml_container->table_headers->th_amount ); // $titles = array('Transaction date', 'Transaction ID', 'Transaction type', 'Amount'); $alignment = array('center','center','left','left','left','right'); return draw_table($rows,array(),$alignment,$titles,null,'450'); } public function find_template($template, $site) { $new_template = preg_replace("/^(.*)(\.html)$/i", "$1", $template).'_'.$this->site.'.html'; if (is_file($new_template)) $template = $new_template; return $template; } public function parse_headers($email_html) { /*//headers can be set at the top of the template like this: {header} Subject: Welcome to Hegre-Art.com! Return-Path: support@hegre-art.com From: "Hegre-Art.com" {/header} */ preg_match_all("/{(header)}([\s\S.]*){\/(header)}/", $email_html, $arr_header); preg_match_all("/([^:]*):(.*)/",$arr_header[2][0], $arr_mail_headers); foreach ($arr_mail_headers[1] as $key=>$value) $this->mailHeaders[trim($value)] = trim($arr_mail_headers[2][$key]); return str_replace($arr_header[0][0], '', $email_html); } public function verify_info_change($properties) { $email = ''; foreach ($this->monitored_fields as $key) { if (isset($properties[$key]) && $this->$key!=$properties[$key]) $email .="$key field changed from '".$this->$key."' to '".$properties[$key]."'
\n"; $this->{"old_".$key} = $this->$key; $this->{"new_".$key} = $properties[$key]; } if ($email!='' && $this->ch_details) { $this->message = $email; $this->subject = 'Personal information change'; $this->send_email($this->ch_details_email_template, 1); } } public function send_email($template, $instant = 0) { require_once(CLASSES_PATH."mail_to_db.class.php"); @include(CONFIG_PATH."payout_config.php"); $email_html = @implode("", @file($this->find_template(OUTER_TEMPLATES_PATH.$template))); if ($this->minimum_email_length>strlen($email_html)) return 0; $this->program_name = PROGRAM_NAME; $this->members_support_email = $members_support_email; $this->subject = $this->subject." for ".PROGRAM_NAME; $asArray = get_object_vars($this); foreach($asArray as $field=>$value) $email_html = str_replace('{'.$field.'}', $this->$field, $email_html); $email_html = $this->parse_headers($email_html); if ($this->mailHeaders['From']=='' && $this->mailHeaders['from']=='') $this->mailHeaders['From'] = "$webmasters_support_email"; if ($this->mailHeaders['Subject']!='' || $this->mailHeaders['subject']!='') $this->subject = $this->mailHeaders['Subject'].$this->mailHeaders['subject']; foreach ($this->mailHeaders as $key=>$value) if (!preg_match("/subject|from/i", $key)) $mailHeader .="$key: $value\n"; $mailHeader = "From: ".$this->mailHeaders['From'].$this->mailHeaders['from']."\n".$mailHeader; if ($instant) { mail("\"$this->fname $this->lname\" <$this->email>", $this->subject, $email_html,"$mailHeader"."Content-type: text/html; charset=iso-8859-1\nX-Priority: 1"); } else { $mailHeader = preg_replace("/from:\s*/i", '', $mailHeader); $mail = new MailDB("\"$this->fname $this->lname\" <$this->email>", $this->subject, $email_html,"$mailHeader"."X-Priority: 1",time()); } } } ?> "Content-type: text/html; charset=iso-8859-1\n", 'text' => "Content-type: text/plain; charset=iso-8859-1\n"); $this->address = $address; if (!preg_match("/from: /i", $headers)) $this->headers = "From: $headers\n"; else $this->headers = "$headers\n"; $this->subject = $subject; $this->message = $message; $this->mime = $mime; $this->content_type = $c_type[$content_type]; if ($cc) $this->cc = "CC: $cc\n"; if ($bcc) $this->bcc = "BCC: $bcc\n"; $this->headers = $this->mime.$this->content_type.$this->headers.$this->cc.$this->bcc; $this->mail_id = $mail_id; $this->save(); } function save() { global $conn; $sql = "SELECT * FROM ".TBL_PREFIX."to_send WHERE id = -1"; $result = $conn->Execute($sql); if ($conn->no_autoincrement) $this->id = $conn->GenID("seq_".TBL_PREFIX."to_send",1); $insertSQL = $conn->GetInsertSQL($result, get_object_vars($this)); $conn->Execute($insertSQL); if (! $this->id) {$this->id = $conn->Insert_ID();} } } ?> Retrieve Lost Password
      RETRIEVE LOST PASSWORD

retrieve lost password


Please fill in at least two entries!

UserName
Subscribtion ID
Email Address