Example #1
0
 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;
 }
Example #2
0
 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;
     }
 }
Example #3
0
    function frm()
    {
        if (!osUserLogedin()) {
            return <<<PHTMLCODE

\t\t\t\t<div class="addvideo_login_msg">Log in first</div>
\t\t\t
PHTMLCODE;
        }
        //else
        $formname = $this->_fullname;
        $of = $this->offer->backInfo();
        $t = new transaction("");
        $balance = $t->backBalance(osBackUserID());
        $countries = "<option value='any'>any</option>";
        query("SELECT DISTINCT CountryName FROM ip_country ORDER BY CountryName");
        $row = fetch();
        while ($row = fetch()) {
            $countries .= "<option value='" . $row['CountryName'] . "'>" . $row['CountryName'] . "</option>";
        }
        $html = <<<PHTMLCODE

\t\t\t<center><font color=red>{$this->errMessage}</font><br></center>
\t\t\t<form name="{$formname}" method="post">
\t\t\t\t<input type="hidden" name="_message" value="frame_addVideo" /><input type = "hidden" name="_target" value="{$this->_fullname}" />
\t\t\t\t<div class="addvideo_label">
\t\t\t\t\tTitle:
\t\t\t\t</div>
\t\t\t\t<div class="addvideo_field">
\t\t\t\t\t<input id="theTitle" name="title" size=40 onkeypress='setTimeout("checkTitle()",100)' onchange='JavaScript:checkTitle();'><span id="msgTitle"><font color="red">*</font></span><br />
\t\t\t\t</div>
\t\t\t\t<div class="addvideo_label">
\t\t\t\t\tYoutube link:
\t\t\t\t</div>
\t\t\t\t<div class="addvideo_field">
\t\t\t\t\t<input id="theYLink" name="link" size=40 onkeypress='setTimeout("checkYLink()",100)' onchange='JavaScript:checkYLink()'><span id="msgYLink"><font color="red">*</font></span><br />
\t\t\t\t</div>
\t\t\t\t<div class="addvideo_label">
\t\t\t\t\tYour Offer on Price/View:
\t\t\t\t</div>
\t\t\t\t<div class="addvideo_field">
\t\t\t\t\t<input id="theAOPV" name="AOPV" size=5 onkeypress='setTimeout("checkAOPV({$of['minAOPV']})",100)' onchange='JavaScript:checkAOPV({$of['minAOPV']})'> (min: {$of['minAOPV']})<span id="msgAOPV"><font color="red">*</font></span><br />
\t\t\t\t</div>
\t\t\t\t<div class="addvideo_label">
\t\t\t\t\tNumber of Viewes:
\t\t\t\t</div>
\t\t\t\t<div class="addvideo_field">
\t\t\t\t\t<input id="theNOV" name="NOV" size=5 onkeypress='setTimeout("checkNOV({$of['minNOV']})",100)' onchange='JavaScript:checkNOV({$of['minNOV']})'> (min: {$of['minNOV']})<span id="msgNOV"><font color="red">*</font></span><br />
\t\t\t\t</div>
\t\t\t\t<div class="addvideo_label">
\t\t\t\t\tCountry:
\t\t\t\t</div>
\t\t\t\t<div class="addvideo_field">
\t\t\t\t\t<SELECT name="country" style="width:150px;">{$countries}</SELECT>
\t\t\t\t</div>
\t\t\t\t<hr>
\t\t\t\t<div class="addvideo_label">
\t\t\t\t\tTotal:
\t\t\t\t</div>
\t\t\t\t<div class="addvideo_field">
\t\t\t\t\t\$<input type="text" class="total_price" value="0" name="total" id="theTotal" size=10 disabled/><span id="msgTotal"></span><br />
\t\t\t\t</div>
\t\t\t\t<div class="addvideo_label">
\t\t\t\t\tBalance:
\t\t\t\t</div>
\t\t\t\t<div class="addvideo_field">
\t\t\t\t\t\$<span id="theBalance">{$balance}</span><br />
\t\t\t\t</div>
\t\t\t\t<input style="float:right;" id="theButton" disabled type="button" value="Submit" onclick = 'JavaScript:sndmsg("{$formname}")'>
\t\t\t</form>
\t\t
PHTMLCODE;
        $this->errMessage = "";
        return $html;
    }