ShibSta Posted October 1, 2006 Share Posted October 1, 2006 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 SiteThey 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 Quote Link to comment Share on other sites More sharing options...
AndyB Posted October 1, 2006 Share Posted October 1, 2006 [quote]Is there a mathematical way I can do this?[/quote]I bet there is, and you'll find it in the php help forum which is where I'm moving this thread. Quote Link to comment Share on other sites More sharing options...
ShibSta Posted October 3, 2006 Author Share Posted October 3, 2006 Bump^^I'd like to figure this out ASAP, please post your ideas! Quote Link to comment Share on other sites More sharing options...
Hi I Am Timbo Posted October 3, 2006 Share Posted October 3, 2006 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. Quote Link to comment Share on other sites More sharing options...
ShibSta Posted October 3, 2006 Author Share Posted October 3, 2006 True, I could do that... Anyway, few more questions...[b]1)[/b] Are decimals hard to deal with?[b]2)[/b] 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...)[b]3)[/b] 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 CreditBanner 1 >= 1 CreditBanner 1 DisplayedBanner 1 - 1 Credit -> In CronBanner 1 >= 1 CreditBanner 1 DisplayedBanner 1 - 1 Credit -> In CronCron RunsBanner 1 = -1 Credit Quote Link to comment Share on other sites More sharing options...
Hi I Am Timbo Posted October 4, 2006 Share Posted October 4, 2006 [quote author=ShibSta link=topic=110177.msg446400#msg446400 date=1159917634]True, I could do that... Anyway, few more questions...[b]1)[/b] Are decimals hard to deal with?[/quote]No. [quote author=ShibSta link=topic=110177.msg446400#msg446400 date=1159917634][b]2)[/b] 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...)[/quote].9 * .05 is 5% of .9. That is the same as .9 * 5 / 100.[quote author=ShibSta link=topic=110177.msg446400#msg446400 date=1159917634][b]3)[/b] 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 CreditBanner 1 >= 1 CreditBanner 1 DisplayedBanner 1 - 1 Credit -> In CronBanner 1 >= 1 CreditBanner 1 DisplayedBanner 1 - 1 Credit -> In CronCron RunsBanner 1 = -1 Credit[/quote]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. Quote Link to comment Share on other sites More sharing options...
ShibSta Posted October 4, 2006 Author Share Posted October 4, 2006 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... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.