Page 2 of 5

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 5:06 pm
by Kamal
Give us some ideas. I want to contribute :S

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 5:11 pm
by jacek
Kamal wrote:Give us some ideas. I want to contribute :S
Image manipulation if you are feeling up to it :)

Something to basically wrap the GD library functions but also take some of the pain away and maybe add some function to do things like resize images and create thumbnails.

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 5:17 pm
by Kamal
bleh.. I have no experience at all with GD.

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 5:20 pm
by jacek
Then come up with your own idea :lol:

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 5:28 pm
by Tino
You could do something with caching.

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 5:36 pm
by bowersbros
For my reference mainly, and for people to suggest extras:

Validation Class:
  • Secure (general security)
    username validation (remove spaces, etc)
    Password validation (checks security level (types of characters required))
    SecurePass (encryption and salt)
Users Class:
  • login
    register
    available (checks availability of username and email and anything else)

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 6:23 pm
by Temor
bowersbros wrote:For my reference mainly, and for people to suggest extras:

Validation Class:
  • Secure (general security)
    username validation (remove spaces, etc)
    Password validation (checks security level (types of characters required))
    SecurePass (encryption and salt)
    available (checks availability of username and email and anything else)
Users Class:
  • login
    register
Looks good!

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 6:31 pm
by jacek
bowersbros wrote:For my reference mainly, and for people to suggest extras:

Validation Class:
  • Secure (general security)
    username validation (remove spaces, etc)
    Password validation (checks security level (types of characters required))
    SecurePass (encryption and salt)
    available (checks availability of username and email and anything else)
Users Class:
  • login
    register
Maybe you should just to a login / register combined thing :? most of the methods inthe validation class would make more sense in the login one.

and "general security" is never a good idea, people use it and assume they are protected form everything.

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 6:36 pm
by bowersbros
well.. im doing them seperate because login checks data, but register enters data and im trying to get register to check an array also. (so they can enter any details and it will hopefully get entered)

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 6:43 pm
by jacek
Hmm okay, well its up to you really, but the "available (checks availability of username and email and anything else)" methid should defiantly be part of the user class.

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 6:52 pm
by bowersbros

Code: Select all

$fields = array('name','username','password','users','hey','whatsup');

while($fields){
            foreach(array_keys($fields) as $field){
                 echo $field;
            }
        }

 
What i need is the key of the array name and the content to go together into the database for registration.. Any ideas? :P

/edit: got it.

Code: Select all

$fields = array('name' => 'Alex', 'last_name' => 'bowers', 'month' => 'Jan');

foreach($fields as $k => $v){
    echo "Key: " . $k . " -> Value: " . $v;
}

 

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 6:54 pm
by jacek
I don't really get your use of the while loop there :? In fact I have no idea what you mean :lol:

Also it should probably be a post in php help ;)

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 6:55 pm
by bowersbros
Got it. see above :P

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 7:06 pm
by jacek
bowersbros wrote:Got it. see above :P
Ah fair enough !

Yes that method makes a lot more sense.

Also, any code submission should be done in attachments here on PM me so I can add to the main .zip file.

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 7:11 pm
by bowersbros
jacek wrote:
bowersbros wrote:Got it. see above :P
Ah fair enough !

Yes that method makes a lot more sense.

Also, any code submission should be done in attachments here on PM me so I can add to the main .zip file.
no where near done yet, im working on getting it all entered into the database.. kinda difficult without the mysql class :/

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 7:20 pm
by jacek
you are not forced to use the other library files. But yeah I can see how it would be ;)

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 7:26 pm
by EcazS
Do something that downloads images from a site
$website = "http://google.com";
$folder = "./folder/images/"
download($website, $folder);
:lol:

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 7:27 pm
by jacek
EcazS wrote::lol:
Was that a joke :?

If you think that would be useful then feel free to make it and I will put it in ;)

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 7:31 pm
by EcazS
jacek wrote: Was that a joke :?
No :lol:
jacek wrote: If you think that would be useful then feel free to make it and I will put it in ;)
I doubt it would, I just want such a thing :lol:

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 7:34 pm
by bowersbros
EcazS wrote:
jacek wrote: Was that a joke :?
No :lol:
jacek wrote: If you think that would be useful then feel free to make it and I will put it in ;)
I doubt it would, I just want such a thing :lol:
Give it a go? :D

Re: BetterPHP PHP Library

Posted: Thu May 12, 2011 7:40 pm
by Kamal
<?php
function download($url, $save_to){
    if(file_put_contents($save_to, file_get_contents($url))){
        return true;
    }else {
        return false;
    }
}
?>
Isn't it that simple?