Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. why not just use: http://us3.php.net/manual/en/book.bbcode.php
  2. Run this first to see which will be deleted: SELECT * FROM zdata_prodfile gr WHERE gr.sku NOT IN (SELECT * FROM jos_vm_product br WHERE br.product_sku); Then execute: DELETE FROM zdata_prodfile gr WHERE gr.sku NOT IN (SELECT * FROM jos_vm_product br WHERE br.product_sku);
  3. im just a beginer in php can u help me on any?plss sure but if it is an assignement you should do it yourself. What I don't understand is if you are only a beginner and your prof wants you to create this in 3 hours with no experience? Sure your prof didn't tell you this a few months ago but you just waited with it until now, with only 3 hours left?
  4. If you feel you are in for a very hard curve I would recommend downloading Zend framework. I have learned alot in a very short notice by just using their framework. I have been there myself I threw them away or gave them away
  5. print microtime() . '<br>'; print microtime(true);//your definitive answer
  6. It returns the the time passed since the unix epoch in seconds and microseconds. The total time passed since the unix epoch is secs + msecs. Don't know if this has something to do with it but: In the old days they didn't have something like float because those computers couldn't store such long formats therefor they kept it in strings performed some string operation to retrieve both the numbers before the decimal point and the numbers after the decimal point as an integer added some math performed the calculation all within that tiny space and added it back together as a string and displayed it to screen. They even add to store subcalculations in a string format because they lacked space.
  7. If what rhodesa pointed out is not the case, then: 1) did you start session_start();? 2) does $_SESSION hold a variable username? 3) session name is not $_SESSION['username'];
  8. Now where was it the last time I heard they based themself on axioma's? Oh yeah: Math and Science
  9. actually that's a state (a fancy name for a variable that holds a certain value that modifies the behavior of the system) http://en.wikipedia.org/wiki/State_(computer_science)
  10. My advice: start out really small! Buy a php cookbook and implement their examples using their code and learn to understand it. I could tell you the ins- and outs on application development and -architecture however just by hearing all of it may explode your head or scare you If you want I can help you in learning by reviewing what you wrote. And all phpfreaks members (including myself) will be glad to assist you if you have any programming related problem. Many start out big and come out really disappointed because they are in it way over their head and leave the webdevelopment industry and consider it "not fun to do" while it actually is the best job in the world You would have a problem facebook runs on out 50-100 servers which uses a loadbalancer and some servers are preserved as db-server. It's thus not only programming it's an all-round job, a job that has so many facets that it requires it's participants to be really really flexible (more flexible then rubber)
  11. $key = '67285789764983209584182738495874734473673467368232293248932298313131081291108578560185780 348549838461465813437569857428502758027'; $crypto = ($crypto * $key); This may be your problem if you multiply $key it is transformed to an integer (not entirely, explained later). A computer uses the 2-complement system and when it exceeds 2^32 (4 billion, unsigned integer) It continues in the negative part (-2^16). So when php parses $key it will use it's biggest possible type it has and assign $key that type and everything he can't fit into it is cut off. Use PHP_INT_MAX instead.
  12. I'm not entirely sure about this there may be more performant solutions then this one: SELECT * FROM table WHERE field_that_has_doubles IN (SELECT field_that_has_doubles FROM table) Plus it possible is going to get moved to the Mysql Help
  13. This is easily doable, it's about 6-7 pages.
  14. <input type="hidden" name="timestamp_created" value="<?php print mktime(0, 0, 0, 1, 1);/* 1 january */ ?>"> $timestamp_created = (int) $_POST['timestamp_created']; $a = time() - $timestamp_created; $thirtydays = 2592000; // 30 days in seconds $alertinhour = $thirtydays + 3600; if ($a > 2592000 && $a < $alertinhour) { //set some flag the mail have been send, so it doesn't get send twice mail(..); }
  15. You need recursion to do so: function category_list(array $category, $indent = "\t") { //process if (is_array($value)) { category_list($value, $indent . "\t"); } } If you have 2 tables: category and subcategory. Then first retrieve all categories and just roll them out if a user clicked a category and the current category id in the loop matches the clicked category, then perform a new query which retrieves the subcategories for the active category. I strongly suggest using something differently than a table to display the indentation like a definition list (dl) a category is then (dt) and the subcategories (dd)
  16. The total "light" size of the Zend framework is about 12 megs (if i recall correctly). And I am not currently aware of some sort of (up-and-running, packageizer gives 404) script that allows you to just select the packages you need (with it's dependencies) which is a major drawback to my opinion. Try downloading and extract the Loader (+Loader.php in the Zend root) and Services packages from them. Include any additional files for which it throws errors. And file a complaint to the author that he should include the required packages before distribution.
  17. class SomeClass extends SomeParentClass { public function parentMethod() { parent::parentMethod(); } }
  18. class SubClass extends SuperClass
  19. Use this: http://www.phpfreaks.com/forums/index.php/topic,261112.msg1229397.html#msg1229397 This allows you to split your form up into steps and end perform the process on the last step. It needs one fix though: $_POST = array_merge($_SESSION['_POST'], $_POST);
  20. Although not entirely sure: /includes/somefile.php is equal to: ../includes/somefile.php iOr Is the operating system from your server different then your local server?
  21. Didn't knew their were differences between languages thought they all used the same mechanism.. Thank you Ginger for pointing this out.
  22. Don't he cast E to ord(E)=69 and use that to compare it to 0? $txnResponseCode != 0 thus 69 != 0 => true. So to what does he cast the entire if statement? if ($txnResponseCode != 0) { // E does not equal 0 => true echo 'fail<br>'; } Edit: my first reply was to fast without proper thinking it through
  23. This isn't a bug. For more information: http://us2.php.net/manual/en/types.comparisons.php
  24. So I guess I have to keep typing in every single variable? I thought I could do an array or soemthing (don't know much about arrays) so I don't have to do it like my long clunky code. How could I do it if we ignore the date fields for now? Maybe I could mae MOST of it generic nd do the dates separately. Or you could use a form framework (like http://framework.zend.com/manual/en/zend.form.html). This allows you to easily create and validate form input. If you extend it you can add a model (like an ActiveRecord) to let it - if valid - add it automagically to the database (http://www.zendcasts.com/may-to-many-with-zend_db-and-zend_form/2009/05/). Alternatively you can look at patForms (http://trac.php-tools.net/patForms). Quick intro in using Zend Form: class MyLoginForm extends Zend_Form { const ELEMENT_USERNAME = 'username'; const ELEMENT_PASSWORD = 'password'; const ELEMENT_SUBMIT = 'login'; public function init() { $e = $this->createElement('Text', self::ELEMENT_USERNAME); $this->addElement($e); $e = $this->createElement('Text', self::ELEMENT_PASSWORD); $this->addElement($e); $e = $this->createElement('Submit', self::ELEMENT_SUBMIT); $this->addElement($e); } } A username and a password ofcourse is used more then once in your application. You probably also have some rules for them (username must be 8 characters long, password must be 8 characters long and have upper- and lowercase letters ..). class My_Form_Element_Username extends Zend_Form_Element_Text { public function init() { $this->addValidator('Alpha'); $this->addValidator('StringLength', false, array(8, 16)); $this->setLabel('Username'); } } class My_Form_Element_Password extends Zend_Form_Element_Password { public function init() { $this->addValidator('StringLength', false, array(8, 16)); $this->addValidator('Regex', false, array('/..some..regex../')); } } Then if you reference them you can use them within your form: class MyLoginForm extends Zend_Form { const ELEMENT_USERNAME = 'username'; const ELEMENT_PASSWORD = 'password'; const ELEMENT_SUBMIT = 'login'; public function init() { $this->addPrefixPath('My_Form_Element', 'My/Form/Element', 'element'); $e = $this->createElement('Username', self::ELEMENT_USERNAME); $this->addElement($e); $e = $this->createElement('Password', self::ELEMENT_PASSWORD); $this->addElement($e); $e = $this->createElement('Submit', self::ELEMENT_SUBMIT); $this->addElement($e); } }
  25. Protect yourself from impersonation (session hijacking): if (sha1($_SERVER['HTTP_USER_AGENT']) !== $_SESSION['HTTP_USER_AGENT']) { session_destroy(); //same session, but different browser signature? (impersonating) } Optionally: if (sha1($_SERVER['REMOTE_ADDR']) !== $_SESSION['REMOTE_ADDR']) { session_destroy(); //same session, different ip address? (user performed a ipconfig /release, /renew) } If interested: http://shiflett.org/ - expert on (php) security
×
×
  • 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.