Jump to content

NLCJ

Members
  • Posts

    129
  • Joined

  • Last visited

    Never

About NLCJ

  • Birthday 03/31/1994

Profile Information

  • Gender
    Male
  • Location
    Netherlands

NLCJ's Achievements

Member

Member (2/5)

0

Reputation

  1. I haven't tested it, you should before you start using it. For multiple sites: $sites = array("http://www.google.com/", "http://www.microsoft.com"); if(in_array($_SERVER['HTTP_REFERER']), $sites) { //Your code } Etcetera.
  2. if($_SERVER['HTTP_REFERER'] == "http://www.google.com/") { //Your code }
  3. Ah well, I guess I made a typo a few hours ago? Thanks for explaining, glad to know I had the right thoughts. Regards, Chris
  4. I've fixed it another way, saving me a lot of other codes by combining some functions. But still, I'm wondering how this can fail. All I want is to use a variable, for example (it doesn't work): $currentround = $round.$i; The 'currentround' is depending on the $i, and I want to add the $i to the variablestring (lol?). I hope you get what I mean... Thanks, Chris
  5. Hello, I've got multiple variables that are all an array. I set them up like: $round1 = ...; $round2 = ...; $round3 = ...; All the way up to 10, now I created this: $numbers = array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10"); $rounds = array("round1", "round2", "round3", "round4", "round5", "round6", "round7", "round8", "round9", "round10"); for($i = 1; $i < 11; $i++) { $newi = str_replace($numbers, $rounds, $i); echo $newi."<br />"; } Sadly this is only working partially, the output is: round1 round2 round3 round4 round5 round6 round7 round8 round9 roundround10 Does anybody know why? If I make it "$i = 0;" the result is: roundroundroundroundroundroundroundroundroundround10 roundroundroundroundroundroundroundroundround10 roundroundroundroundroundroundroundround10 roundroundroundroundroundroundround10 roundroundroundroundroundround10 roundroundroundroundround10 roundroundroundround10 roundroundround10 roundround10 round10 I'm kinda stuck here. Is it because I'm trying to replace numbers? Regards, Chris
  6. NLCJ

    array_diff()

    Thank you, the & did the trick! And thanks to all others who helped me, too!
  7. NLCJ

    array_diff()

    Yup, I edited it. function winners($array, $roundnumber, $amount) { echo $roundnumber." ".$amount." - "; $winners.$roundnumber = array(); $array = shuffle($array); for($i = 0; $i < $amount; $i++) { $winners.$roundnumber[] = $array[$i]; } $array = array_slice($array, $amount); $array = shuffle($array); echo count($array)."<br />"; //print_r($winners.$roundnumber); } Nope, still not working... I get the following errors: Warning: array_slice() expects parameter 1 to be array, boolean given in ... on line 34 Warning: shuffle() expects parameter 1 to be array, null given in ... on line 35 Cannot figure out what's wrong...
  8. NLCJ

    array_diff()

    Okay, I'm trying to use slice, but cannot get it to work; function winners($array, $roundnumber, $amount) { echo $roundnumber." ".$amount." - "; $winners.$roundnumber = array(); shuffle($array); for($i = 0; $i < $amount; $i++) { $winners.$roundnumber[] = $array[$i]; } $array = array_slice($array, $amount); shuffle($array); echo count($array)."<br />"; } I know the second shuffle isn't necessary, it just gives me a better feeling. I also replaces $participants with $array, since the array with participants was called $participanst, this was confusing. What isn't working? Well, the array gets more items in it, 1 per time I call it...
  9. NLCJ

    array_diff()

    I get 10 random items from the array, I also want to remove those exact 10. Every item in the array is unique, so it should be possible, right? Because every item in the array is unique, I thought I could easily differ it from the rest. Either my thoughs are wrong or my code.
  10. NLCJ

    array_diff()

    How do I remove them from the array? That's kind of my problem.
  11. Hello, I'm trying to create a little function that randomly selects the winners, then it has to remove the winners from the array where it was in. I created it like this: $participants = array(); function winners($participants, $roundnumber, $amount) { $roundnumberwinners = $winners.$roundnumber; $roundnumberwinners = array_rand($participants, $amount); //print_r($roundnumberwinners); //echo "<br />"; $values = array(); foreach($roundnumberwinners as $key => $value) { $values[] = $roundnumberwinners[$participants[$value]]; } //echo $roundnumber." - ".count($participants)."<br />"; $participants = array_diff($participants, $values); echo $roundnumber." - ".count($participants)."<br />"; } It perfectly selects the amount of winners I want, but it doesn't get them out of the original array ($participants). I call it with: $winnerstest = winners($participants, 1, 10); If anyone could help... I've been stuck on this for a few days now. Thanks, Chris
  12. If you want to update something you will have to use UPDATE in the mysql string. Example± mysql_query("UPDATE `users` SET `option1`='value', `option2`='value2' WHERE `condition`='something'"); So, add an if where you check if there is already an entry in the database, if it is; update otherwise insert.
  13. NLCJ

    Rounded corners

    I checked that more than 5 times, and also thought this would be it... Anyhow, I asked someone else to look at it and it seems that I've switched two words. That's gonna be a lot of editing at all pages... Thanks though!
  14. NLCJ

    Rounded corners

    No, I'm talking about the same page. Take a look at the images I attached, it is very strange (right?!)... Internet Explorer got EXACTLY the same problems as FireFox, except that this is at different corners. I've used the same method everywhere... :s By the way, I'm sorry for the late response. [attachment deleted by admin]
  15. NLCJ

    Rounded corners

    Thank you, I found that blog. But I was wondering why it does round some corners in for example FireFox, and using the same method it doesn't round other corners at the same page?! I will setup an example if needed.
×
×
  • 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.