function generateScript($adLinkData) { $userID = osBackUserID(); $code = 0; if (osUserLogedin()) { /* User is logedin */ query("SELECT * FROM publink_info WHERE adLinkUID=" . $adLinkData['adUID'] . " AND publisher={$userID}"); $code = "!"; if ($row = fetch()) { /* pubLink exist */ $code = $row['pubUID']; } else { /* pubLink does not exist */ $PPV = $adLinkData['AOPV'] * $adLinkData['APRate']; $q = "INSERT INTO publink_info(adLinkUID,YTID,publisher,totalView,AOPV,PPV) "; $q .= "VALUES('" . $adLinkData['adUID'] . "','" . $adLinkData['videoCode'] . "','{$userID}','0','" . $adLinkData['AOPV'] . "','{$PPV}')"; query($q); $code = mysql_insert_id(); } } return $code; }
function bookReimburse($amount, $comments) { $this->INSERT(osBackUserID(), date("Y/m/d"), "Reimburse", $amount, $comments); }
function stop($id) { $d = date("d"); $m = date("m"); $y = date("Y"); /* fetch the link */ query(" SELECT * FROM adlink_info WHERE adUID={$id} "); if ($row = fetch()) { $timeUnlock = date("Y/m/d", mktime(0, 0, 0, $m, $d - $row['minCancelTime'], $y)) >= $row['startDate']; /* * Check IF it is running (running==1) * && publishe is logedin * && more than minLifeTime passed */ if ($row['advertisor'] == osBackUserID() && $row['running'] == 1 && $timeUnlock) { /* * thus stop it (running=-1) */ $lastDate = date("Y/m/d", mktime(0, 0, 0, $m, $d + $row['minLifeTime'], $y)); $q = "UPDATE adlink_info as d SET d.lastDate='" . $lastDate . "' , d.running=-1 WHERE d.adUID={$id}"; query($q); return TRUE; } } return FALSE; }
function onDoLoginBtn($info) { $u = new user(""); $u->login($info['email'], $info['password']); switch ($u->loggedIn) { case -1: $this->msg = "Incorrect Password"; $this->_bookframe("frmMain"); break; case -2: $this->msg = "Account does not exist"; $this->_bookframe("frmMain"); break; case 1: $this->msg = ""; $t = new transaction(""); $this->balance = $t->backBalance(osBackUserID()); $this->_bookframe("frmWelcome"); break; case 2: $this->msg = ""; $this->email = $info['email']; $this->password = $info['password']; $this->_bookframe("frmValidation"); break; } }
function reCalc() { $t = new transaction(""); $all = $t->backUserSummary(osBackUserID()); $this->balance = $all['Balance']; $this->paid = $all['Charge']; $this->adpay = $all['adPay']; $this->earned = $all['Earn']; $this->withdrawn = $all['Withdrawn']; $this->reimbursed = $all['Reimburse']; }
function onAddVideo($info) { $of = $this->offer->backInfo(); $t = new transaction(""); $balance = $t->backBalance(osBackUserID()); $e = ""; if (strpos($info['link'], "www.youtube.com/watch?v=") === FALSE && strpos($info['link'], "youtu.be/") === FALSE) { $e .= "Enter a valid link<br>"; } if ($info['AOPV'] < $of['minAOPV']) { $e .= "Minimum Offer should be " . $of['minAOPV'] . "<br>"; } if ($info['NOV'] < $of['minNOV']) { $e .= "Minimum Number of Views should be " . $of['minNOV'] . "<br>"; } if ($info['NOV'] * $info['AOPV'] != $info['total']) { $e .= "Invalid total value<br>"; } if (strlen($info['title']) < 2) { $e .= "Invalid Title<br>"; } if ($info['total'] > $balance) { $e .= "Insuffient balance<br>"; } if (strlen($e) < 2) { // NO ERROR $al = new adlink(""); $data = array(); $data['advertisor'] = osBackUserID(); $data['running'] = 1; $data['lastDate'] = ""; $data['startDate'] = date("Y/m/d"); $data['link'] = $info['link']; $data['title'] = $info['title']; $data['maxViews'] = $info['NOV']; $data['AOPV'] = $info['AOPV']; $data['paid'] = 0; $data['APRate'] = $of['APRatio']; $data['minLifeTime'] = $of['minLifeTime']; $data['minCancelTime'] = $of['minCancelTime']; $data['country'] = $info['country']; $data['paid'] = $info['total']; $al->bookLink($data); $emb = $al->backYEmbed($data['link']); $e = "Added Successfully<br>{$emb}"; $t = new transaction(""); $t->bookAdPay($info['AOPV'] * $info['NOV'], "Ad video - title: " . $info['title']); $this->_bookframe("frmSuccess"); } else { // HAS ERROR $e = "ERROR: <br>" . $e; $this->_bookframe("frm"); } $this->errMessage = $e; }
function onLogin($info) { $u = new user(""); if ($ud = $u->backUserData(osBackUserID())) { $this->balance = $ud['balance']; } }
function INSERT($UID, $date, $type, $amount, $comments) { $this->INSERTonly($UID, $date, $type, $amount, $comments); $this->backUserSummary(osBackUserID()); }
function stop($id) { $d = date("d"); $m = date("m"); $y = date("Y"); /* fetch the link */ query(" SELECT * FROM adlink_info WHERE adUID={$id} "); if ($row = fetch()) { $title = $row['title']; $timeUnlock = date("Y/m/d", mktime(0, 0, 0, $m, $d - $row['minLifeTime'], $y)) >= $row['startDate']; /* * Check IF it is running (running==1) * && publisher is logedin * && more than minLifeTime passed */ if ($row['advertisor'] == osBackUserID() && $row['running'] == 1 && $timeUnlock) { /* * thus stop it (running=-1) */ $lastDate = date("Y/m/d", mktime(0, 0, 0, $m, $d + $row['minCancelTime'], $y)); $q = "UPDATE adlink_info as d SET d.lastDate='" . $lastDate . "' , d.running=-1 WHERE d.adUID={$id}"; query($q); /* * Send email to all publisher of this video */ query("SELECT u.email as email, u.userName as name, p.pubUID as publink, p.YTID as ytid FROM publink_info as p, user_info as u where u.userUID=p.publisher AND p.totalView>0 and p.adLinkUID=" . $id); while ($row = fetch()) { $link = "http://www.RocketViews.com/watch?" . $row['publink'] . "a" . $row['ytid']; $msg = <<<PHTMLCODE \t\t\t\t\t\tHello {$row['name']}<br/> \t\t\t\t\t\t<br/> \t\t\t\t\t\tThe following video will stop from {$lastDate} <br /> \t\t\t\t\t\t<br /> \t\t\t\t\t\t<b><i>{$title}</i></b> \t\t\t\t\t\t<br/> \t\t\t\t\t\t<a href="{$link}" target="_blank">{$link}</a> \t\t\t\t\t PHTMLCODE; osMail("*****@*****.**", $row['email'], "Video Expiration", $msg); } return TRUE; } } return FALSE; }