Jump to content

zenlord

Members
  • Posts

    54
  • Joined

  • Last visited

    Never

Everything posted by zenlord

  1. http://be.php.net/manual/en/cairo.requirements.php Are those requirements fulfilled? Did you install the library or not? V
  2. 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...
  3. zenlord

    Help

    Between these lines: $result = ... $url = ... You just add a new check: if ($newCat !="") { mail($to, $subject, "Cat has been changed to $newCat"); } More info on mail: http://be.php.net/manual/en/function.mail.php Vincent
  4. That doesn't look right: $_POST["row['course_id']"] You should add name="courseid" to your <select> and then change the line 'course_id' => $_POST["row['course_id']"]); to 'course_id' => $_POST["courseid"]);
  5. Those 'inputs' that you echo should be part of a new <form method="post" action=""> with action set to the php-script to handle the POST-vars and insert them into a table.
  6. 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
  7. 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...
  8. 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...
  9. 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.
  10. 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
  11. 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.
  12. I guess you really should read up on for-loops... Try changing ++ in -- Or: start at -5 and then ++ until you reach 0...
  13. http://www.php.net/manual/en/book.filter.php Builtin into PHP: functions to validate and to sanitize several data formats: url, email, string, numeric etc. I guess this is the reason you don't find anything new about validation anymore: everyone should be using these filters...
  14. 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...
  15. Change if (!$validationOK) to if ($validationOK==false) V
  16. looks correct - you don't need the last 'exit' - it never gets executed. V
  17. Using the filters that come with PHP 5.2, you could validate or sanitize this very easily - they have a check for URL...
  18. 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
  19. 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
  20. You don't need to change anything in the dbase/backend. Just change your view to only display news from the period you want (f.e. only news from feb 2011).
  21. http://php.net/manual/en/book.filter.php Whatever you make of it yourself: it will not be as good as PHP's own filters...
  22. Which 'dots' do you already have and do you want us to connect for you?
  23. Also, in your HTML, you need the 'enctype="multipart/form-data"'-attribute inside the <form>
×
×
  • 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.