Jump to content

NLCJ

Members
  • Posts

    129
  • Joined

  • Last visited

    Never

Posts posted by NLCJ

  1. 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

  2. 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

  3. Yup, I edited it. :P

     

    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... :(

     

  4. 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. :P

     

    What isn't working? Well, the array gets more items in it, 1 per time I call it...  :shrug:

  5. 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.

  6. 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

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

  8. 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!

  9. Are you asking why some borders are rounded in some browsers yet they arent rounded in others??? If so, its because some browsers dont support the border radius css style (the css style to show borders with round corners) but some do, so you will get some browsers that show curved borders and some that dont.

    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]

  10. 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.

  11. 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?

  12. 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. ;)

  13. 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.

  14. on a cpanel-hosted site, you can typically use php.ini in the web document_root, or alternatively set the values in .htaccess

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

  15. Well, presuming you are using Apache and virtual hosts for the different websites on your server.. you could just change the ini for your virtual host?

    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.

  16. Security reasons. To the other server you could be a malicious hacker. Best way IMO is to do all the logic on server 1 as to whether to upload or not, then use PHP's FTP functions to upload it.

    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.

  17. Security reasons. To the other server you could be a malicious hacker. Best way IMO is to do all the logic on server 1 as to whether to upload or not, then use PHP's FTP functions to upload it.

    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.

  18. I think you should just copy the files you need to the other server too. Is there something wrong with that?

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

  19. 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:

    URL file-access is disabled in the server configuration in

    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

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