Jump to content

scootstah

Staff Alumni
  • Posts

    3,858
  • Joined

  • Last visited

  • Days Won

    29

Posts posted by scootstah

  1. You then need to use it via $this->ci->session instead of $this->session

     

    EDIT: Wait, so you autoloaded the session?

     

    In that case, while in another library you need to take the same steps but you don't need to load it. So in another library:

    $CI =& get_instance();
    
    $CI->session->userdata();
    

  2. However it's not possible to load the session library from within another library.

     

    Sure it is.

    $CI =& get_instance();
    
    $CI->load->library('session');
    

     

    Alternatively you can autoload the session library in the application/config/autoload.php file.

  3. If you are using Windows Vista/7, do this: browse to the folder your PHP file is in. Press alt to open the window menu, then go to Tools > Folder Options. Click the View tab, and uncheck "hide known file extensions". Click apply. Now is your PHP file "file.php" or "file.php.txt"?

  4. The reason for the URL is because your form is using GET. The reason the UPDATE doesn't work is because you are looking for POST variables. So you either need to look for GET variables or change the form method to post.

  5. About the frameworks, I was told that if someone learn a framework, he basically learns the framework instead of PHP, which is actually a bad thing... What do you think about this statement ?

     

    I'm not sure what you mean by that. Frameworks are still using PHP code, they just come pre-packed with a ton of functionality that you don't have to worry about creating - you just tie into it.

     

    Of course being new to PHP it would be easy to get the wrong idea about how things work, and in that regard I think it is a bad thing. But a framework is still going to require that you know how to code fluently in PHP.

     

     

  6. You are using if/else incorrectly. You need to encase everything inside the conditional with curly braces. You are simply using a semicolon after the condition, which is incorrect.

     

    if ($amount < 1) {
        echo "You must enter the number of troops you wish to hire.";
        exit();
    }else{
        // blah blah
    }

  7. The only real concern is that the "nobody" group/user may be used by something else. I don't see how changing it to apache.apache would be harmful.

     

    Generally in shared hosting, the files you have control over are owned by you, so that users can only effect their immediate space and can't harm anything else on the server. Any respectable host will have this all setup properly.

     

    File ownership can only be changed with by a superuser (which HOPEFULLY isn't what Apache is running as).

  8. Would you tell him to use a templating system ?

    Generally, no. It just adds extra overhead for no reason whatsoever. People make excuses like "well I don't want my designer who sucks at coding to get confused". If the designer can't figure out how to use extremely basic programming structure, then he probably isn't going to understand your weird templating language either. And at least if he needs help with the PHP, he can easily find information about it. Plus the fact that raw PHP is faster.

     

    Would you tell him to use a PHP framework ?

    It depends on the project. For extremely simplistic projects a framework may be overkill - though at least expansion wouldn't be an issue. For medium to large projects, generally a framework is a good way to go. You can focus more on your specific application instead of trying (and probably failing) to make a bunch of efficient libraries for handling common things like databases, file uploads, security etc.

     

    Would you tell him to use a caching system to store some data ?

    Again, depends on the project. Are you expecting a decent amount of traffic (a couple thousand hits a day)? If so, then you may want to look into caching. Even very simple caching could help out, especially if your application is chunky.

     

    What else should be taken in consideration ?

    Before you decide your approach you really need to analyze your project. Ask yourself, what is your app supposed to do? What is the projected target audience? What features should it have? What technologies would you like to incorporate? Are you working alone?

     

    These are a few questions to get your started on your application design. Once you know more about what you want, it's easier to find solutions to the problem.

  9. The answer to your specific question is NO. If that's all the .php code you originally had on your site, it cannot be used to place a .php script file into a folder under your account.

     

    The sm5vy7.php file got into that folder through some other means.

     

    Whoops, guess I read that too fast. Indeed, this script cannot create a php file.

     

    However, you still have a potential spam vulnerability in it.

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