function _default() { $this->output->secure(); $f = $this->input->f; if ($f[email] && $f[password] && $f[name] && $f[url]) { if ($_SESSION[user][admin] == 3) { $this->db->update("adrev_users", "id", $_REQUEST[id], $f); $this->output->redirect(lib_lang("The profile was updated"), "index.php?section=" . $_REQUEST[redir], 1); } else { $this->db->update("adrev_users", "id", $_SESSION[user][id], $f); $this->output->redirect(lib_lang("Your profile was updated"), "index.php?section=profile", 1); } exit; } if ($_SESSION[user][admin] == 3 && $_REQUEST[id]) { $id = $_REQUEST[id]; } else { $id = $_SESSION[user][id]; } $rec = $this->db->getsql("SELECT * FROM adrev_users WHERE id=?", array($id)); $f = $rec[0]; // Grab the list of language modules $modules = array(); if ($handle = opendir("lang")) { while (FALSE !== ($file = readdir($handle))) { if (preg_match('/^(.*?)\\.lng/i', $file, $match)) { $modules[$match[1]] = $match[1]; } } closedir($handle); } $form = new formgen(); $form->input("<b>" . lib_lang("Email") . "</b>", "f[email]", stripslashes($f[email]), 40); $form->input("<b>" . lib_lang("Password") . "</b>", "f[password]", stripslashes($f[password]), 20); $form->input("<b>" . lib_lang("Name") . "</b>", "f[name]", stripslashes($f[name]), 40); $form->input(lib_lang("Organization"), "f[organization]", stripslashes($f[organization]), 40); $form->dropdown(lib_lang("Country"), "f[country]", lib_htlist_array($this->default[country], $f[country])); $form->input(lib_lang("Street"), "f[street]", stripslashes($f[street]), 40); $form->input(lib_lang("City"), "f[city]", stripslashes($f[city]), 20); $form->input(lib_lang("State"), "f[state]", stripslashes($f[state]), 10); $form->input(lib_lang("Zip"), "f[postalcode]", stripslashes($f[postalcode]), 10); $form->input("<b>" . lib_lang("Url") . "</b>", "f[url]", stripslashes($f[url]), 50); $form->dropdown(lib_lang("Language"), "f[lang]", lib_htlist_array($modules, $f[lang])); $form->hidden("section", "profile"); $form->hidden("id", $id); $form->hidden("redir", $_REQUEST[redir]); $this->title = lib_lang("Edit Profile"); $this->content = $form->generate("post", lib_lang("Save Profile")); $this->display(); $this->printpage(); exit; }
function _default() { $f = $this->input->f; if ($f[email] && $f[subject] && $f[message]) { $f[message] .= "\n\n--------------------\nIP:" . $_SERVER[REMOTE_ADDR] . "\n"; $f[message] .= "Browser:" . $_SERVER[HTTP_USER_AGENT]; mail($this->default[adrevenue][email], stripslashes($f[subject]), stripslashes($f[message]), "From: <{$f['email']}>"); $this->output->redirect("Your message was sent", "index.php", 1); exit; } if (!$f[email]) { $f[email] = $_SESSION[user][email]; } // Show the form $form = new formgen(); $form->comment(lib_lang("If you have a problem or a question, please contact us using the form below")); $form->input("<b>" . lib_lang("Email") . "</b>", "f[email]", $f[email], 30); $form->input("<b>" . lib_lang("Subject") . "</b>", "f[subject]", $f[subject], 60); $form->textarea("<b>" . lib_lang("Message") . "</b>", "f[message]", $f[message], 15, 62); $form->hidden("section", "contact"); $this->title = lib_lang("Contact Us"); $this->content = $form->generate("post", lib_lang("Send Message")); $this->display(); $this->printpage(); exit; }
function payment_form() { // Show the form $month = array(1 => "01", 2 => "02", 3 => "03", 4 => "04", 5 => "05", 6 => "06", 7 => "07", 8 => "08", 9 => "09", 10 => "10", 11 => "11", 12 => "12"); $year = array(date("Y"), date("Y") + 1, date("Y") + 2, date("Y") + 3, date("Y") + 4, date("Y") + 5, date("Y") + 6, date("Y") + 7, date("Y") + 8); $cards = array('Visa' => lib_lang('Visa'), 'MC' => lib_lang('Mastercard'), 'AMEX' => lib_lang('American Express'), 'Discover' => lib_lang('Discover')); $form = new formgen(); $form->comment(lib_lang("Your Billing Information")); $form->input("<b>" . lib_lang("First Name") . "</b>", "f[first_name]", $f[first_name], 30); $form->input("<b>" . lib_lang("Last Name") . "</b>", "f[last_name]", $f[last_name], 30); $form->dropdown("<b>" . lib_lang("Card Type") . "</b>", "f[cardtype]", lib_htlist_array($cards, $f[cardtype])); $form->dropdown("<b>" . lib_lang("Expire Month") . "</b>", "f[last_name]", lib_htlist_array($month, $f[month])); $form->dropdown("<b>" . lib_lang("Expire Year") . "</b>", "f[last_year]", lib_htlist_array($year, $f[year])); $form->input("<b>" . lib_lang("Card Number") . "</b>", "f[cardnumber]", $f[cardnumber], 20); $form->line(); $form->comment("<font size=3><b>" . lib_lang("Billing Address") . "</b></font>"); $form->dropdown(lib_lang("Country"), "f[country]", lib_htlist_array($this->default[country], $f[country])); $form->input("<b>" . lib_lang("Address 1") . "</b>", "f[address1]", $f[address1], 50); $form->input("<b>" . lib_lang("Address 2") . "</b>", "f[address2]", $f[address2], 50); $form->input("<b>" . lib_lang("City") . "</b>", "f[city]", $f[city], 25); if ($this->default[adrevenue][country] == "US") { $form->dropdown(lib_lang("US State"), "f[state]", lib_htlist_array($this->default[states], $f[state])); } else { $form->input("<b>" . lib_lang("State") . "</b>", "f[state]", $f[state], 20); } $form->input("<b>" . lib_lang("Phone") . "</b>", "f[phone]", $f[phone], 25); $form->input("<b>" . lib_lang("Email") . "</b>", "f[email]", $f[email], 25); $form->hidden("section", "pay"); $form->hidden("action", "form"); $form->hidden("f[amount]", $f[amount]); $this->output->title = lib_lang("Edit Your Profile"); $this->output->content = $form->generate("post", lib_lang("Save Profile")); $this->output->display(); $this->output->printpage(); exit; }
function register() { global $DEFAULT; $f = $this->input->f; if ($f[email] && $f[name] && $f[password] && $f[postalcode] && $f[city] && $f[state] && $f[country]) { // Check email for duplication $em = $this->db->getsql("SELECT id FROM adrev_users WHERE email=?", array($f['email'])); if ($em[0][id]) { $errormsg .= "<li> " . lib_lang("That email address was already used"); } if (!lib_checkemail($f[email])) { $errormsg .= "<li> " . lib_lang("Invalid Email Address Entered"); } if (!$f[postalcode]) { $errormsg .= "<li> " . lib_lang("Please enter your Postal/Zip Code"); } if (!$f[country]) { $errormsg .= "<li> " . lib_lang("Please choose a country"); } if (!$errormsg) { $i = array(); $i[email] = trim(strtolower($f[email])); $i[country] = $f[country] ? $f[country] : "US"; $i[password] = $f[password]; $i[name] = $f[name]; $i[organization] = $f[organization]; $i[country] = $f[country]; $i[street] = $f[street]; $i[city] = $f[city]; $i[state] = $f[state]; $i[postalcode] = $f[postalcode]; $i[url] = $f[url]; $i[admin] = $_REQUEST[t] == "pub" ? 2 : 1; $i[zid] = uniqid(""); $i['date'] = time(); $i[ip] = $_SERVER['REMOTE_ADDR']; $i[status] = $this->default[adrevenue][confirm_registration] ? 0 : 1; $i[ref] = $f[ref]; $this->db->insert("adrev_users", $i); // Notify us about new signups $d = array(); reset($i); while (list($key, $val) = each($i)) { $d[] = strtoupper($key) . '=' . $val; } $data = implode("\n", $d); mail($this->default[adrevenue][email], lib_lang('New Advertiser Signup'), lib_lang('A new advertiser signed up') . "\n", $data); // Send a confirmation email if ($this->default[adrevenue][confirm_registration]) { $tpl = new XTemplate("templates/user_confirm.txt"); $tpl->assign("ZID", $i[zid]); $tpl->parse("main"); $msg = $tpl->text("main"); mail($i[email], "[" . $this->default[adrevenue][name] . "] - " . lib_lang("Welcome - confirm your registration!"), $msg, "From: <" . $this->default[adrevenue][email] . ">"); $this->output->redirect(lib_lang("Please check your email for confirmation instructions"), "index.php?section=user&action=login", 5); } else { $this->output->redirect(lib_lang("Saving your registration"), "index.php?section=user&action=login", 2); } exit; } } // Set default country if (!$f[country]) { $f[country] = "US"; } $form = new formgen(); $adname = "Advertiser"; if ($_REQUEST[t] == "pub") { $adname = lib_lang("Publisher Registration"); } else { $adname = lib_lang("Advertiser Registration"); } $form->comment(lib_lang("Welcome! Please enter your information below.")); if ($this->default[adrevenue][confirm_registration]) { $form->comment(lib_lang("Please enter a valid email address, since you will receive account activation instructions there.")); } $form->comment("<font color=red>{$errormsg}</font>"); $form->input("<b>" . lib_lang("Email") . "</b>", "f[email]", stripslashes($f[email]), 40, lib_lang("Your email will also be your login name")); $form->input("<b>" . lib_lang("Password") . "</b>", "f[password]", stripslashes($f[password]), 20); $form->input("<b>" . lib_lang("Name") . "</b>", "f[name]", stripslashes($f[name]), 40); $form->input(lib_lang("Organization"), "f[organization]", stripslashes($f[organization]), 40); $form->dropdown("<b>" . lib_lang("Country") . "</b>", "f[country]", lib_htlist_array($this->default[country], $f[country])); $form->input("<b>" . lib_lang("Street") . "</b>", "f[street]", stripslashes($f[street]), 40); $form->input("<b>" . lib_lang("City") . "</b>", "f[city]", stripslashes($f[city]), 20); $form->input("<b>" . lib_lang("State") . "</b>", "f[state]", stripslashes($f[state]), 10); $form->input("<b>" . lib_lang("Zip/Postal Code") . "</b>", "f[postalcode]", stripslashes($f[postalcode]), 10); $form->input(lib_lang("Url"), "f[url]", stripslashes($f[url]), 50); $form->input(lib_lang("Referrer"), "f[ref]", stripslashes($f[ref]), 30); $form->hidden("section", "user"); $form->hidden("action", "register"); $form->hidden("t", $_REQUEST[t]); $this->title = $adname; $this->content = $form->generate("post", lib_lang("Register")); $this->display(); $this->printpage(); exit; }
function pay() { $this->output->admin(); $f = $this->input->f; if ($f[amount] && $f[description] && $f[date] && $f[id]) { // Put in the credit /* $i = array(); $i[date] = time(); $i[userid] = $f[id]; $i[description] = "$f[description] - $f[date]"; $c = $this->db->getsql("SELECT balance FROM adrev_users WHERE id='$f[id]'"); $current = $c[0]; $finalb = $f[amount] + $current[balance]; $this->db->getsql("UPDATE adrev_users SET balance=$finalb WHERE id='$f[id]'"); $i[amount] = str_replace(array(",",'$',"-"), "", $f[amount]); $this->db->insert("adrev_payments", $i); $i[amount] = $i[amount] * -1; $i[description] = "Traffic - to $f[date]"; $this->db->insert("adrev_payments", $i); */ // Optionally Delete the logs // This will just summarize the logs $cutoff = strtotime($f[date]) + 86400; // Summarize $rec = $this->db->getsql('SELECT sum(amount) as total FROM adrev_aff_traffic WHERE affid=? AND date < ?', array($f[id], $cutoff)); $i = array(); $i['date'] = $cutoff; $i['affid'] = $f['id']; $i['adtype'] = 'EARN'; $i['adid'] = 0; $i['ip'] = $_SERVER['REMOTE_ADDR']; $i['referer'] = 'Earnings to ' . $f['date']; $i['amount'] = $rec[0]['total']; $this->db->insert('adrev_aff_traffic', $i); // Payment $i = array(); $i['date'] = $cutoff; $i['affid'] = $f['id']; $i['adtype'] = 'PAID'; $i['adid'] = 0; $i['ip'] = $_SERVER['REMOTE_ADDR']; $i['referer'] = 'Payments on ' . $f['date']; $i['amount'] = $rec[0]['total'] * -1; $this->db->insert('adrev_aff_traffic', $i); // Delete Logs $this->db->getsql('DELETE FROM adrev_aff_traffic WHERE adid > 0 AND affid=?', array($f['id'])); // We're done $this->output->redirect("The account was paid", "index.php?section=pubadmin&action=stats&f[id]={$f['id']}", 1); exit; } // Grab the balance $recs = $this->db->getsql("SELECT count(*) as num, sum(amount) as amount FROM adrev_aff_traffic \r\n\t\t\t\t\t\t\t\t\tWHERE affid=?", array($f['id'])); $balance = $recs[0][amount]; // Show the form $form = new formgen(); $form->comment(lib_lang("You can adjust the account balance of the publisher here.")); $form->comment(lib_lang("Balance") . ": <b>" . lib_lang('$') . number_format($balance, 2) . "</b>"); $form->input("<b>" . lib_lang("Amount") . "</b>", "f[amount]", number_format($balance, 2), 10); $form->input("<b>" . lib_lang("Description") . "</b>", "f[description]", lib_lang("Publisher Payment"), 40); $form->input("<b>" . lib_lang("Cutoff Date") . "</b>", "f[date]", date("m/d/Y"), 10, "MM/DD/YYYY"); $form->hidden("section", "pubadmin"); $form->hidden("action", "pay"); $form->hidden("f[id]", $f[id]); $this->title = lib_lang("Pay Publisher"); $this->content = $form->generate("post", lib_lang("Submit")); $this->display(); $this->printpage(); exit; }
function form() { // Secured $this->output->secure(); $f = $this->input->f; $parts = explode(" ", $_SESSION[user][name]); if (!$f[country]) { $f[country] = "US"; } if (!$f[email]) { $f[email] = $_SESSION[user][email]; } if (!$f[first_name]) { $f[first_name] = trim($parts[0]); } if (!$f[last_name]) { $f[last_name] = trim($parts[1]); } if (!$f[city]) { $f[city] = $_SESSION[user][city]; } if (!$f[state]) { $f[state] = $_SESSION[user][state]; } if (!$f[zip]) { $f[zip] = $_SESSION[user][postalcode]; } if (!$f[address]) { $f[address] = $_SESSION[user][street]; } if (!$f[amount]) { $f[amount] = $f[amount]; } // Setup a form $form = new formgen(); if ($f[errormsg]) { $form->comment("<li> <font color=red><b>{$f['errormsg']}</b></font>"); } $form->comment("<i>@@Please fill all applicable fields@@</i><br> "); $form->comment("<b>@@Address Information@@</b>"); $form->input("@@First Name@@", "f[first_name]", $f[first_name], 30); $form->input("@@Last Name@@", "f[last_name]", $f[last_name], 30); $form->input("@@Telephone@@", "f[phone]", $f[phone], 15); $form->input("@@Email@@", "f[email]", $f[email], 30); $form->input("@@Address@@", "f[address]", $f[address], 50); $form->input("@@City@@", "f[city]", $f[city], 20); $form->input("@@State@@", "f[state]", $f[state], 20); $form->input("@@Zip@@", "f[zip]", $f[zip], 10); $form->dropdown("@@Country@@", "f[country]", lib_htlist_array($this->default[country], $f[country])); // You can comment out these sections or add new fields as necessary $form->comment("<b>@@Billing Information@@</b>"); $form->input("@@CardNumber@@", "f[card_num]", $f[card_num], 30); $form->input("@@ExpireDate@@", "f[exp_date]", $f[exp_date], 10, "@@Format should be MM/YYYY@@"); $form->input("@@Card Code@@", "f[card_code]", $f[card_code], 5, "@@3 or 4 digit number on the back of your card@@"); $form->hidden("f[amount]", $f[amount]); $form->hidden("section", "pay"); $form->hidden("action", "process"); $this->title = lib_lang("Enter your Credit Card Information"); $this->content = $form->generate("post", lib_lang("Submit")); $this->display(); $this->printpage(); exit; }
function pay_settings() { $this->output->admin(); $f = $this->input->f; // Set the default to be PayPal if (!$this->default[adrevenue][payment_module]) { $this->default[adrevenue][payment_module] = "paypal"; } $mod = "pay." . $this->default[adrevenue][payment_module] . ".php"; include_once $mod; $opt = payment::mod_vars(); $info = payment::mod_info(); if (count($f) > 0) { reset($f); while (list($key, $val) = each($f)) { $this->save($key, $val); } $this->output->redirect("The payment settings were updated", "index.php?section=settings&action=pay_settings", 1); exit; } // Show the form $form = new formgen(); $form->comment("<b>" . lib_lang("Enter the settings for your {$info['name']} payment module") . "</b><br> "); if ($info[extern] == TRUE) { $form->comment(lib_lang($info[extern_description]) . ": <font color=red>" . $this->default[adrevenue][hostname] . "ipn.php<p>" . "</font>"); } foreach ($opt as $rec) { $name = $rec[name]; $v = $this->db->getsql("SELECT value FROM adrev_settings WHERE name=?", array($name)); $form->input(lib_lang($rec[label]), "f[{$name}]", stripslashes($v[0][value]), $rec[length]); } $form->hidden("submit", "1"); $this->title = lib_lang("Edit {$info['name']} Payment Settings"); $this->content = $form->generate("post", lib_lang("Save Payment Settings")); $this->display(); $this->printpage(); exit; }