Jump to content

mschrank99

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Posts posted by mschrank99

  1. Yeah.

     

    Create a random number up to a maximum, say 100.

     

    If < 25 then you have a 25% chance of doing a

    If > 50 then you have a 50% chance of doing b

    If > 25 then you have a 75% chance of doing c

     

    You see what I'm getting at. Change the numbers and get your brain in a mathematical mood and find the correct numbers for what you want to do. The max random number and the individual numbers will vary depending on how many choices you want and the intended %'s but that is the basic solution.

  2. Hi,

     

    Let's say I have an array like this:

     

    $array[0] = "ball";

    $array[1] = "bat";

    $array[2] = "glove";

    $array[3] = "referee";

    $array[4] = "strike";

    $array[5] = "home run";

     

    Now, let's say I want to get rid of [3] but move the next values up, automatically, into 3,4.

     

    For example,

     

    $array[0] = "ball";

    $array[1] = "bat";

    $array[2] = "glove";

    $array[3] = "strike";

    $array[4] = "home run";

     

    Is there a way to simply do this? I could do it using for loops, but is there a simpler way, like a built in function, that will do this for me?

     

    Thanks,

     

    Matthew

     

     

  3. What I would love to have is addresses within a certain zip code based on what I search put into an array.

     

    For example, I put in "police station" and this hypothetical PHP program goes and searches google, or mapquest/yahoo etc, and returns a neat array of information that I can use to create points on a google map.

     

    Does this exist? Is there any way to use PHP to run and return an address search on an external site like google or mapquest?

  4. I would like to create license/registration keys for my online application. I have never done this before so I do not know where to start.

     

    I suppose I would like a randomly generated string that could be compared to a static value and then a TRUE or FALSE could be returned. I do not know how to do this though. Of course, it gets tricky because I'd need more than just a 1:1 correspondence (like if I used md5()). I'd need several different strings (thousands even) adding up to the same value somehow.

     

    How is this possible? How does Microsoft and all the other non-free software vendors create their CD keys and make sure they are valid?

     

    Thanks!

  5. How do I figure out when the current week starts with timestamps? I figured it out with months, for example:

     

    $thisMonth = date(d) * 24 * 60 * 60;

    $thisMonth = time() - $thisMonth;

    $thisMonth = date(Ymd,$thisMonth);

     

    This would give you a timestamp pertaining to the beginning of the month. I want to get one pertaining to the beginning of the week, which seems more complicated. For example, today falls in the second week of feburary. The beginning of the week was the 5th. I need to find some way to figure out on which date the first day of the given week falls.

     

    Thanks,

     

    Matthew

  6. For some reason, uploads are taking up much more memory than the actual file size. For example, I tried to upload a 640K jpg and I set a memory limit per script of 12MB, and that file made the script go over the limit and it crashed. ???

    Why are file uploads of 640KB making my script use up more than the 12 meg limit and crash? Is there any way to fix this, short of restricting the file size people can upload?

    -Matthew
×
×
  • 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.