Jump to content

lastkarrde

Members
  • Posts

    165
  • Joined

  • Last visited

    Never

Everything posted by lastkarrde

  1. I've never heard of __set_state() before..
  2. Is this in some proxy software? Or are you trying to block web requests (from curl etc.) from being issued?
  3. Well, usually you can only access object properties if they are defined: <?php class Person { public $name; public $age; public $title = 'Sir'; } $p = new Person(); echo $p->title; //Sir $p->name = 'Atticus'; echo $p->name; //Atticus $p->age = 48; echo $p->age; //48 ?> The magic method __set() (usually combined with __get() ) allows you to define and access object properties dynamically. <?php class Person { public $data = array(); public function __set($name, $value) { $this->data[$name] = $value; } public function __get($name) { if(isset($this->data[$name])) { return $this->data[$name]; } else { echo 'NOT SET'; } } } $z = new Person(); echo $z->title; //NOT SET $z->name = 'Atticus'; echo $z->name; //Atticus $z->age = 48; echo $z->age; //48 ?>
  4. Code is on a local dev setup, it would take too much work to make it public facing. I ended up ditching the AJAX and including the page with an iframe in the dialog. Not the best solution.. but it works.
  5. Ah crap. It doesn't work. It just closes the Dialog, no data gets submitted...
  6. Thanks. I added dojoType="dijit.form.Button" to my submit button and It seems to fix it. I find it crazy that Dojo hijacks the event by default though :S .
  7. mysql_query("INSERT INTO user (username, password,email) VALUES ('$user', '$pass', '$email')");
  8. I've had experience with PHP, Tor and cURL all talking to each other . What "Doesnt seem to work" about your code? Error messages? Does auth fail?
  9. = , assignment == , same value ===, same value and type
  10. Howdy folks. I'm having some troubles with forms not submitting when they are included by an AJAX call. I have a page, <em>/add_many/</em> which just displays an HTML form. If I navigate to that page the form works as expected. However If i try and display that page in a dijit.Dialog modal (loaded via AJAX), the form will not submit. Below is my AJAX code addDialog = new dijit.Dialog({title: 'Add Reddit User', style: 'width:500px', preventCache:true}); addDialog.attr('href', '/add_many/'); addDialog.show(); The form displays fine in the dijit.Dialog box, and I can enter information into it. However clicking the submit button does absolutely nothing. Any ideas? Thanks
  11. if (strlen($review) < 30){ echo '<p class="red">Review is too short, please enter at least 15 words</p>'; }
  12. Use cron to execute a pruning script.
  13. Of course. That is how you execute processes using PHP.
  14. I've only worked with Paypal's API so I can only comment on that. They send a POST request to a script location that you specify (generally known as a postback). The POST request contains all of the information about the transaction (was it successful, etc). This will give you an idea on how to interpret the postback.
  15. $_SESSION['car'] = $car_object; $my_old_car_object = $_SESSION['car']; $my_old_car_object->offer; //Sale
  16. Perhaps not the neatest way, but you could save the state using sessions. if(isset($_SESSION['order']) && $_SESSION['order'] == 'DESC') { $_SESSION['order'] == 'ASC'; } $_SESSION['order'] = 'DESC';
  17. HttpRequest is a PECL PHP extension: http://www.php.net/manual/en/class.httprequest.php . It provides a nice, object orientated API to issue HTTP requests with. However you can accomplish the same things using sockets or cURL.
  18. Parsing XML is slow compared to a database SELECT. Set up your DB tables so that it represents the XML schema. Pull the XML file in, parse it, and save the relevant information in it to the database. That way every time you want to reference that data, your not parsing an XML file (which takes time). If your wanting to delete the old data, when you pull another/updated feed in, just do a DELETE where the timestamp is less than the current timestamp.
  19. I would parse the XML, then save the parsed data in a database. Make sure to include timestamps so you can regularly prune/empty/delete the database of old tweets.
  20. We need more information. Any errors? What works that should? What works that shouldn't?
  21. A profile page is just made up of some database queries and forms (if you want to save other user data like location, date of birth etc). I suggest you spend time learning PHP and the basics of MySQL. Understand what your login and registration code is actually doing. Once you understand that, implementing user profiles will be trivial.
  22. $_SERVER['REMOTE_ADDR'] returns the IP address of machine that requested the page (eg, the users IP address). You probably want that.
  23. Use PHP's mail function or a library on top of it (such as Swiftmailer).
×
×
  • 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.