Jump to content

zenlord

Members
  • Posts

    54
  • Joined

  • Last visited

    Never

Posts posted by zenlord

  1. What you really want to do, seems like a possible security-flaw to me: fetching external scripts to run on your server...

     

    Wouldn't an account with f.e. github not be better? You put all classes together, you can maintain your code very easily and everytime you make some adjustments, you can simply fetch the updates with git...

  2. Did you read the 'common pitfalls' on the setcookie-page?

     

    Things I can think of:

    * If you set or delete a cookie, it is visible when the page is reloaded - do you reload your page before checking?

    * You use single and double quotes together

    * Try explicitly setting the value of the cookie to 'false' - no need to set the time in the past, that is something that is done internally by PHP

  3. Example of PHP-framework?

     

    The best-known are Zend, CodeIgniter, CakePHP etc. 'Recently' there are a few new competitors that aim to be more lightweight: Kohana, Yii etc.

     

    I'll be diving into Kohana the moment I feel at ease using objects. I am now struggling somewhat to make the change...

     

    If you want a validation routine, then I guess you should look into the official documentation for PHP Filters. They contain pre-built functions to validate and even sanitize different data formats (strings, numeric, email, url, etc). The examples that are given in that section of the documentation are very good...

  4. I could be completely wrong, but wouldn't this work:

     

    class bar extends foo {
        function foobar($text) {
            parent::foobar($text);
            $text = $text . 'c';
            return $text;
        }
    }
    

     

    So you call the parent-function inside the extended function...

  5. if i logg in as "matt" user id "1" i shouldnt be able to see user id "2"'s events

     

    sorry if thats confusing

    Not confusing at all. Look at the part 'WHERE user = $user_id' in the query I supplied. That is the part that will only return events that are coupled to user with the specified $user_id.

     

    If that wasn't clear yet: you should add a column named 'user' to your table 'events' or a column named 'event' to your 'users'-table (one-to-many-relationship), or, if you need to be able to couple more than 1 user to more than 1 event: you should add a table with 2 columns: 1 for 'event_id' and one for 'user_id' in which you can couple more than 1 user to more than 1 event (many-to-many-relationship)

     

    If the latter is the solution to your problem, then you weren't really clear on the problem...

     

    Zl.

  6. Try using

     $_GET['keyword'] 

    I think he wants to do it the other way around.

     

    At the OP'er:

    You need to process the $_POST['keyword'] into an array (f.e. accept comma's to separate keywords and convert whitespace and other symbols with urlencode())

     

    Then you can use

    header("Location:http://www.domain.com/default.aspx?st=FT&ss=$keyword")

    to send the user to that page. (my example will only work when there is only 1 keyword, you need more processing to add multiple keywords to that URL)

     

    Vincent

  7. You know how to get all the user names from the table 'users', but you don't know how to get all the event names from the table 'events'?

     

    I don't think you have thought it through. Just make a SQL-query

    SELECT <necessary column names> FROM events WHERE user = $user_id ORDER BY date ASC

     

    The $user_id could be put in a session whenever a user logs in on the site, so that you have quick access to the above information.

  8. You *never* retain a password - that is a huge security flaw.

     

    You can check if a user has provided you with a valid combination of username and password and then set a variable (f.e. $loggedIn) to 1. That variable can be set in a session or cookie, so you can check on every page if $_SESSION['loggedIN'] or $_COOKIE['loggedIn'] is set to 1.

     

    Of course, to be secure, you need to read up a lot on this stuff...

  9. very intersting things. I also read that prepared statements are only faster if you need to do the same query more than once (well, more than 100 times or so), so I will need to do some testing before jumping in that one.

     

    I was thinking of a db abstraction anyway, but since OO is new to me, I was going to do the conversion in multiple stages - db abstraction being one of the last things on the list. That way I could grow into OO and learn for myself instead of typing stuff that I read in a book. I like it when an app grows slowly and steadily.

     

    The way I'm seeing it now is using the PDO-session class to instantiate a persistent connection whenever a session is started (login) and re-use that connection in various transactions until the user logs out. Looks very KISS to me - we'll see how long it stays that way :)

  10. using a for-loop or foreach-loop?

     

    Make an array with the all the names of the months in it and embed that array inside a for-loop for an array that starts at this year and then counts down 5 times, f.e.

     

    or using date-and-time-functions: output this month and then subtract a month for 60 times (5 years * 12 months).

     

    Many ways to do this. pick one :)

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