Jump to content

WolfRage

Members
  • Posts

    647
  • Joined

  • Last visited

    Never

Posts posted by WolfRage

  1. If you already know some paypal, then continue to use it, especially because they have an account. Just use the API to issue the payment with out the visitor every having to leave the site. Please make sure to use SSL and make sure you program a IPN processor. Lots of information can be found at https://www.x.com/

  2.   Best way to iterate through a multi dimensional array is to create a function and have that function return the pieces you want formatted the way you want, inside the function will be the foreach loop extracting this information. But on the value for each piece returned it will first check if the value is an array "is_array()" if the value is an array, then call the function and pass it value. Yes call the same function from with in it's self and pass the value you want to break down. Then the function will break down to the lowest level before processing and then backing back out to the top array. Let me know if you need help beyond the explanation.

  3.   The only replies that I have is that you have to make sure that you are filtering those inputs especially because they are being directly entered into your database. Which could create a easy situation in which some one could SQL inject your database.

      Also I think you should do a session destroy on your logout in order to destroy the session cookie that is associated with the user; other wise it will appear as if the user is still logged even though they are not susposed to be.

      Good luck.

  4. An easy possible fix is to assign a session to the user. Then when the form is submitted mark a variable as true. If that variable is true do not let them submit the form again.

    Now you could say that a user might delete there cookies and then submit the form yet again, although unlikely. If you want to account for this possibility then assign a hidden input field to the form and upon submitting the form add this semi random though non repeating value to the table with the input form. Then the value cannot be accidently added even if the user deletes their cookies. Just remember which ever method you implement you need to undo that action if they choose to delete the value from the database; so that they may again post a value.

  5. <?php
    $array=explode(',',$inPutString);
    $array2=array();
    foreach($array as $key){
      $parts=explode('=>',$key);
      $array2[$parts[0]]=$parts[1];
    }
    var_dump($array2);
    ?>

    That should do the trick my friend, but I did not test the code just typed from memory so be sure to fix any errors or report them back here and I will fix them.

  6. Well I do not know of a way that PHP could take a screenshot of Flash; HTML and CSS no problem.

    But what you could do is use an IFrame or a standard frame. Sorry not sure if this is a perfect solution but it may be an option.

     

  7. Ok so really this is purely a javascript question. I am not that skilled with Javascript but for the output to be only the size of the incoming array you should use a foreach loop to loop through the array and echo out each value and use a incrementing value to create each variable name.

    Now I am in javascript territory but I would then pass this incremented value once it has reached the end of the array and I would create a setTimeOut that would reset the count process every x number of seconds times the incremented value.

  8. I understand that you think your detection method works, but it is not fool proof. A user can modify a subimited file type to say whatever like image and really upload an exe. Then they can access the exe on your server and launch an application of there choosing. Of course exe do not work on Linux unless WINE is installed and even then are mostly harmless, but .deb and .sh files do work on linux and could also be faked. So please use explode to make sure the file is really the type it cliams to be.

    As for how to implement: (Note: I changed your naming convention some, you can change it back or make the corrections to your script. But I felt this made the names more universal to there respectful roles with in the script.)

    <?
    $array=explode('.',$name); //Here I am bring the name appart by each "." to seperate the name of the file from it's extension or filetype.
    $array=array_reverse($array); //Here we reverse the array so that multiple periods can not confuse the extension of the file.
    $ext=$array[0]; //The first value in the array is now the actual file extension.
    if ($error == ""  && $name != "" && ($ext == "jpg" || $ext=='gif' || $ext=='png')) { //Now just check for each file extension you wish to accept.
    $filePath = "uploads/images/".$name;
    move_uploaded_file($temp, $filePath);
    }
    elseif ($error == ""  && $name != "" && ($ext == "txt" || $ext=='rtf') ) {
    $filePath = "uploads/text/".$name;
    move_uploaded_file($temp, $filePath);
    }
    else {
       unset($temp); //here we delete the uploaded file because it did not pass our test.
    }
    ?>

    There is a faster method that uses posix to identify the file extension but I can not remember it right now, plus I trust this method because it is simple but works.

  9. There is no real point, it should be removed, as long as you are assiging the function call to a varibale then that variable will contian the returned value of the function. So $shopconfig from the first function will contain the data you want and there is no need to make it a global.

  10. <?php
    file_put_contents('/logs/data/stats/content/tmpupload',$txt_output);
    ?>

    But you need to ask yourself is that really the location you want those files, is it really a path that is relative to root, or is it actually relative to the script. By the way I do not assume it will work. The function works just fine and is built into php.

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