Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. $contents = file_get_contents('http://www.externalurl.com/index.php?token=61DKJH1B&source=WR'); $contents = str_replace('http://www.externalurl.com/index.php', 'http://www.myurl.com/myphp.php?url=http://www.myurl.com/myphp.php', $contents); print $contents;
  2. $string = str_replace(0xFFFD, '', $string);
  3. xml_set_element_handler(&$this->parser, "tag_open", "tag_close"); should be: xml_set_element_handler(&$this->parser, array(&$this, "tag_open"), array(&$this, "tag_close")); same for: xml_set_character_data_handler(&$this->parser, array(&$this, "cdata"));
  4. What you send doesn't actually matter (all the socket knows it's a 4-byte string) it breaks it down into bits and sends it through the wire. I found this: http://www.devshed.com/c/a/PHP/Socket-Programming-With-PHP/ Seems like you are missing a few pieces of the puzzle.
  5. That's odd with OP's so well-formed and properly indented code?
  6. SELECT DISTINCT COUNT( * ) AS Cnt FROM booking WHERE request_date = '$request_date' AND e_time > '$s_time' AND s_time < '$e_time' LIMIT 0 , 30
  7. Zend_Form: I generally use it like this create my form for some page and add custom element's like Username, EmailAddress, etc.. class App_Form_Login extends Zend_Form { const ELEMENT_USERNAME = 'username'; const ELEMENT_PASSWORD = 'password'; const ELEMENT_EMAIL_ADDRESS = 'email_address'; public function init() { $e = $this->createElement('Username', self::ELEMENT_USERNAME); $this->addElement($e); $e = $this->createElement('Password', self::ELEMENT_PASSWORD); $this->addElement($e); $e = $this->createElement('Password', self::ELEMENT_PASSWORD_CONFIRM); $this->addElement($e); $e = $this->createElement('EmailAddress', self::ELEMENT_EMAIL_ADDRESS); $this->addElement($e); $e = $this->createElement('Submit', 'submit'); $this->addElement($e); } public function isValid($data) { $isValid = false; if ($data[self::ELEMENT_PASSWORD] !== $data[self::ELEMENT_PASSWORD_CONFIRM]) { $this->getElement(self::ELEMENT_PASSWORD_CONFIRM)->addError('Password\'s do not match.'); } return parent::isValid($data) && $isValid; } } These custom elements are usefull because you generally use them at multiple sections in your application, for example: the element Username must have the same validation rules for both the login page as the registration page. You can't let a user register at the registration page and allow him up to 8 or more characters and only allow 6 at the login page. class App_Form_Element_Username extends Zend_Form_Element { public function init() { //label, validation rules, .. } } In your application you use 'em like: $form = new App_Form_Login(); if (!empty($_POST) && $form->isValid($_POST)) { //.. } Or if you use the MVC equivalent: $form = new App_Form_Login(); if ($this->getRequest()->isPost() && $form->isValid($this->getRequest()->getPost())) { //.. }
  8. $length = 180;//characters long $excerpt = $string; if ($length + 10 < strlen($string)) { $pos = strpos($string, ' ', $length); $excerpt = substr($string, 0, $pos >= $length ? $pos : $length); } Most people on these forums provide solutions and integrate them directly into the code the OP (you) provided on which they just copy-paste the added part into their existing code. I don't do that because you don't learn anything from it and the next time you have the same problem you will be asking for it again on this or some other forum because what you copy-pasted last time does not entirely fit into the new project and thus needs to be modified. And modifying something you didn't knew in the first place.. So I'm sorry but "How can I make this work with what I have set up?" will be your end of the bargain.
  9. I don't think it's possible unless you know somehow to add a 'weight' to every record which you could use to sort 'em. Could you provide some more detailed examples instead of just sector - username. Their must be a clear reason why you want to sort in a particular order.
  10. http://code.google.com/intl/nl/apis/youtube/overview.html
  11. first result on Google with an obvious query: Creating an XML-based shopping cart in PHP: http://articles.techrepublic.com.com/5100-10878_11-5662732.html
  12. A local webserver like xampp or wamp
  13. SELECT * FROM n2s_article WHERE article_url = $link Make sure you index article_url to speed up search
  14. Try GROUP BY count(*)
  15. Thanks for the suggestion! Right now the script hangs at: Created socket Connected to socket Sending ÿÿÿÿ If I stop the page loading it'll then display: Created socket Connected to socket Sending ÿÿÿÿ Submitted ÿÿÿÿ; Receiving response... That's strange, it's as if I'm missing a little something on how to properly read the data being sent back? Yup apparently there's something wrong with the reading
  16. That's true in the case of: if($a > $b): echo $a." is greater than ".$b; else if($a == $b): // Will not compile. echo "The above line causes a parse error."; endif; But I didn't see any shorthand notations
  17. no use mysql_real_escape_string
  18. SELECT * FROM items DESC LIMIT should be: SELECT * FROM items LIMIT
  19. That's not true else if is perfectly valid syntax
  20. this is a serialized string of an array use unserialize to re-create the array
×
×
  • 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.