Jump to content


Photo

Banner Exchange Credit System


  • Please log in to reply
6 replies to this topic

#1 ShibSta

ShibSta
  • Members
  • PipPipPip
  • Advanced Member
  • 112 posts

Posted 01 October 2006 - 10:43 PM

I am trying to make a banner exchange which I can define the return ratio in the configuration file.
For ex. If I insert a 10:9 ratio...
Every 10 Banner Impressions They Have On Their Site
They Receive 9 Banner Impressions On Other Sites...

The problem is: How would I do this in php?
I know I could give 9 credits on each impression and remove 10 on each given impression but that seems like a lazy way and inaccurate count in credits.
I know I could take the credits and divide by 10 to get the real amount. I'd like to find a way to bypass all that lazy stuff.
Is there a mathematical way I can do this?

Thanks

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 01 October 2006 - 11:46 PM

Is there a mathematical way I can do this?


I bet there is, and you'll find it in the php help forum which is where I'm moving this thread.
Legend has it that reading the manual never killed anyone.
My site

#3 ShibSta

ShibSta
  • Members
  • PipPipPip
  • Advanced Member
  • 112 posts

Posted 03 October 2006 - 03:48 AM

Bump^^
I'd like to figure this out ASAP, please post your ideas!

#4 Hi I Am Timbo

Hi I Am Timbo
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 03 October 2006 - 04:02 AM

Well, do they need to earn 10 impressions in order to get the 9? 

How about just adding 9/10 of a credit for each impression?  Then they require at least one credit to get an impression.  This would mean they wouldn't get an impression for the first impression, but would for the nine subsequent impressions.

#5 ShibSta

ShibSta
  • Members
  • PipPipPip
  • Advanced Member
  • 112 posts

Posted 03 October 2006 - 11:20 PM

True, I could do that... Anyway, few more questions...
1) Are decimals hard to deal with?
2) Lets say I want an affiliate system where they get 5% of what the affiliate gets... How would I determine 5% of 0.9?
----(Sorry, been a long time since I messed with percentages...)
3) I don't want several mysql connections at once... Since this is a banner exchange, there would be hundreds or thousands a second... I was thinking of  using a cron. However, the problem with that is the person has to have 1 credit or more to get an impression... If he already got the impression but that impression is in cron he may get another and then have a negative credit count...
Ex.
Banner 1 = 1 Credit
Banner 1 >= 1 Credit
Banner 1 Displayed
Banner 1 - 1 Credit -> In Cron
Banner 1 >= 1 Credit
Banner 1 Displayed
Banner 1 - 1 Credit -> In Cron
Cron Runs
Banner 1 = -1 Credit

#6 Hi I Am Timbo

Hi I Am Timbo
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 04 October 2006 - 03:27 AM

True, I could do that... Anyway, few more questions...
1) Are decimals hard to deal with?

No. 

2) Lets say I want an affiliate system where they get 5% of what the affiliate gets... How would I determine 5% of 0.9?
----(Sorry, been a long time since I messed with percentages...)

.9 * .05 is 5% of .9.  That is the same as .9 * 5 / 100.

3) I don't want several mysql connections at once... Since this is a banner exchange, there would be hundreds or thousands a second... I was thinking of  using a cron. However, the problem with that is the person has to have 1 credit or more to get an impression... If he already got the impression but that impression is in cron he may get another and then have a negative credit count...
Ex.
Banner 1 = 1 Credit
Banner 1 >= 1 Credit
Banner 1 Displayed
Banner 1 - 1 Credit -> In Cron
Banner 1 >= 1 Credit
Banner 1 Displayed
Banner 1 - 1 Credit -> In Cron
Cron Runs
Banner 1 = -1 Credit

How would you get the data to cron?  You are going to have to have multiple connections to something, and a database is way better at that than a flat file.

Just a side note, and I am trying as hard as I can to not be insulting in this statement.  I'm wondering why you are making a banner exchange.  I believe there are plenty of free banner exchanges out there; and, they kind of went out of style around 1998.

#7 ShibSta

ShibSta
  • Members
  • PipPipPip
  • Advanced Member
  • 112 posts

Posted 04 October 2006 - 03:52 AM

I'd make a cron by having my PHP code write queries to a file (protected by .htaccess) which is then processed by a php file thats ran by the cron.
Wouldn't that many connections on a database be too many? I mean, hundreds a minutes for a new exchange alone...

I am making a banner exchange because I:
1) Am trying to learn PHP, this is my first fairly large project.
2) I own an arcade and owning a banner exchange will be that much better...
--Kinda like owning a football team and a stadium..
3) I want a script that I made and I'm familar with the source code and how it's layed out so that I can easily upgrade and constantly add new features...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users