Jump to content

devilincarnated

Members
  • Posts

    38
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

devilincarnated's Achievements

Member

Member (2/5)

0

Reputation

  1. i got a slight problem here folks...the page logins with fbconnect but it goes to the desired page in the pop-up window after logging in with facebook username and password...i want it to go to that page in the main window.....and login link should change to logout....wht am i missing?
  2. in the password match function insert this line: $password_confirm = Security::hash(Configure::read('Security.salt') . $data[$keys[0]]); does the trick...tall thanx 2 cakePHP manual....
  3. hi i am working with the cakehp framework for a site i have to build....i am suffering a login problem now... in the register page i got two fields for password and password confirm....and when i try to login with Auth compnent, it gives error cos cakePHP only sees the first password as a valid password field and hashes it while the second one remains unhashed....it causes problems resulting in invalid username/password.....anyone got a way out of it?
  4. i tried this still no luck! <?php echo "<p ><div style='padding-left:185px;'><input class='button' type=submit name=preview onClick=window.open('http://alltherankings.com/staging/preview.php?param1="; ?><?php echo $batch1; ?><?php "&param2=$batch2&param3=$batch3&param4=$batch4&param5=$batch5&param6=$batch6&param7=$batch7&param8=$batch8&param9=$batch9','previewwindow','width=400,height=200')" ." value='Preview'> <input type=submit name=save class='button' value='Publish'></div></form></p>"; ?>
  5. :'(lost my brains dudes.... i want to pass values from my form to a pop-up window and then retrieve those values in that pop-up window and display them, say like a preview of details entered in the form in a new pop-up window....i have retrieved the value, but it just doesn't seem to reach to the url of the pop-up window though it prints out the value...here is my code... For the values: $batch1 = $_POST['title']; $batch2 = $_POST['link']; $batch3 = $_POST['experience']; $batch4 = $_POST['explanation']; $batch5 = $_POST['comment']; $batch6 = $_POST['ownerid']; $batch7 = $_GET['category']; $batch8 = $_POST['author']; $batch9 = $_POST['num']; For the preview button echo "<p ><div style='padding-left:185px;'><input class='button' type=submit name=preview onClick="."window.open('http://xxx.com/yyy/preview.php?param1=$batch1&param2=$batch2&param3=$batch3&param4=$batch4&param5=$batch5&param6=$batch6&param7=$batch7&param8=$batch8&param9=$batch9','previewwindow','width=400,height=200')" ." value='Preview'> <input type=submit name=save class='button' value='Publish'></div></form></p>";
  6. I got the requirement and fully understood it now only. Here is what I want. I got a link which is an XML call and output is in XML format XML Call: Use this URL to get the ads in XML format. When I view the source CDATA is added to it. My client wants to parse this XML output with XML parser but since XML parser cant read the CDATA(i read thru 2 get this one...whew...), it just gets skipped. Now, he wants to remove the CDATA from the generated source file . CAN anyone help me NOW?
  7. This is the output I get now when I run the script in my localhost. dup = 1; // Get variables if(!$this->zone) $this->zone = $_GET['id']; if(!$this->affid) $this->affid = $_GET['affid'] ? $_GET['affid'] : 0; if(!$this->rows) $this->rows = $_GET['rows'] ? $_GET['rows'] : 0; if(!$this->cols) $this->cols = $_GET['cols'] ? $_GET['cols'] : 0; if(!$this->ad_sort) $this->ad_sort = $_GET['ad_sort'] ? $_GET['ad_sort'] : "asc"; if(!$this->format) $this->format = $_GET['output'] ? $_GET['output'] : "html"; if(!$this->keyword) $this->keyword = $_GET['keyword']; $this->keywordid = 0; $this->keywordrate = 0.00; // Setup default headers // P3P: CP="NOI DSP COR PSAo PSDo OUR BUS OTC" if (!$this->default['adrevenue']['p3p']) { header('P3P: CP="NOI DSP COR PSAo PSDo OUR BUS OTC"'); } else { header('P3P: CP="' . $this->default['adrevenue']['p3p'] . '"'); } header("Cache-Control: no-store, no-cache, must-revalidate"); header("Pragma: no-cache"); header("X-Vendor: W3matter LLC | RevSense | http://www.revsense.com"); // Get the zone if(!$this->zone) { return(""); } $this->z = lib_cache_get("zone", $this->zone); if(!$this->z) { $p = $this->db->getsql("SELECT * FROM adrev_zones WHERE id=?", array($this->zone)); $this->z = $p[0]; lib_cache_put("zone", $this->zone, $p[0]); } // Check if this zone is active if($this->z['status'] == 0) return(""); // Check dayparting if($this->z['daypart_enable'] == 1) { $day = date("w"); $hour = date("G"); if(!in_array($hour, lib_bit_options($this->z['daypart_hours']))) return(""); if(!in_array($day, lib_bit_options($this->z['daypart_days']))) return(""); } // Check geotargetting // **** This function will be added in a point release **** // // Override some zone settings that a user might have passed in if($_GET['rows'] > 0) $this->z['rows'] = $_GET['rows']; if($_GET['cols'] > 0) $this->z['cols'] = $_GET['cols']; if($_GET['max_display_ads'] > 0) $this->z['max_display_ads'] = $_GET['max_display_ads']; if($_GET['ad_sort']) $this->z['ad_sort'] = $_GET['ad_sort']; if($_GET['rows'] && $_GET['cols']) $this->z['max_display_ads'] = $_GET['rows'] * $_GET['cols']; if(!$_GET['fuzzy']) $this->z['keywords_fuzzy'] = $this->fuzzy ? $this->fuzzy : $this->z['keywords_fuzzy']; // Get ads if(!$this->ads()) { return(""); } // Update the log and billing info $this->impressions(); include_once("modules/preview.php"); $x = 0; $c = new preview; $c->affid = $this->affid; $c->keyid = $this->keywordid; if($this->format == "js" || $this->format == "html" || $this->format == "raw") { reset($this->adlist); if($this->z['layout_template']) $tpl = new XTemplate("MEM", "\n" . $this->z['layout_template'] . "\n"); else $tpl = new XTemplate("MEM", "\n" . join("", file("templates/zone_default_layout.html")) . "\n\n"); foreach($this->adlist as $rec) { $x++; $parsed = 0; $c->zid = $rec['zid']; $oz = $c->format_ad("html"); $tpl->assign("AD", $oz); $tpl->parse("main.row.col"); if($x >= $this->z['cols']) { $x = 0; $parsed = 1; $tpl->parse("main.row"); } } // Finish up parsing if(!$parsed) $tpl->parse("main.row"); $tpl->parse("main"); $out = $tpl->text("main"); if($this->format == "js") { $o1 = str_replace("'","\'",$out); $o1 = str_ireplace('', "", $o1); $o = explode("\n", $o1); $oo = array(); if(count($o) > 0) { foreach($o as $rec) { if(strlen(trim($rec)) > 0) $oo[] = trim($rec); } } $date = date("r"); $nocache = md5(uniqid("")) . " | " . $_SERVER['REMOTE_ADDR'] . " | " . iif($this->dup, 'DUP', ''); $out = "// W3matter.com | RevSense | http://www.w3matter.com\n"; $out .= "// $date\n"; $out .= "// Ad Code: $nocache\n\n"; $out .= "document.write('" . implode("');\ndocument.write('", $oo) . "');\n"; header("Content-type: text/javascript"); echo $out; exit; } } elseif($this->format == "xml") { // XML output $out = ''."\n"; reset($this->adlist); foreach($this->adlist as $ad) { $c->zid = $ad['zid']; $out .= $c->format_ad("xml"); } header("Content-type: text/xml"); } else { // CSV output reset($this->adlist); foreach($this->adlist as $ad) { $c->zid = $ad['zid']; $out .= $c->format_ad("csv"); } header("Content-type: text/csv"); } $net = lib_getmicrotime() - $this->tz; header("X-Server-Time: $net"); echo $out; return (""); } // Do the billing for these ads function impressions() { // Instantiate the cookielib $c = new cookielib(); // Iterate through the ads reset($this->adlist); $inlist = array(); foreach($this->adlist as $ad) { // Check if we are below the impressions window $k = $c->get("_i_".$ad['id']."_".$this->keywordid); $win = time() - $k; if($k > 0 && $win < $this->default['adrevenue']['dup_impressions']) { continue; } // We have at least 1 non-duplicate ad $this->dup = 0; // Save the impressions count $c->set("_i_".$ad['id']."_".$this->keywordid, time()); // Try to load this record $date = date("Y-m-d"); $a = $this->db->getsql("SELECT * FROM adrev_traffic WHERE adid=? AND date=? AND keywordid=?", array($ad['id'], $date, $this->keywordid)); // Calculate rate to post here $t = time(); if($this->z['rate_type'] == "CPM") { // Portion of cost per 1000 impressions $amount = ($ad['bid']*1) ? $ad['bid'] / 1000 : $this->z['rate'] / 1000; // Update ad units $this->db->getsql("UPDATE adrev_ads SET total_units=total_units+1 WHERE id=?", array($ad['id'])); $ad['total_units'] += 1; } elseif($this->z['rate_type'] == "CPD") { // Cost per day if(!$a[0]['id']) { $amount = $ad['bid'] > 0 ? $ad['bid'] : $this->z['rate']; $this->db->getsql("UPDATE adrev_ads SET total_units=total_units+1 WHERE id=?", array($ad['id'])); $ad['total_units'] += 1; } else $amount = 0; // we already posted it today! } elseif($this->z['rate_type'] == 'CPI') { // Cost per impression $amount = ($ad['bid']*1) ? $ad['bid'] : $this->z['rate']; // Update ad units $this->db->getsql("UPDATE adrev_ads SET total_units=total_units+1 WHERE id=?", array($ad['id'])); $ad['total_units'] += 1; } else { $amount = 0; } // Log traffic stats and amounts if(!$a[0]['id']) { // Add a new traffic record $i = array(); $i['userid'] = $ad['userid']; $i['date'] = $date; $i['adid'] = $ad['id']; $i['keywordid'] = $this->keywordid; $i['impressions'] = 1; $i['amount'] = $amount; $this->db->insert("adrev_traffic", $i); } else { // Update it $amount = $amount ? $amount : 0; $id = $a[0]['id']; $this->db->getsql("UPDATE adrev_traffic SET impressions=impressions+1, amount=amount+$amount WHERE id=?", array($id)); } // Update real time balance if we actually have an amount $t = time(); if($amount > 0) { $this->db->getsql("UPDATE adrev_users SET balance=balance-{$amount}, balance_update=? WHERE id=?", array($t, $ad['userid'])); if($this->affid > 0) { $aff_amount = $amount * ($this->z['aff_percent'] / 100); $pub_rates = false; // Check if we have tiered affiliate rates if ($this->z['pub_rates'] && !$aff_amount) { $pub_rates = @unserialize($this->z['pub_rates']); // Zone affiliate tiered rates } elseif ($this->default['adrevenue']['pub_rates'] && !$aff_amount) { // Global affiliate tiered rates $pub_rates = @unserialize($this->default['adrevenue']['pub_rates']); } // Set the apropro tiered affiliate rate if (is_array($pub_rates) && $aff_amount == 0) { $sp = $this->db->getsql('SELECT sum(amount) as total FROM adrev_aff_traffic WHERE affid=?', array($this->affid)); if ($sp[0]) { $sp[0]['total'] = $sp[0]['total'] > 0 ? $s[0]['total'] = 0 : 0; foreach($pub_rates as $rate) { if ($sp[0]['total'] >= $rate[0] && $sp[0]['total'] <= $rate[1] && $rate[2] > 0) { $aff_amount = $amount * ($rate[2] / 100); break; } } } } if ($aff_amount > 0) { $i = array(); $i['date'] = time(); $i['affid'] = $this->affid; $i['adtype'] = $this->z['rate_type']; $i['adid'] = $ad['id']; $i['ip'] = $_SERVER['REMOTE_ADDR']; $i['referer'] = $_SERVER['HTTP_REFERER']; $i['amount'] = $aff_amount; $i['spend'] = $amount; $this->db->insert("adrev_aff_traffic", $i); } } } // Attempt to expire this ad if(($ad['total_units'] >= $ad['units'] && $ad['units'] > 0) || ($ad['expires'] > 0 && $ad['expires'] <= time())) { $this->db->getsql("UPDATE adrev_ads SET status=-2 WHERE id=?", array($ad['id'])); } // Try to expire based on ad spend if ($ad['spend_limit'] > 0) { // Get the ad balance (this sucks) $ab = $this->db->getsql('SELECT sum(amount) as total FROM adrev_traffic WHERE adid=?', array($ad['id'])); if ($ab[0]['total'] > 0 && $ab[0]['total'] >= $ad['spend_limit']) { # Expire the ad $this->db->getsql("UPDATE adrev_ads SET status=-2 WHERE id=?", array($ad['id'])); } } } return( TRUE ); } // Grab ads for this zone function ads() { // Set the order for ads in this zone $order = ""; if($this->z['ad_sort'] == "asc") $order = "ORDER BY a.id"; elseif($this->z['ad_sort'] == "desc") $order = "ORDER BY a.id DESC"; elseif($this->z['ad_sort'] == "bid") $order = "ORDER BY a.bid DESC"; if($this->z['keywords_enable'] <> 1) { $ads = lib_cache_get("zoneads", $this->zone); // Just grab all the active ads in this zone $ads = $this->db->getsql("SELECT a.id,a.userid,a.bid,a.zid,a.daypart_days, a.daypart_hours,a.startdate,a.expires, a.units, a.total_units FROM adrev_ads a, adrev_users b WHERE a.userid=b.id AND a.zone=? AND a.status = '1' AND b.balance > 0 $order", array($this->zone)); if(count($ads) > 0 && $this->default['adrevenue']['cache'] > 0) { lib_cache_put("zoneads", $this->zone, $ads); } } else { // If there is no keyword if(!trim($this->keyword)) return ( FALSE ); // Try to find a keyword $keyword = strtolower(trim($this->keyword)); if(!$this->z['keywords_fuzzy']) { // Exact matching $keywordid = $this->db->get_keyword($keyword,0); } else { // Fuzzy matching // Delete stopwords first #$keyword = trim(lib_stopwords($keyword)); // Compute metaphone now $mphone = metaphone($keyword); if(!$mphone) return ( FALSE ); $keywordid = ""; $words = $this->db->getsql("SELECT * FROM adrev_keywords WHERE fuzzy_keyword=?", array($mphone)); if(count($words) > 0) { // Look for the one that is closest using a reverse bubble sort $keywordid = $words[0]['id']; $z = 100; foreach($words as $w) { // Lookup the distance between these candidates we got back // for the best fuzzy match $l = levenshtein($w['keyword'], $keyword); if($l <= $z) { $keywordid = $w['id']; $z = $l; } } } } // We have no keyword ID if(!$keywordid) { return ( FALSE ); } else { // Grab the ID and the keyword rate $this->keywordid = $keywordid; $w = $this->db->getsql("SELECT mincpc FROM adrev_keywords WHERE id=?", array($keywordid)); $this->keywordrate = $w[0]['mincpc'] ? $w[0]['mincpc'] : $this->default['adrevenue']['min_bid']; } //Try from the keyword cache $ads = lib_cache_get("zoneads" . $keywordid, $this->zone); // If the cache is empty, grab from the DB // Decide on the sort order if($this->z['ad_sort'] == "bid") $order = "ORDER BY c.bid DESC"; // Grab ads with a specific keyword id $ads = $this->db->getsql("SELECT a.id,a.userid,a.bid,a.zid,a.daypart_days, a.daypart_hours,a.startdate,a.expires,a.units,a.total_units FROm adrev_ads a, adrev_users b, adrev_keyword_map c WHERE a.userid=b.id AND a.id=c.adid AND a.zone=? AND a.status='1' AND c.keywordid=? AND b.balance >0 $order", array($this->zone, $keywordid)); if(count($ads) > 0 && $this->default['adrevenue']['cache'] > 0) { lib_cache_put("zoneads" . $keywordid, $this->zone, $ads); } } $n = count($ads); // We have no ads if($n == 0) { // Try for a default ad if($this->z['default_ad'] > 0) $ads = $this->db->getsql("SELECT id,userid FROM adrev_ads WHERE id=?", array($this->z['default_ad'])); if(count($ads) == 0) return( FALSE ); } // Setup a simple array of the ads // Makes it easier to manipulate later $a = array(); foreach($ads as $ad) { // Are we before start date? Skip the ad then if($ad['startdate'] > 0 && $ad['startdate'] > time()) continue; // Do we have dayparting turned on? if($ad['daypart_hours'] > 0 && $ad['daypart_days'] > 0) { $day = date("w"); $hour = date("G"); if(!in_array($hour, lib_bit_options($ad['daypart_hours'])) && $ad['daypart_hours'] > 0) continue; if(!in_array($day, lib_bit_options($ad['daypart_days'])) && $ad['daypart_days'] > 0) continue; } $a[] = $ad; } // Order the set randomly if we requested it reset($a); if($this->z['ad_sort'] == "rand") shuffle($a); // Grab the quantity we need reset($a); if($n > $this->z['max_display_ads']) $a = array_slice($a, 0, $this->z['max_display_ads']); // Set the number of ads to get back $this->adlist = $a; return ( TRUE ); } } ?>
  8. Just to make myself more clear ::: I got a php script here and I want to remove the CDATA fo XML output. What should I do? SInce, I don't have much time to look through, would really appreciate a timely help from your side. Thanks in advance.
  9. I need the "cdata" removed from this XML output
  10. i am sorry but i didnt find one....searched again but no result....i kno wht cms is, but what i would like to know is what cms(drupal or joomla or etc.) is being used in those scripts?
  11. i got a third party script but to begin with i need to know what cms is implemented? i am a noob here... :-( please help... how do i make the first step and what should it be? read through the files but found it to be php with no difference...so how do i differentiate?
  12. yes thorpe....i respect the board's title and its purpose but i just couldn't seem to fit this piece of questionnaire in any other forum section....and i read an intro frm jus nw in the faq's about code finding...i was jus wondering if anyone might pop-up if they had any... NB: i post after i search and implement and it doesnt seem to work...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.