Jump to content

able

Members
  • Posts

    31
  • Joined

  • Last visited

    Never

Everything posted by able

  1. Thanks for the links, but it wasn't what I wanted. I don't want to build ontop of phpbb3 - merely be able to create/update/ban users remotely. I've now got that working, for anyone else looking to do this, the stuff in phpbb3 about the random seed hashes - is security through obscurity, it does nothing. The seed hashes can be completely left out and it doesn't alter anything.
  2. Yeah thats what I'm doing at the moment, I was hoping someone had already setup a list of steps or knew about a secret api :-)
  3. Has anyone had to do an integration with phpBB3 yet? I need to synch the main user database with the phpbb3 when people register/change pass/etc - has anyone done this already and have some advice?
  4. set the html element name to ids[] set the value for each box to the id You'll then get an array $_POST['ids'] that contains the id's of all checked which you can use.
  5. Loading only parts of the user seems fine to me, you have 3 main approaches for doing so: 1) Lazy loading, put a proxy in fields/relations you don't always need and reload if requested (not a fan of this in php) 2) Specify which fields you want at the query stage 3) Create additional classes e.g. User extends UserBasicInfo With option 2, you can get round the problem of overwriting the empty data, by tracking dirty fields. Each set, marks a field as dirty, the update statment is then built only using dirty fields i.e. if a field value hasnt changed, it isnt updated. Getting round the problem of the last 10 orders and the users, I've given up trying to make the OO nice, and basically followed the DB structure on the idea that I'd rather have efficient queries than the cleanest OO. What I currently do, is build the query and in this case, the user id would be in the order, so I tell it to grab the 10 most recent queries, and that that the user id is a foreign key, so it should do a join and the itterator will return an array of objects (order, user) reducing it to 1 query, which is generated on the fly - but loosing the ability to say: $order->getUser() For me, I can live with the lack of oo purity. I know some can't.
  6. Why can't your url_helper or other class/method/function simply take an object, plus the name of the field of the object which is a url and use it to create your link?
  7. By default sessions are stored as text files on the server.
  8. Just speak to your host about enabling SSL - you can buy certificates pretty cheaply now.
  9. Try an address book application. 1 person can have multiple sets of contact details.
  10. It does speed up comunications, but it's nothing to do with the number of sockets. Sending multiple echo's without output buffering does not use multiple sockets.
  11. Output buffering is perfectly valid, for the purpose of buffering output :-) Output buffering allocates a larger memory size than a php string, so sending large output to it instead of a variable is more efficient due to less resizing behind the scenes. Sending all output at one time, without delay allows for less packets to be sent which aids communications. As stated, turning on gzip handler for your output buffering will also reduce the amount of data sent. Don't let anyone in 2008 tell you output buffering is evil :-)
  12. Nobody is doing that. Just calling a render process, the output of which is passed to the view as a variable for display.
  13. I disagree entirely with the notion that having php output html breaks mvc/model2. It is simply that some of the php is in the view layer (seperate form model from form renderer). As to having the designer add additional form fields... I get to skip this, where is the data from the field kept? With my work 9/10 its in the db, so the extra field has to be added to the db, the business object and controller is regened to add the new field - and a few lines to the form abstraction is added, rather than then having to wait for the designer to edit the form.
  14. This is the flow of a typical edit scenario: function executeMain() { $user = $this->dao->load($_SESSION['user_id']); $user->sendToPostArray (); $form = $this->makeForm (); echo $form->render ( false,URL_ROOT . 'EditAccountDetails/submit/' ); }
  15. You are trying to do too much I think. What you have is some form html and some database access. It seems like a step backwards, but seperating the two makes life a lot easier. I have the form as you saw, once validated the post array is passed to object(s) which populate themself. Those objects are then created or updated with a single method call, the sql is generated based on the objects and relevant tables. I've included a typical form submit flow below: function executeAddSubmit() { $form = $this->makeListForm (); if (! $form->validate ( $_POST )) { echo $form->render ( false, URL_ROOT . 'Lists/AddSubmit/' ); return; } $list = new FlList ( ); $list->populateFromArray ( $_POST ); $list->setUserId ( $_SESSION ['user_id'] ); $created = $this->dao->create ( $list ); if ($created) { header ( "Location: " . URL_ROOT . "Lists/Main/" ); } else { echo 'Sorry, there was a problem adding your new list'; } }
  16. Hopefully it goes without saying, but you need to make your tables either innodb or bdb for transactions to work. If you don't, you can still perform begin/commit/rollback - but they won't have any effect.
  17. I'm hoping to package the form component/renderer/validators up into a 1 file include library type idea to make public If anyone would be intrested in seeing this, or potential features, would love to hear from you
  18. I have a form class and a form renderer class Rather than extend the form for each form in the site, I just use the base object, here an example of creating a form: function makeForm() { setDefaultPost('gender',1); $form = new Form ( ); $form->setTitle('Register'); // login details $form->addFieldSet('Login Details'); $form->addTextBox ( "username" ); $form->addValidator ( "username", ExpertValidate::requireAlnumLengthBetween ( 6, 20 ) ); $form->addPassBox ( "password" ); $form->addValidator ( "password", ExpertValidate::requireAlnumLengthBetween ( 6, 20 ) ); // personal details $form->addFieldSet('Personal Details'); $form->addTextBox ( "firstName" ); $form->addValidator ( "firstName", ExpertValidate::requireLettersLengthBetween ( 2, 50 ) ); $form->addTextBox ( "lastName" ); $form->addValidator ( "lastName", ExpertValidate::requireLettersLengthBetween ( 2, 50 ) ); $form->addSelection ( "gender", false, array ('1' => 'Male', '0' => 'Female' ), true ); $form->setRequired("gender"); $form->addDatePicker ( "birthDate","Date of Birth" ); $form->setRequired("birthDate"); $form->addTextBox ( "securityQuestion" ); $form->addValidator ( "securityQuestion", ExpertValidate::requireAlnumLengthBetween ( 1, 200 ) ); $form->addTextBox ( "securityAnswer" ); $form->addValidator ( "securityAnswer", ExpertValidate::requireAlnumLengthBetween ( 1, 100 ) ); // contact details $form->addFieldSet('Contact Details'); $form->addTextBox ( "emailAddress" ); $form->addValidator ( "emailAddress", ExpertValidate::requireEmailAddress () ); $form->addTextBox ( "mobilePhone" ); $form->addValidator ( "mobilePhone", ExpertValidate::optionalAlnumLengthBetween ( 1, 100 ) ); $form->addTextBox ( "msnContact" ); $form->addValidator ( "msnContact", ExpertValidate::optionalEmailAddress () ); $form->addTextBox ( "yahooContact" ); $form->addValidator ( "yahooContact", ExpertValidate::optionalStringLengthBetween ( 1, 100 ) ); $form->addTextBox ( "skypeContact" ); $form->addValidator ( "skypeContact", ExpertValidate::optionalStringLengthBetween ( 1, 100 ) ); $form->addTextBox ( "aimContact" ); $form->addValidator ( "aimContact", ExpertValidate::optionalStringLengthBetween ( 1, 100 ) ); $form->addTextBox ( "icqContact" ); $form->addValidator ( "icqContact", ExpertValidate::optionalStringLengthBetween ( 1, 100 ) ); $form->addSelection ( "showEmail", false, array ('0' => 'No', '1' => 'Yes' ), true ); $form->setRequired("showEmail"); $form->addAdvice('showEmail','Choose if members of the site can view your email address'); $form->addFieldSet('Security Measure'); $form->addCaptcha('securityCode'); $form->addValidator('securityCode',new CaptchaValidator('securityCode')); $form->addHidden ( "id" ); return $form; } The form always deals with the $_POST array and populates itself Validators are used to validate input but also to display advice about inputs i.e. what input is expected edit note: I just changed the form instance to a larger one that showed off a bit more of the functionality
  19. No idea about usa football, you'd need to explain it without the reliance on a common terminology.
  20. I don't have a problem with __get and __set however the lack of intelisense/code complete and also the fact zend studio now has get/set generation for variables means I'd stick with the full methods.
  21. You need 2 instances of the accounts table, as you have 2 accounts query = "SELECT messages.*, accounts1.username, accounts1.thumbname, accounts2.username, accounts2.thumbname FROM messages, accounts accounts1, accounts accounts2 WHERE messages.xfrom = [current user's ID passed into function] AND messages.account = messages.xfrom AND accounts1.ID = messages.xfrom AND accounts2.ID = messages.xto AND messages.threadid = [threadid] ORDER BY sent ASC"; Just guessing on the query, but something like this.
  22. able

    Replication

    Round robin dns is plagued with problems - most specifically, if a server does die, it wont be excluded. There is a much more effective system called wackamole which also works on a multiple IP system, but can adjust to remove dead servers by rerouting ip's.
  23. "implimentation neutral" - I meant by this language neutral/platform neutral i.e. something that would work in PHP, or ASP or JSP etc "xsl/t", - A quick google for XSL will give you a whole lot of info. I'd sum it up as CSS for XML that can output other markup languages. So, if we wanted a universal template system, have your application output xml, the template is then essentially XSL - and it is transformed into x/html as required I don't claim to be much of an authority on XSL but there is loads of info about if you desire it
  24. able

    Replication

    Thats right, but I beleive you said you'd like a mirrow. Most applications of mysql replication are initially to split read loads to different servers yes. However, i'll come back to splitting for writes at the end. In a dual master, then yes you can load balance however most seem to prefer a simple algorithm in the php code rather than load balancing, I cant remember of the top of my head the main reason(s) for this. Ok splitting for writes, the only real way to do this in mysql is to partition/shard your data. One way would be to have all data for users whos names start with a-m on on master, and n-z on another. A simple function to determin which shard the data you need is in can be used, which then sets up a read and write connection as required (write to master of shard, reads to slave(s) of shard). The function to establish which shard (master+slave(s)) is problematic in that when data is moved e.g. you shard on more complex grounds e.g. to balance loads based on user activity. Often a lookup table of user->shard is kept and replicated to all machines, or a dedicated master/slave(s) have the job purely of keeping track of what data is where. As you can imagine, this is quite limited on 2 servers, it really comes into its own on slightly larger setups however it will work on 2.
  25. able

    CHAR vrs VARCHAR

    This is variable however my own experience has been that opting for large chars to retain fixed row sizes has given poorer performance. This is against most things I have heard but I can only speak based on my own observations. This was particularily notable in large tables (2mil + rows)
×
×
  • 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.