Jump to content

brentman

Members
  • Posts

    65
  • Joined

  • Last visited

Everything posted by brentman

  1. I think you want this: $ip = $_SERVER['REMOTE_ADDR'];
  2. I am not that great with mysql so I have not considered it. But in terms of system resources, better to do a complex pull from database or to pull all data and sort it out in php? I generally figure to use the DB as little as possible is best but I am sure there would be exceptions.
  3. There will be between aprox 10 and 500 records in db. The user will fill in about 10 options. I need to get all records that fit the requirements of the user and then "randomly" select one but sometimes the options will be weighted depending on specific settings in the db records. The db records are also user inputted. I found a nice weighted random selector function but I need to get the "Allowed" DB Records in an array. SO, this portion of code that is currently if's is in a loop and upon meeting all requirements it gets added to the array.
  4. This isn't a problem if multiple elseif's are satisified? Could I use a conditional switch like this instead? The reason I don't like mine made of nested if/elses is because i believe its slow and all my ifs are actually just to redirect people to the next page of my site, literally every click is going through this so saving resources is important. Plus its true its a mess. I made a change and it took me awhile to sort it out.
  5. Forgot to mention some user inputs are this OR this so a single case or single if statement would need like x AND x AND x AND ( a OR b) AND etc
  6. Here is my example: //User Inputs $number $letter $option 1,2,3,4, or 5 $true or false etc Like 10 different things //Here starts the if if ($number = 5) { //not allowed } else { if ($letter == a) { //not allowed } else { if ($option > 2) { //not allowed } else { ...... nested through all options echo "ALLOWED"; } } } If i do it with switches it would need to be like: switch case "$number !=5 AND $letter != 'a' AND $option <= 2 AND etc etc" { } But I tried this first and was having problems logically making it function correctly because there are so many variables to fit in there correctly. Any suggestions?
  7. I am building a bid function that will display the best available ad inventory to the current user. I have a record for user like so: $user_record = interest, gender, country I am then pulling all available records to array for available ad inventory to find all eligible ads: $ad_array = budget, interest, gender, country (for a whole table) So I want to only pull those with remaining budget (ie like $budget>$.50), if interest is set, only if interest = interest, if gender is set, only if gender = gender, if country is set, only if country=country Now there may be 1 or there may be 20 or more ad campaigns in the array. But I want to remove the ones that do not fit certain rules. //GETS THE USER RECORD $result = mysql_query("SELECT user_record FROM usertable WHERE user_record = '$user_record'"); $row = mysql_fetch_row($result); //GETS ALL AD CAMPAIGNS $query = "SELECT * FROM campaigns"; $result = mysql_query($query); //MAKES ARRAY FOR ONLY ELIGIBLE CAMPAIGNS ????? So what code to I put for the ?????? that will remove ad campaigns that are not eligible, leaving only eligible campaigns in the array?
  8. I want to build a advertising bid system like adwords but a much more bare bones version for people to bid on leads. I have an enormous amount of leads so this would help me monetize them. I have my database where I am adding new leads regularly like so: ID, email, phone, sex, interests, opt in date, opt in ip But now I want to build an advertising website where each person can sign up, log in etc etc. Thats all easy enough. I am so lost on how to do the logic for lead selection!!! I want each advertiser to select category and set a bid amount like $1 or $0.75 etc with their budget. Then it selects the highest bid with still available budget, adds the lead info to their account. But then I don't want the leads to be exclusive but I don't want to continually have it choose old leads or only fresh leads so advertisers get an average quality across all leads. This is like blowing my mind complicated for me. I know php moderately well and am extremely good at following directions once something is planned out and looking up particular commands if I get stuck, so no problem going point by point through a build. Just don't know how to plan this. Please help! Where to start?
  9. So since I am only doing this one thing only, is the email valid output 1 2 or 3 then if I spit it out in xml format in response to a GET request then I have a very basic RESTful API? Cool! Thanks!
  10. Thanks that was helpful! I got it working, I just wasn't sure if I was going in the right direction. No idea how to write an API. But doesn't the API just spit out the info on the page pretty much like what I am doing? Also I am trying to make this pretty. (ie short) because since its a service, I am going to have all sorts of people putting this code on their pages, right now it works but its a cURL along with an if statement for the error outputs. So I still need to figure out if there is anything I can do in this respect too.
  11. I have tons of lead verification information stored in a database on my server for emails, phone, name, address and large blacklists etc. I have created a simple way to call the info so it spits out as the ONLY output from a query is a single number. Either 0 for valid, 1 for fraud, 2 for incorrect. I want to start with just email information for this example... So I want people to be able to call my page on their registration forms to check if they have valid users. I tried file_get_contents with the url + variable appended to be checked but it only spits out the answer you would get with no variable appended. Plus I also have the problem as the form submit, how can they click submit once, have it check the info, then actually submit if its valid but return an error if not? What is the best way to do this?
  12. Can you put this on your page: header( 'Location: http://www.yoursite.com/new_page.html' ); Just dont have any outputs to the browser before this or it won't work for sure...
  13. So I have this killer script I wrote for article management across multiple sites. I am trying to make a drip feed so you can set up a bunch of articles for one site to drip out over x amount of days. Then you could do that for your next site etc... so you do not need to manage all of your 20 blogs/sites a day. So, I am thinking I have all these variables in a table: Table 1 Article - URL for article - Title - Keywords - Anchor Text - URL link - Category - Site to post to ID Table 2... URL - Date Posted - Drip Feed (maybe include category here because in table 1 it will repeat category for every row of the same url) Then I make a script that runs on a cron job every 2-4 hrs... Not sure the best way to make the script and also not sure the best way to post this info to different sites... ideally id like to be able to post to joomla, wordpress, blogspots, etc... basically many different kinds of sites. Any suggestions would be appreciated... no need for you to write the code I can do that, just need a plan.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.