stop serve ads after user point going low

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    stop serve ads after user point going low

    any coder plz help me how to stop serve ads after user points gettin low and set by minimum points in adcell mobi script
    Last edited by Nepsalone; 10.01.13, 11:23.

    #2
    PHP Code:
    <?php
    require_once("../includes/config.php");
    require_once(
    "../includes/functions.php");
    ob_start();
    db_connect();
    $uid htmlspecialchars($_GET['uid']);
    $ua htmlspecialchars($_GET['HTTP_USER_AGENT']);
    $ip htmlspecialchars($_GET['REMOTE_ADDR']);
    $adult htmlspecialchars($_GET['adult']);
    $mode htmlspecialchars($_GET['mode']);
    if(
    $mode == 'live')
    {
    if(
    $adult == 'on')
    {
    $sql mysql_query("SELECT * FROM adverts WHERE pause='0' AND approved='1' AND userid !='$uid' AND ORDER BY RAND() LIMIT 1") or die(mysql_error());
    }
    else
    {
    $sql mysql_query("SELECT * FROM adverts WHERE pause='0' AND approved='1' AND adult='0' AND userid !='$uid' AND points >='30' ORDER BY RAND() LIMIT 1") or die(mysql_error());
    }
    while(
    $ad mysql_fetch_array($sql))
    {
       
    $t htmlspecialchars($ad['title']);
       
    $l htmlspecialchars($ad['link']);
       
    $imp $ad['imps']+1;
       
    mysql_query("UPDATE adverts SET imps='".$imp."' WHERE id='".$ad['id']."'") or die(mysql_error());
       
       
    $adv mysql_fetch_array(mysql_query("SELECT * FROM advertiser WHERE id='".$ad['userid']."'")) or die(mysql_error());
       
    $it1 $adv['today_imps']+1;
       
    $ti1 $adv['total_imps']+1;
       
    mysql_query("UPDATE advertiser SET today_imps='$it1', total_imps='$ti1' WHERE id='".$ad['userid']."'") or die(mysql_error());
       
       
    $pub mysql_fetch_array(mysql_query("SELECT * FROM publisher WHERE id='".$uid."'")) or die(mysql_error());
       
    $it2 $pub['today_imps']+1;
       
    $ti2 $pub['total_imps']+1;
       
    mysql_query("UPDATE publisher SET today_imps='$it2', total_imps='$ti2' WHERE id='".$uid."'") or die(mysql_error());
       
    $ph explode(" ",$ua);
       
    $title str_ireplace("%phn%""$ph[0]""$t");
       echo
    "<a href='".SITE_URL."/serve/click/".$ad['userid']."/".$uid."/".base64_encode($l)."'>$title</a>";
    }
    }
    else
    {
    echo
    "<a href='".SITE_URL."/serve/test/".base64_encode("http://nepalwap.com/ad")."'>Test AD: Free Mobile Downloads!</a>";
    }
    mysql_close();
    ?>
    Last edited by Nepsalone; 14.01.13, 12:50.

    Comment


      #3
      post the database table structure where the points are stored.
      Advertise your mobile site for FREE with AdTwirl

      Comment


        #4
        PHP Code:
        <?php
         $ap 
        mysql_fetch_array(mysql_query("SELECT points FROM advertiser WHERE id='$id'"));
           
        $pp mysql_fetch_array(mysql_query("SELECT points FROM publisher WHERE id='$id'"));?>

        Comment


          #5
          PHP Code:
          $sql mysql_query("SELECT adverts.* FROM adverts, advertiser WHERE adverts.pause='0' AND adverts.approved='1' AND adverts.userid !='$uid' AND advertiser.id=adverts.userid AND advertiser.points>0 ORDER BY RAND() LIMIT 1") or die(mysql_error()); 
          Advertise your mobile site for FREE with AdTwirl

          Comment


            #6
            Originally posted by GumSlone View Post
            PHP Code:
             FROM advertsadvertiser 
            can you select two tables like that without a join?

            Comment


              #7
              thanx gum im trying like that
              $ap= advertiser points
              $pp=publisher points

              Comment


                #8
                -- phpMyAdmin SQL Dump
                -- version 3.3.9
                -- phpMyAdmin
                --
                -- Host: localhost
                -- Generation Time: Jan 16, 2013 at 11:03 AM
                -- Server version: 5.5.8
                -- PHP Version: 5.3.5

                SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";


                /*!40101 SET @OLD_CHARACTER_SET_CLIENT@CHARACTER_SET_CLIENT */;
                /*!40101 SET @OLD_CHARACTER_SET_RESULTS@CHARACTER_SET_RESULTS */;
                /*!40101 SET @OLD_COLLATION_CONNECTION@COLLATION_CONNECTION */;
                /*!40101 SET NAMES utf8 */;

                --
                -- Database: `ads`
                --

                -- --------------------------------------------------------

                --
                -- Table structure for table `advertiser`
                --

                CREATE TABLE IF NOT EXISTS `advertiser` (
                `id` int(10) NOT NULL,
                `points` int(20) NOT NULL DEFAULT '0',
                `today_is` date NOT NULL DEFAULT '0000-00-00',
                `today_imps` int(10) NOT NULL,
                `today_clicks` int(10) NOT NULL,
                `total_imps` int(10) NOT NULL,
                `total_clicks` int(10) NOT NULL,
                `total_ads` int(11) NOT NULL
                ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

                --
                -- Dumping data for table `advertiser`
                --

                INSERT INTO `advertiser` (`id`, `points`, `today_is`, `today_imps`, `today_clicks`, `total_imps`, `total_clicks`, `total_ads`) VALUES
                (1, 1330, '2013-01-16', 0, 0, 1598, 962, 0),
                (3, 500, '2013-01-04', 262, 4, 262, 4, 0),
                (4, 450, '2013-01-16', 0, 0, 0, 0, 0);

                Added after 12 minutes:

                gums bro plz help me if you want full database msgs me because im unable to upload my full data
                Last edited by Nepsalone; 16.01.13, 10:22.

                Comment


                  #9
                  Originally posted by something else View Post
                  can you select two tables like that without a join?
                  yes, its should work

                  Originally posted by Nepsalone View Post
                  thanx gum im trying like that
                  $ap= advertiser points
                  $pp=publisher points
                  so my code which ive posted above is not working?
                  Advertise your mobile site for FREE with AdTwirl

                  Comment


                    #10
                    sorry gums bro ur code not working which you create for me.

                    Comment


                      #11
                      can you post the error?
                      Advertise your mobile site for FREE with AdTwirl

                      Comment


                        #12
                        im unable to post error msgs now because im usin mobile. if you post edited code in zip then i upload ds file in my server after im able to show error msgs. Sorry for bad english .
                        Hope u help me

                        Originally posted by Nepsalone View Post
                        im unable to post error msgs now because im usin mobile. if you post edited code in zip then i upload ds file in my server after im able to show error msgs. Sorry for bad english .
                        Hope u help me
                        here is serve dir all files in zip
                        Attached Files
                        Last edited by Nepsalone; 16.01.13, 13:56.

                        Comment


                          #13
                          PHP Code:
                          <?php
                          require_once("../includes/config.php");
                          require_once(
                          "../includes/functions.php");
                          ob_start();
                          db_connect();
                          $uid htmlspecialchars($_GET['uid']);
                          $ua htmlspecialchars($_GET['HTTP_USER_AGENT']);
                          $ip htmlspecialchars($_GET['REMOTE_ADDR']);
                          $adult htmlspecialchars($_GET['adult']);
                          $mode htmlspecialchars($_GET['mode']);
                          if(
                          $mode == 'live')
                          {
                          if(
                          $adult == 'on')
                          {
                          $sql mysql_query("SELECT adverts.* FROM adverts, advertiser WHERE adverts.pause='0' AND adverts.approved='1' AND adverts.userid !='$uid' AND advertiser.id=adverts.userid AND advertiser.points>0 ORDER BY RAND() LIMIT 1") or die(mysql_error()); 
                          }
                          else
                          {
                          $sql mysql_query("SELECT adverts.* FROM adverts, advertiser WHERE adverts.pause='0' AND adverts.approved='1' AND adverts.adult='0' AND adverts.userid !='$uid' AND advertiser.id=adverts.userid AND advertiser.points>0 ORDER BY RAND() LIMIT 1") or die(mysql_error()); 
                          }
                          while(
                          $ad mysql_fetch_array($sql))
                          {
                             
                          $t htmlspecialchars($ad['title']);
                             
                          $l htmlspecialchars($ad['link']);
                             
                          $imp $ad['imps']+1;
                             
                          mysql_query("UPDATE adverts SET imps='".$imp."' WHERE id='".$ad['id']."'") or die(mysql_error());
                             
                             
                          $adv mysql_fetch_array(mysql_query("SELECT * FROM advertiser WHERE id='".$ad['userid']."'")) or die(mysql_error());
                             
                          $it1 $adv['today_imps']+1;
                             
                          $ti1 $adv['total_imps']+1;
                             
                          mysql_query("UPDATE advertiser SET today_imps='$it1', total_imps='$ti1' WHERE id='".$ad['userid']."'") or die(mysql_error());
                             
                             
                          $pub mysql_fetch_array(mysql_query("SELECT * FROM publisher WHERE id='".$uid."'")) or die(mysql_error());
                             
                          $it2 $pub['today_imps']+1;
                             
                          $ti2 $pub['total_imps']+1;
                             
                          mysql_query("UPDATE publisher SET today_imps='$it2', total_imps='$ti2' WHERE id='".$uid."'") or die(mysql_error());
                             
                          $ph explode(" ",$ua);
                             
                          $title str_ireplace("%phn%""$ph[0]""$t");
                             echo
                          "<a href='".SITE_URL."/serve/click/".$ad['userid']."/".$uid."/".base64_encode($l)."'>$title</a>";
                          }
                          }
                          else
                          {
                          echo
                          "<a href='".SITE_URL."/serve/test/".base64_encode("http://nepalwap.com/ad")."'>Test AD: Free Mobile Downloads!</a>";
                          }
                          mysql_close();
                          ?>
                          post the error which you get with this code
                          Advertise your mobile site for FREE with AdTwirl

                          Comment


                            #14
                            check it nepalwap.com/ad/index.php

                            Added after 4 minutes:

                            You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '! ='4' AND advertiser.id=adverts.userid AND advertiser.points>0 ORDER BY RAND() ' at line 1
                            Last edited by Nepsalone; 16.01.13, 14:34.

                            Comment


                              #15
                              Code:
                              CREATE TABLE `advertiser` (
                                `id` int(10) NOT NULL,
                                `points` int(20) NOT NULL DEFAULT '0',
                                `today_is` date NOT NULL DEFAULT '0000-00-00',
                                `today_imps` int(10) NOT NULL,
                                `today_clicks` int(10) NOT NULL,
                                `total_imps` int(10) NOT NULL,
                                `total_clicks` int(10) NOT NULL,
                                `total_ads` int(11) NOT NULL
                              ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
                              
                              --
                              -- Daten für Tabelle `advertiser`
                              --
                              
                              INSERT INTO `advertiser` (`id`, `points`, `today_is`, `today_imps`, `today_clicks`, `total_imps`, `total_clicks`, `total_ads`) VALUES
                              (1, 1330, '2013-01-16', 0, 0, 1598, 962, 0),
                              (3, 500, '2013-01-04', 262, 4, 262, 4, 0),
                              (4, 450, '2013-01-16', 0, 0, 0, 0, 0);
                              
                              -- --------------------------------------------------------
                              
                              --
                              -- Tabellenstruktur für Tabelle `adverts`
                              --
                              
                              CREATE TABLE `adverts` (
                                `id` int(11) NOT NULL AUTO_INCREMENT,
                                `userid` int(11) NOT NULL,
                                `pause` int(1) NOT NULL,
                                `approved` int(1) NOT NULL,
                                `adult` int(1) NOT NULL,
                                PRIMARY KEY (`id`)
                              ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
                              
                              --
                              -- Daten für Tabelle `adverts`
                              --
                              
                              INSERT INTO `adverts` (`id`, `userid`, `pause`, `approved`, `adult`) VALUES
                              (1, 1, 0, 1, 0),
                              (3, 3, 0, 1, 0),
                              (4, 4, 0, 1, 0);
                              and
                              Code:
                              SELECT adverts . * 
                              FROM adverts, advertiser
                              WHERE adverts.pause = '0'
                              AND adverts.approved = '1'
                              AND adverts.userid != '1'
                              AND advertiser.id = adverts.userid
                              AND advertiser.points >0
                              ORDER BY RAND( ) 
                              LIMIT 1
                              works for me, see the attachment
                              Attached Files
                              Advertise your mobile site for FREE with AdTwirl

                              Comment

                              Working...
                              X