Results 1 to 4 of 4

Thread: pay per click model

  1. #1
    Join Date
    Jan 2002
    Posts
    58

    Default pay per click model

    How simple would it be to create a hack that suspends a link after it has been clicked a certain number of times? We would manually input a click limit for the link so we could sell manually. Unless of course a high quality ppc addon is being worked on

  2. #2
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    just off the top of my head:

    add two custom fields to the idx_links table. ppc_hits and ppc_limit. both integer type ( mediumint(9) if you use phpmyadmin ).

    change your go.php file as follows:
    Code:
    <?php
    
    include("application.php");
    
    session_start();
    
    // check if suspended
    
    $conn = ConnectDB();
    
    $query = "select suspended, ppc_hits, ppc_limit from idx_link where link_id = '$id'";
    $result = $conn->Execute($query);
    $suspended = $result->Fields("suspended");
    $ppc_hits = $result->Fields("ppc_hits");
    $ppc_limit = $result->Fields("ppc_limit");
    
    
    if($suspended) {
      $theme_name = GetTheme($COOKIE_USERNAME);
      if(empty($theme_name)) $theme_name = "default";
    
      $theme_path = $theme_path.$theme_name."/";
      include($theme_path."msg.php");
    
      DisplayTemplate($theme_path."header.html","\$title,\$cat");
    	DisplayTemplate($theme_path."suspended.html","\$novar");
      DisplayTemplate($theme_path."footer.html","\$cat,\$ma");  
    	exit();
    }
    
    if($ppc_hits => ppc_limit ) {
      $theme_name = GetTheme($COOKIE_USERNAME);
      if(empty($theme_name)) $theme_name = "default";
    
      $theme_path = $theme_path.$theme_name."/";
      include($theme_path."msg.php");
    
      DisplayTemplate($theme_path."header.html","\$title,\$cat");
    	DisplayTemplate($theme_path."ppc_exceeded.html","\$novar");
      DisplayTemplate($theme_path."footer.html","\$cat,\$ma");  
    	exit();
    }
    
    $links_obj = new clsLink;
    $links_obj->InitDB($dbServer,$dbHostname,$dbUsername,$dbPassword,$dbName);
    $links_obj->table_name = "idx_link";
    $links_obj->hot_limit = $hot_limit;
    
    $ses_links = explode(";",$_SESSION['indexu_session_links']);
    
      if(!in_array($id,$ses_links) || count($ses_links)==0) {
        $_SESSION['indexu_session_links'] = $_SESSION['indexu_session_links']."$id;";
        
        $links_obj->Go($id,true);
    	}
    	else {
    	  $links_obj->Go($id,false);
    	}
    ?>
    open the suspended.html file, make changes as appropriate and save as ppc_exceeded.html.

    Finally, find the go function in link.class.php and make the following changes:
    Code:
      function Go($id,$count=true) {
    
        
    		
    		// get current hits
        $query = "select hits, url, ppc_hits from $this->table_name where link_id=$id";
        $result = $this->db_connect->Execute($query);
        $url = $result->Fields("url");
        $hits = $result->Fields("hits");
        $ppc_hits = $result->Fields("ppc_hits");
    
    		if($count) {
          // update hits
          $query = "update $this->table_name set hits = ($hits + 1) ppc_hits = ( $ppc_hits + 1 ) where link_id = $id";
          $result = $this->db_connect->Execute($query);
    This is untested. so use at your own risk. please post any flaws...

    hmmm, I just re-read your post. It doesn't suspend the link. Just won't allow the go ( to homepage ) to work..

    I'm off for some fried chicken. but may take a look at suspending the account later tonite.
    Last edited by esm; 07-28-2003 at 04:31 PM.
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  3. #3
    Join Date
    Jan 2002
    Posts
    58

    Default

    Damn that was fast.

    I was thinking of making it part of sponsored links so I can either put a date OR a click limit before it expires. Then when go.php is clicked it finds the link and subtracts 1 from total clicks allowed.

  4. #4
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    Originally posted by player
    Damn that was fast.
    well, I have been struggling with the shopping cart software and I needed a break....after dealing with it, I certainly appreciate dody's work on INDEXU.

    Originally posted by player
    I was thinking of making it part of sponsored links so I can either put a date OR a click limit before it expires. Then when go.php is clicked it finds the link and subtracts 1 from total clicks allowed.
    instead of the above, try the following:
    add a custom field ppc_hits to the idx_links table as an integer type ( mediumint(9) if you use phpmyadmin ).

    find the go function in link.class.php and replace it completely with the following:
    Code:
      function Go($id,$count=true) {
    // get current hits
        $query = "select hits, url, ppc_hits from $this->table_name where link_id=$id";
        $result = $this->db_connect->Execute($query);
        $url = $result->Fields("url");
        $hits = $result->Fields("hits");
        $ppc_hits = $result->Fields("ppc_hits");
    if($count) {
    hits = $hits + 1;
    if ( $ppc_hits > 0 ) $ppc_hits = $ppc_hits - 1;
    
          // update hits
          $query = "update $this->table_name set hits = $hits  ppc_hits = ppc_hits  where link_id = $id";
          $result = $this->db_connect->Execute($query);
    }
    
        header("Location: $url");
    
    if ( ppc_hits = 0 )
          $query = "update $this->table_name set suspended = 1 where link_id = $id";
          $result = $this->db_connect->Execute($query);
      }
    the code in red are the changes.

    Once, again I have not tested the above, so let me know of any bugs...
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

Similar Threads

  1. pay per click with keywords
    By cyberseeker in forum v3.2
    Replies: 0
    Last Post: 04-24-2002, 04:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •