Jump to content

NLCJ

Members
  • Posts

    129
  • Joined

  • Last visited

    Never

Everything posted by NLCJ

  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.
  16. NLCJ

    Rounded corners

    Hello, I'm totally confused by the rounded corners, in Chrome and Safari (webkit browsers) everything is working perfectly, however in FireFox and Internet Explorer it's not... The problem is that some corners are rounded, like they're supposed to do and some are not, even though I used EXACTLY the same CSS definitions! Does anyone know how this can happen? And maybe how I can fix this?
  17. NLCJ

    PHP Include

    In my opinion it is better if I place the upload script at my homeserver, I will disable that security thing. There are no very important files on that server, and still can't think of anything bad that can happen... Thanks for your advices though, I still learned from it.
  18. NLCJ

    PHP Include

    Okay, so I manually set the values in a .htaccess file: php_value upload_max_filesize 5120M php_value post_max_size 5120M php_value max_execution_time 65536 php_value max_input_time 65536 Looking at phpinfo it says Local Value like those above, and master value set in cPanel. That makes sense, but what is 'higher'. Does it look at the cPanel limits? Because I still cannot upload files bigger than the limit set in cPanel.
  19. NLCJ

    PHP Include

    Interesting, so basically every user can bypass these limits set in cPanel? Ah well, as long as they don't discover it...
  20. NLCJ

    PHP Include

    I've got a cPanel license, and those users all got an account over there. As far as I know it's not possible to create a seperate php.ini for one user.
  21. NLCJ

    PHP Include

    I've thought of that, the problem though is that files can be up to 5GB in size. If I change the php.ini to allow such big files I think all other (internet) 'friends' may abuse it, that's why I started the home server. Well protect the page with some kind of username/password? Even htaccess would suffice if it is a small time thing. I mean that those internetfriends might abuse it with their scripts, they got an account on my dedicated server.
  22. NLCJ

    PHP Include

    I've thought of that, the problem though is that files can be up to 5GB in size. If I change the php.ini to allow such big files I think all other (internet) 'friends' may abuse it, that's why I started the home server.
  23. NLCJ

    PHP Include

    That other server is located here at home, with a 10Mbit uplink. I don't think that that is fast enough to handle the traffic that we expect. @desjardins2010; What are the risks if I enable this feature? I can't think of some evil events...
  24. Hello, I created a script at my server, but would like to upload files to my other server. The website runs on server 1 and the upload form on server 2. I want to include the file of server 2 at the page at server 1; I've tried: include("http://ipaddress/upload.php"); Sadly, this doesn't work. I get the error: Is there another way to do it? Or should I change the php.ini and allow this (why isn't it allowed by default? What are the risks?). iFrames aren't what I need here. Thanks, NLCJ
  25. Solved. I've got an idea what happened, but that would take 15 minutes to explain why it works this way. I will skip this part; solution: Add a timer before displaying the iframe. setTimeout("uploadstarted()",10000);
×
×
  • 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.