Jump to content

t_machine

Members
  • Posts

    104
  • Joined

  • Last visited

    Never

Posts posted by t_machine

  1. Thank you all very much for the help. The script Orio posted works perfect but I too am worried about the security issue.

    My links are taken from a database so they are not included in the $_GET or $_POST method.

    Will this still be a security issue for my site?

     

    Example:

    ..mysql query

     

    $filename = $row['url'];

     

    I then use that $filename for the rest of the script. Will I be fine with that setup?

     

    Thanks :)

  2. Hi, I hope someone can help me with this problem. I am creating a plugins folder that  I will use to store php files. I also store other folders within that "plugins" folder. The problem I have is getting the script to read only the  the .php files and skip subfolders.

     

    Plugins[main folder]

        ->plugin1.php

        ->plugin2.php

        ->screenshot[folder]

        ->downloads[folder]

    How to keep the script from checking the folders (screenshots, downloads..)

     

    This part of my script filters the main folder and parent but not subfolders

     

    if ($file!= "." && $file!= "..") {

     

    How do i get that code to not check subfolders

  3. Hi, I am wondering if someone could help me with this problem. I have an array that contains both key and value. The first key/value is used to store a heading so it is not needed in the rest of the loop. How can I skip that first key/value and display the rest.

     

    Example:

     

    $myarray = array("key1"=>"heading", "key2"=>1, "key3"=>2.......

     

    Without knowing the key/value of the first result, how can I skip it

     

    foreach($myarray as $k =>$v){

     

    //if first key skip

     

    //else continue the loop

     

    }

     

    Thanks in advance :)

  4. I am wondering if anyone could help with this problem

    I would like to know if it's possible to add values while using a foreach loop. In the array below I have values lesser and greater than 10. I was wondering if during the loop I can check if the value is higer than 10 and basically sum all the values greater than 10.

     

    Example:

    $myarray = array(12, 6, 25, 2, 1, 15, 20);

     

    foreach($myarray as $val){

     

    if($val >10){

    //STARTING ADDING TO THE NEXT VALUE THAT IS GREATER THAN 10

    }

     

    }

     

     

    Thanks for any help :)

  5. Hi, I am wondering if anyone can help with this problem.

    I would like to get only the first key and value from my array.

     

    Example

    $myarray = array('linkname1'=>'linkurl', 'linkname2'=>'linkurl2', 'linkname3'=>'linkurl3');

     

    What I would like is to get only the first "linkname1" and "linkurl"

    It will be use in my codes -> <a href="linkurl">linkname1</a>

     

    Thanks for any help :)

  6. hi, I am wondering if anyone could help me solve this issue.

    I am using a foreach loop and i would like to add a line break after three records then repeat the process.

     

    Example:

     

    foreach($array as $v){

    echo $v.' ';

    }

     

    In that example, it will display ( apples oranges banana pumpkin turnips pineapple beer pepsi)

     

    How do i get it to display:

     

    apples oranges banana

    pumpkin turnips pineapple

    beer pepsi etc....

     

    Notice above that after each three results the next three are placed on a new line. How can I accomplish that with my loop.

     

    Thanks very much for any help :)

     

     

  7. hi, I am wondering if anyone could help. I have a loop that displays my results and places a comma after each. The problem is that when the last result is displayed, it shows the comma.

     

    Example:

    for loop{

     

    echo $row['test'].', ';

     

    }

     

    displays...  test1, test2, test3,

     

    Notice after test3, there is still a comma? How do I remove it and have it display... test1, test2, test3

     

    Thanks for any help :)

  8. hi, I was wondering if anyone could help with this problem.

    I have created two folders  (thumbs/largepics). I would like the script to view randomly a thumb and link to the larger pic.

     

    Example

     

    thumbs -> img1.jpg, img2.jpg. myimg.jpg

    largepics -> img1_L.jpg, img2_L.jpg. myimg_L.jpg

     

    The script would then choose for example "img2.jpg" then when clicked display "img2_L.jpg"

     

    Thanks for any help :)

  9. I have an array that stores ids, each of which is unique. Is there a way to run a for loop and get two keys at a time instead of only one?

     

    Example

    $id = array(1, 2, 3, 4, 5, 6);

     

    for loop....

     

    echo key 1

    echo key 2

     

    next loop

     

    echo key 3

    echo key 4

     

    and so on....

     

    Each key must not appear twice  so once a key is displayed, it will be removed from any further loops.

    I need it to display two keys at a time because I will be pairing them up for the next part of the script.

     

    Thanks for any help :)

     

     

  10. Thanks everyone for the replies :)

    AndyB does have the right idea but I am not sure how to implement it. Using that code, how would I know if 32 is a power of 2?

     

    I guess for simplicity I could just add those numbers in an array(2, 4, 6.....) then check if total matches in the array.

    I would prefer if a function could be created instead to check if the total matches, is a power of 2.

    Thanks :)

  11. I am creating a tournament script and need to have total matches as a multiple of 2 (2, 4, 8, 16, 32... ). How can i check the number to see if it's ok.

     

    example

    $matchesNum = 38;//obviously this is not a multiple

     

    How would I check that number to make sure it was 32 or 64...

     

    Thanks for any help :)

     

     

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