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 _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 history() { $this->output->secure(); $f = $this->input->f; $uid = $_SESSION[user][id]; $gen = new formgen(); $gen->startrow("#CCCCCC"); $gen->column("<b>" . lib_lang("Date") . "</b>"); $gen->column("<b>" . lib_lang("Description") . "</b>"); $gen->column("<b>" . lib_lang("Amount") . "</b>", "", "", "", "right"); $gen->endrow(); // Get the data $data = $this->db->getsql("SELECT * FROM adrev_payments WHERE userid=? ORDER BY date", array($uid)); $total = 0; if (count($data) > 0) { foreach ($data as $rec) { $bgcolor = $bgcolor == "#FFFFFF" ? "#FFFFEE" : "#FFFFFF"; $gen->startrow($bgcolor); $gen->column(date("M d Y", $rec[date])); $gen->column($rec[description]); $gen->column(number_format($rec[amount], 2), "", "", "", "right"); $gen->endrow(); $total += $rec[amount]; } $gen->startrow("#FFFFFF"); $gen->column(); $gen->column(); $gen->column(number_format($total, 2), "#CCCCCC", "", "", "right"); $gen->endrow(); } $this->title = lib_lang("Transaction History"); $this->content = $gen->gentable("400", 0, 1, 3, "#FFFFFF"); $this->display(); $this->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 keyword_stats() { $this->output->secure(); $f = $this->input->f; $uid = $_SESSION['user']['id']; // Grab the ad info $ad = $this->db->getsql("SELECT * FROM adrev_ads WHERE zid=? AND userid=?", array($f['id'], $uid)); $id = $ad['0']['id']; $zoneid = $ad['0']['zone']; $z = $this->db->getsql("SELECT * FROM adrev_zones WHERE id=?", array($zoneid)); $zone = $z['0']; // Lets update bids if (count($_REQUEST['bid']) > 0) { $minbid = $zone['rate']; while (list($xid, $rec) = each($_REQUEST['bid'])) { if (!$this->default['adrevenue']['max_bid']) { $this->default['adrevenue']['max_bid'] = 50; } if ($rec['bid'] >= $minbid && $rec['bid'] <= $this->default['adrevenue']['max_bid']) { $this->db->getsql("UPDATE adrev_keyword_map SET bid=?, url=? WHERE id=? AND adid=?", array($rec['bid'], $rec['url'], $xid, $id)); } } } // Delete a keyword if ($_REQUEST['delete']) { $kid = $_GET['delete']; $this->db->getsql("DELETE FROM adrev_keyword_map WHERE adid=? AND keywordid=?", array($id, $kid)); } $tpl = new XTemplate("templates/keywords.html"); // Check if we can add more keywords if ($zone['keywords_max'] > 0 && $f['keyword']) { $num = $this->db->getsql("SELECT count(*) as num FROM adrev_keyword_map WHERE adid=?", array($id)); if ($num['0']['num'] >= $zone['keywords_max']) { $this->output->redirect("@@You cannot add any more keywords@@", "?section=ads&action=keyword_stats&f[id]={$f['id']}", 3); exit; } } // Add a new keyword if ($f['keyword']) { $keywordid = $this->db->get_keyword($f['keyword']); $exists = $this->db->getsql("SELECT id FROM adrev_keyword_map WHERE keywordid=? AND adid=?", array($keywordid, $id)); if (!$exists['0']['id']) { $i = array(); $i['zoneid'] = $zoneid; $i['adid'] = $id; $i['keywordid'] = $keywordid; $i['url'] = $f['url']; $i['bid'] = 0; if ($zone['rtype'] == 2 && $zone['rate_type'] == "CPC") { $i['bid'] = $zone['rate']; } $this->db->insert("adrev_keyword_map", $i); } } // Setup some defaults list($startdate, $enddate) = lib_date_range($f['period']); $dates = array("today" => lib_lang('Today'), "yesterday" => lib_lang('Yesterday'), "thisweek" => lib_lang('This Week'), "lastweek" => lib_lang('Last Week'), "thismonth" => lib_lang('This Month'), "lastmonth" => lib_lang('Last Month'), all => lib_lang('All Time')); // Show the keywords, bids and other things $existing = $this->db->getsql("SELECT b.keyword,a.* FROM adrev_keyword_map a, adrev_keywords b\r\n\t\t\t\t\t\t\t\t\t\tWHERE a.keywordid=b.id AND a.adid=?\r\n\t\t\t\t\t\t\t\t\t\tORDER BY b.keyword", array($id)); if (count($existing) > 0) { $gen = new formgen(); $gen->startrow("#EEEEEE"); $gen->column("<b>@@Keyword@@</b>"); $gen->column("<b>@@URL@@</b>"); if ($zone['rtype'] == 2 && $zone['rate_type'] == "CPC") { $gen->column("<b>@@Bid@@</b>", "", 1, "", "center", ""); $gen->column("1", "", 1, "", "center", ""); $gen->column("2", "", 1, "", "center", ""); $gen->column("3", "", 1, "", "center", ""); $gen->column("4", "", 1, "", "center", ""); $gen->column("5", "", 1, "", "center", ""); } #column($content=" ", $bgcolor="", $width="", $valign="", $align="",$style="") $gen->column("<b>@@Clicks@@</b>", "", 1, "", "right", ""); $gen->column("<b>@@Views@@</b>", "", 1, "", "right", ""); $gen->column("<b>@@CTR%@@</b>", "", 1, "", "right", ""); $gen->column("<b>@@Actions@@</b>", "", 1, "", "right", ""); $gen->column("<b>@@ROI%@@</b>", "", 1, "", "right", ""); $gen->column("<b>@@Spend@@</b>", "", 1, "", "right", ""); $gen->column(""); $gen->endrow(); foreach ($existing as $rec) { $bgcolor = $bgcolor == "#FFFFFF" ? "#FFFFEE" : "#FFFFFF"; $gen->startrow($bgcolor); $gen->column("<a href=?section=ads&action=stats&f[id]={$f['id']}&f[kid]={$rec['keywordid']}>{$rec['keyword']}</a>"); $rec['url'] = iif(!$rec['url'], $ad['0']['url'], $rec['url']); $gen->column("<input type=text name=\"bid[{$rec['id']}][url]\" value=\"{$rec['url']}\" size=30>", "", 1, "", "center", ""); if ($zone['rtype'] == 2 && $zone['rate_type'] == "CPC") { // Grab other keywords like this one $rates = $this->db->getsql("SELECT bid,adid FROM adrev_keyword_map \r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE keywordid=? AND zoneid=?\r\n\t\t\t\t\t\t\t\t\t\t\t\tORDER BY bid DESC LIMIT 5", array($rec['keywordid'], $zone['id'])); $ranking = array(1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0); if (count($rates) > 0) { $x = 0; foreach ($rates as $r) { $x++; $ranking[$x] = array($r['adid'], $r['bid']); } } $bid = number_format($rec['bid'], 2); $gen->column("<input type=text name=\"bid[{$rec['id']}][bid]\" value=\"{$bid}\" size=5>", "", 1, "", "center", ""); foreach ($ranking as $r) { if ($id != $r['0']) { $gen->column(number_format($r['1'], 2), "", 1, "", "right", ""); } else { $gen->column("<b>" . number_format($r['1'], 2) . "</b>", "", 1, "", "right", ""); } } } // Grab any stats for this keyword $uid = $_SESSION['user']['id']; $stats = $this->db->getsql("SELECT count(id) as num, sum(clicks) as clicks, \r\n\t\t\t\t\t\t\t\t\t\t\t\tsum(impressions) as impressions, sum(orders) as orders,\r\n\t\t\t\t\t\t\t\t\t\t\t\tsum(amount) as spend\r\n\t\t\t\t\t\t\t\t\t\t\tFROM adrev_traffic\r\n\t\t\t\t\t\t\t\t\t\t\tWHERE adid=? AND userid=? AND keywordid=? AND date BETWEEN ? AND ?\r\n\t\t\t\t\t\t\t\t\t\t\tGROUP BY adid", array($id, $uid, $rec['keywordid'], $startdate, $enddate)); $gen->column(number_format($stats['0']['clicks']), "", 1, "", "right", ""); $gen->column(number_format($stats['0']['impressions']), "", 1, "", "right", ""); $gen->column(number_format($stats['0']['clicks'] * 100 / iif(!$stats['0']['impressions'], 1, $stats['0']['impressions']), 2), "", 1, "", "right", ""); $gen->column(number_format($stats['0']['orders']), "", 1, "", "right", ""); $gen->column(number_format($stats['0']['orders'] * 100 / iif(!$stats['0']['clicks'], 1, $stats['0']['clicks']), 2), "", 1, "", "right", ""); $gen->column(number_format($stats['0']['spend'], 2), "", 1, "", "right", ""); $gen->column("<A href=\"?section=ads&action=keyword_stats&f[id]={$f['id']}&delete={$rec['keywordid']}\">@@delete@@</a>", "", 1, "", "center", ""); $t_impressions += $stats['0']['impressions']; $t_clicks += $stats['0']['clicks']; $t_orders += $stats['0']['orders']; $t_spend += $stats['0']['spend']; } $gen->startrow("#EEEEEE"); $gen->column("", "", 1, "", "right", "", 2); if ($zone['rtype'] == 2 && $zone['rate_type'] == "CPC") { $gen->column("<input type=submit name=f[bidchange] value=\"@@Bid@@\">", "", 1, "", "center"); $gen->column("", "", 1, "", "right", "", 5); } $gen->column("<b>" . number_format($t_clicks) . "</b>", "", 1, "", "right", ""); $gen->column("<b>" . number_format($t_impressions) . "</b>", "", 1, "", "right", ""); $gen->column("<b>" . number_format($t_clicks * 100 / iif(!$t_impressions, 1, $t_impressions), 2) . "</b>", "", 1, "", "right", ""); $gen->column("<b>" . number_format($t_orders) . "</b>", "", 1, "", "right", ""); $gen->column("<b>" . number_format($t_orders * 100 / iif(!$t_clicks, 1, $t_clicks), 2) . "</b>", "", 1, "", "right", ""); $gen->column("<b>" . number_format($t_spend, 2) . "</b>", "", 1, "", "right", ""); $gen->column("", "", "", 1, "", "center", ""); $gen->endrow(); $tpl->assign("STATS", $gen->gentable("100%", 0, 1, 3, "#CCCCCC")); } // Show the top part $tpl->assign("PERIOD", date("D M d, Y", strtotime($startdate)) . " - " . date("D M d, Y", strtotime($enddate))); $tpl->assign("ID", $f['id']); $tpl->assign("KID", $f['kid']); $tpl->assign("PERIODLIST", lib_htlist_array($dates, $f['period'])); $tpl->assign("ADS_MENU", $this->menu($_REQUEST['f']['id'])); // See if we have pre-defined keywords if (trim($zone['keywords'])) { $exist = array(); if (count($existing) > 0) { foreach ($existing as $rec) { $exist[$rec['keyword']] = 1; } } // We have predefined keywords reset($existing); $keywords = preg_split('/[\\n,]/', $zone['keywords'], -1, PREG_SPLIT_NO_EMPTY); $k = array(); if (count($keywords) > 0) { foreach ($keywords as $keyword) { $keyword = trim(strtolower($keyword)); if (!$exist[$keyword]) { $k[$keyword] = $keyword; } } } $options = lib_htlist_array($k); $field = "<select name=f[keyword]>{$options}</select>"; } else { // There are no pre-defined keywords $field = "<input type=text name=f[keyword] size=20>"; } $tpl->assign("KEYWORD", $field); $tpl->parse("main"); $this->title = lib_lang("Manage Keywords"); $this->content = $tpl->text("main"); $this->display(); $this->printpage(); exit; }
function stats() { $this->output->admin(); $f = $this->input->f; $tpl = new XTemplate("templates/pub_user.html"); if (!$f[page]) { $f[page] = 1; } if (!$f[date]) { $f[date] = "thismonth"; } if (!$f[sort]) { $f[sort] = "date DESC,ip"; } list($startdate, $enddate) = lib_date_range($f['date']); // Grab the data for that page $limit = 100; $offset = ($f[page] - 1) * $limit; // Count records in set first $sdate = strtotime($startdate); $edate = strtotime($enddate) + 86400; $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=? AND date BETWEEN ? AND ?", array($f['id'], $sdate, $edate)); $z = $recs[0][num]; $amount = $recs[0][amount]; $pages = ceil($z / $limit); $prevpage = $f[page] - 1; $nextpage = $f[page] + 1; if ($f[page] > 1) { $pager .= "<a href=?section=pubadmin&action=stats&f[id]={$f['id']}&f[page]={$prevpage}&f[date]={$f['date']}&f[sort]={$f['sort']}&f[ip]={$f['ip']}>«Previous</a> "; } $pager .= "<b>" . number_format($z) . "</b> records. Page <font color=red>{$f['page']}</font> of <b>{$pages}</b> pages. "; if ($pages > $f[page]) { $pager .= " <a href=?section=pubadmin&action=stats&f[id]={$f['id']}&f[page]={$nextpage}&f[date]={$f['date']}&f[sort]={$f['sort']}&f[ip]={$f['ip']}>Next»</a>"; } // Show up to 20 page selector $pagelist = ""; for ($x = 1; $x <= $pages; $x++) { if ($x == $f[page]) { $pagelist .= " <b>{$x}</b>"; } else { $pagelist .= " <a href=?section=pubadmin&action=stats&f[id]={$f['id']}&f[page]={$x}&f[date]={$f['date']}&f[sort]={$f['sort']}&f[ip]={$f['ip']}>{$x}</a>"; } if ($x >= 20) { break; } } $pager .= " {$pagelist}"; $tpl->assign("PAGER", $pager); if ($z > 0) { if ($f[ip]) { $extra = "AND ip='{$f['ip']}'"; } $recs = $this->db->getsql("SELECT * FROM adrev_aff_traffic \r\n\t\t\t\t\t\t\t\t\tWHERE affid=? AND (date BETWEEN ? AND ?) {$extra}\r\n\t\t\t\t\t\t\t\t\tORDER BY ? LIMIT {$limit} OFFSET {$offset}", array($f['id'], $sdate, $edate, $f['sort'])); $gen = new formgen(); $gen->startrow("#CCCCCC"); $gen->column("<b>" . lib_lang("Date") . "</b>"); $gen->column("<b>" . lib_lang("Type") . "</b>"); $gen->column("<b>" . lib_lang("IP") . "</b>"); $gen->column("<b>" . lib_lang("Amount") . "</b>", "", "", "", "right"); $gen->column("<b>" . lib_lang("Page") . "</b>"); $gen->endrow(); foreach ($recs as $rec) { $ref = stripslashes($rec[referer]); if (strlen($ref) > 60) { $ref = substr($ref, 0, 30) . "..." . substr($ref, -30); } $bgcolor = $bgcolor == "#FFFFFF" ? "#FFFFEE" : "#FFFFFF"; $gen->startrow($bgcolor); $gen->column(date("m-d-Y h:i:sa", $rec[date])); $gen->column($rec[adtype]); $gen->column($rec[ip]); $gen->column(number_format($rec[amount], 3), "", "", "", "right"); $gen->column("<A href=\"{$rec['referer']}\" title=\"Open in new window\" target=\"_new\">{$ref}</a>"); $gen->endrow(); } $tpl->assign("TABLE", $gen->gentable("100%", 0, 1, 3, "#FFFFFF")); } $dates = array("today" => lib_lang('Today'), "yesterday" => lib_lang('Yesterday'), "thisweek" => lib_lang('This Week'), "lastweek" => lib_lang('Last Week'), "thismonth" => lib_lang('This Month'), "lastmonth" => lib_lang('Last Month'), all => lib_lang('All Time')); $tpl->assign("DATELIST", lib_htlist_array($dates, $f[date])); $tpl->assign("SORTLIST", lib_htlist_array(array('ip,date DESC' => 'IP Address', 'date DESC,ip' => 'Date'), $f[sort])); $tpl->assign("ID", $f[id]); $tpl->assign("IP", $f[ip]); $tpl->assign("BALANCE", number_format($amount, 3)); $tpl->parse("stats"); $this->title = lib_lang("Publisher Statistics"); $this->content = $tpl->text("stats"); $this->display(); $this->printpage(); exit; }
fputs($fp, "\$DEFAULT[database]='{$f['database']}';\n"); fputs($fp, "\$DEFAULT[user]='{$f['user']}';\n"); fputs($fp, "\$DEFAULT[password]='{$f['password']}';\n"); fputs($fp, "?>"); fclose($fp); header("Location: index.php"); } } else { $errormsg = "<li> ERROR creating file <b>settings.php</b>. Make sure permissions are correct."; } } else { $errormsg = "<li> {$db->errormsg}"; } } // Show the form $form = new formgen(); if (!$f[url]) { $f[url] = $path; } if (!$f[country]) { $f[country] = "US"; } if (!$f[currency]) { $f[currency] = "USD"; } if (!$f[organization]) { $f[organization] = "My Advertising Portal"; } $dbs = array("mysql" => "MySQL"); if ($errormsg) { $form->comment("<font color=red>{$errormsg}</font>");
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; }
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; }