12, March 2010

Version 0.93 released - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  Php User Class
Topic: Version 0.93 released
« previous next »
Pages: 1 [2] Print

Author Topic: Version 0.93 released  (Read 2923 times)
Chicken-run Manager
*
Posts: 9
58 credits
Members referred : 0


« Reply #20 on: Jun 16, 2008, 11:08:48 pm »

No don't use this code, it is not sql injection safe....

Arghhh... i forgot... now it is? Wink
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5657
45575 credits
Members referred : 3



« Reply #21 on: Jun 16, 2008, 11:15:45 pm »

Yeah, now it looks ok. Thanks for your contribution Wink

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Chicken-run Manager
*
Posts: 9
58 credits
Members referred : 0


« Reply #22 on: Jun 18, 2008, 03:35:16 pm »

UNTESTED CODE!!!

With the prevois Version of my code, Passwords would have been updated to plaintext. That's not what we want. So let's try this:

Code:
<?php

/*
   * Updates a property. Data must be in the form 'property' => 'value'
   * @param array
   * @return bool
   */
  
public function updateProperty($properties)
  {
    if(
is_array($properties) && count($properties) > 1)
    {
      
$i=1;
      
$query "UPDATE `".$this->dbTable."` SET ";

      foreach(
$properties AS $k => $v)
      {
        if(
$k == $tbFields['pass'])
        {
          switch(
strtolower($this->passMethod))
          {
            case 
'sha1':
              
$v sha1($v);
              break;
            case 
'md5' :
              
$v md5($v);
              break;
            default:
          }
        }
        
$query .= "`".$this->escape($k)."` = '".$this->escape($v)."'".(($i++ < count($properties)) ? ', ' ' ');
      }

      
$query .= "WHERE `".$this->tbFields['userID']."` = '".$this->userID."'";
      return 
mysql_query($query$this->dbConn); 
    }
  else
    return 
false;
  }
?>
« Last Edit: Jun 18, 2008, 04:50:46 pm by Downlord »
OMG!I am geek
**
Gender: Male
Posts: 50
312 credits
Members referred : 0

in a world of php


« Reply #23 on: Sep 30, 2008, 04:27:32 pm »

hi first of all id like to say great work to nick and all others who may of helped.
its great to see a open source project going along nice n strong as i am creating a smalled based cms which will b open sourced to.

i was wondering if are u able to post a basic example of the updateProperty() function please.

it mite just b because its heading 11.30pm here or i just cant figured it out, any help would b much grateful Ty in advanced
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5657
45575 credits
Members referred : 3



« Reply #24 on: Sep 30, 2008, 06:26:38 pm »

It should get an array which has the form :

'tableField' => 'newValue'

But please check it out because none has tested this function (but in the next version it will be working anyway)

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
OMG!I am geek
**
Gender: Male
Posts: 50
312 credits
Members referred : 0

in a world of php


updateProperty works
« Reply #25 on: Oct 05, 2008, 03:08:21 pm »

i have had a play around with the updateProperty function a bit and it seems to only work when u give it a full case of arrays, not just a single case.
ill post a little example to help with the explaining.

Code:
$updateArray = array(
  'username' => admin,
  'email' => $_POST['email'],
  'password' => $user->get_property('password'),
  'activationHash' => $user->get_property('activationHash'),
  'active' => 1
  );

$user->updateProperty($updateArray);

this example will update a form that has been posted to edit only the users email.
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5657
45575 credits
Members referred : 3



« Reply #26 on: Oct 07, 2008, 11:09:55 am »

So this won't work?

$updateArray = array(
  
'email' => $_POST['email']
  );

$user->updateProperty($updateArray);
?>

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
OMG!I am geek
**
Gender: Male
Posts: 50
312 credits
Members referred : 0

in a world of php


« Reply #27 on: Oct 07, 2008, 11:44:25 am »

it will if u mod the original code to remove the "&& count($properties) > 1" section which checks if the array is longer then 1
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5657
45575 credits
Members referred : 3



« Reply #28 on: Oct 07, 2008, 11:47:07 am »

ok I will check that code for the next release. Thanks for finding this "bug" for me Smiley

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
OMG!I am geek
**
Gender: Male
Posts: 50
312 credits
Members referred : 0

in a world of php


« Reply #29 on: Oct 07, 2008, 11:54:58 am »

no problem at all ,

its great to have such a useful user class out there like this. i will b using this in my cms project alot.

once again thanks alot Nikolas
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=7723
Tags : php user class php class Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: 1 [2] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  Php User Class
Topic: Version 0.93 released
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Mar 12, 2010, 06:27:47 am





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!





Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2010 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.