TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 12-28-2008, 03:49 AM   #1 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default To-do list (update 1/16/09)

We need the following done, please post if you wish to do it (please do not ask to do something if you can't do it well).

Needs Doing
  • Edit Image class. Inherits Display Image class. Verifies ownership of image (based off of ID), delete image, add image, set watermark on/off.
  • Registration system
  • Create gallery/View galleries
  • Create item/View items in gallery
  • Submit comment/View comment
  • Display Image class. Loads an image based off of an ID along with its information (name, tags, ect.).
Note: For the viewing pages, they are not mandatory. Create it as nothing more than a tool to view the raw data if you want to. We will actually develop the viewing pages in the next stage.

In Progress:
  • Login/page-to-page user authentication In progress by Village Idiot
Done
  • SQL class. The object must have functions to connect, disconnect, clean variables, execute commands and execute queries with a return. Completed by Tanax.
  • User class (cookie based). Log in, log out, auth (from cookie data) Completed by Village Idiot.
  • Config class. Loads configs into an array (key=name and value=setting value), crates configs, deletes configs. Completed by Orc
__________________


Last edited by Village Idiot : 12-29-2008 at 05:31 AM.
Village Idiot is offline  
Reply With Quote
The Following User Says Thank You to Village Idiot For This Useful Post:
Aaron (01-04-2009)
Old 12-28-2008, 11:16 AM   #2 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by Village Idiot View Post
We need the following done, please post if you wish to do it (please do not ask to do something if you can't do it well). I am capable of about all of this, and will do as much as I can, this is a list of things that need doing.

I first and foremost need someone who knows how to use SVN to set us up on google code.

Coding:
  • SQL class. The object must have functions to connect, disconnect, clean variables, execute commands and execute queries with a return.
  • Display Image class. Loads an image based off of an ID along with its information (name, tags, ect.).
  • Edit Image class. Inherits Display Image class. Verifies ownership of image (based off of ID), delete image, add image, set watermark on/off.
  • User class (cookie based). Log in, log out, auth (from cookie data)
  • Config class. Loads configs into an array (key=name and value=setting value), crates configs, deletes configs.
Resources:
  • A chat room for us to chat in. I would perfer not to set one up, but to use an existing solution (line www.campfirenow.com but free).
I'd like to take up the SQL Class, and Config class.
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 12-28-2008, 12:46 PM   #3 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Not trying to take away Orc's job here, but I have this database class, perhaps it could be used? Or used as a base, and someone could modify it for the better?

php Code:
<?php

/**
||||||||||||||||||||||||||||||||||||||||||
|||| @author Tanax
|||| @copyright 2008
||||||||||||||||||||||||||||||||||||||||||
**/


    class DBmysql implements iDB {
       
        private $host;
        private $user;
        private $pass;
        private $data;
       
        private $tables = array();
        private $rows = array();
       
        private $query_sql;
        private $query_result;   
        private $query_fetch = array();
       
       
        public function setHandler($array) {
           
            $this->host = $array['host'];
            $this->user = $array['user'];
            $this->pass = $array['pass'];
            $this->data = $array['data'];
           
            return $this;
           
        }
       
        public function connect() {
           
            @mysql_connect($this->host, $this->user, $this->pass) or die("Could not connect to the database.");
           
            return $this;
           
        }
       
        public function select() {
           
            @mysql_select_db($this->data) or die("Could not select database.");
           
            return $this;
           
        }
       
        public function disconnect() {
           
            @mysql_close() or die("Could not close database connection. Perhaps because the connect isn't opened.");
           
        }
       
        public function loadQuery($query) {
           
            $this->query_sql = $query;
           
            return $this;
           
        }

        public function exeQuery()
        {
           
            if(isset($this->query_sql))
            {
               
                $this->query_result = @mysql_query($this->query_sql);
               
                if(!$this->query_result)
                {
                   
                    throw new Exception('An error occured while querying: ' . mysql_error());
                   
                }
               
                else return $this;
               
            }
           
            else throw new Exception('No query is loaded.');
           
        }
       
        public function getQueryResult()
        {
           
            if(isset($this->query_result))
            {
               
                return $this->query_result;
               
            }
           
            else throw new Exception('No query has been executed.');
           
        }
       
        function loadFetch( $assoc = false, $sql = null )
        {
       
            unset( $this->query_fetch );
            empty( $this->query_fetch );
       
            $sql = (is_null($sql) && isset($this->query_result)) ? $this->query_result : $sql;
            $fetchType = ($assoc == true) ? MYSQL_ASSOC : MYSQL_NUM;
       
            if(!empty($sql))
            {
               
                while($fetch = mysql_fetch_array($sql, $fetchType))
                {
                   
                    $this->query_fetch[] = $fetch;
                   
                }
       
                if(!is_array($this->query_fetch))
                {
                   
                    throw new Exception("An error occured while fetching the array" . mysql_error());
                    
                }
   
                else
                {
                   
                    return $this;
                    
                }
                
            }
       
        }

        public function getFetch()
        {
           
            if(is_array($this->query_fetch) && isset($this->query_fetch))
            {
               
                return $this->query_fetch;
               
            }
           
            else throw new Exception('No fetch has been loaded.');
           
        }
       
        public function secure($string) {
           
            $escapedstring = mysql_real_escape_string($string);
           
            return $secure;
                       
        }
       
    }



?>

The secure method could probably be upgraded quite a bit.
Anyways, this is just a base for you start off with!
__________________
Tanax is offline  
Reply With Quote
Old 12-28-2008, 02:38 PM   #4 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

SVN should be up and running.
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote
Old 12-28-2008, 02:53 PM   #5 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by Tanax View Post
Not trying to take away Orc's job here, but I have this database class, perhaps it could be used? Or used as a base, and someone could modify it for the better?

php Code:
<?php

/**
||||||||||||||||||||||||||||||||||||||||||
|||| @author Tanax
|||| @copyright 2008
||||||||||||||||||||||||||||||||||||||||||
**/


    class DBmysql implements iDB {
       
        private $host;
        private $user;
        private $pass;
        private $data;
       
        private $tables = array();
        private $rows = array();
       
        private $query_sql;
        private $query_result;   
        private $query_fetch = array();
       
       
        public function setHandler($array) {
           
            $this->host = $array['host'];
            $this->user = $array['user'];
            $this->pass = $array['pass'];
            $this->data = $array['data'];
           
            return $this;
           
        }
       
        public function connect() {
           
            @mysql_connect($this->host, $this->user, $this->pass) or die("Could not connect to the database.");
           
            return $this;
           
        }
       
        public function select() {
           
            @mysql_select_db($this->data) or die("Could not select database.");
           
            return $this;
           
        }
       
        public function disconnect() {
           
            @mysql_close() or die("Could not close database connection. Perhaps because the connect isn't opened.");
           
        }
       
        public function loadQuery($query) {
           
            $this->query_sql = $query;
           
            return $this;
           
        }

        public function exeQuery()
        {
           
            if(isset($this->query_sql))
            {
               
                $this->query_result = @mysql_query($this->query_sql);
               
                if(!$this->query_result)
                {
                   
                    throw new Exception('An error occured while querying: ' . mysql_error());
                   
                }
               
                else return $this;
               
            }
           
            else throw new Exception('No query is loaded.');
           
        }
       
        public function getQueryResult()
        {
           
            if(isset($this->query_result))
            {
               
                return $this->query_result;
               
            }
           
            else throw new Exception('No query has been executed.');
           
        }
       
        function loadFetch( $assoc = false, $sql = null )
        {
       
            unset( $this->query_fetch );
            empty( $this->query_fetch );
       
            $sql = (is_null($sql) && isset($this->query_result)) ? $this->query_result : $sql;
            $fetchType = ($assoc == true) ? MYSQL_ASSOC : MYSQL_NUM;
       
            if(!empty($sql))
            {
               
                while($fetch = mysql_fetch_array($sql, $fetchType))
                {
                   
                    $this->query_fetch[] = $fetch;
                   
                }
       
                if(!is_array($this->query_fetch))
                {
                   
                    throw new Exception("An error occured while fetching the array" . mysql_error());
                    
                }
   
                else
                {
                   
                    return $this;
                    
                }
                
            }
       
        }

        public function getFetch()
        {
           
            if(is_array($this->query_fetch) && isset($this->query_fetch))
            {
               
                return $this->query_fetch;
               
            }
           
            else throw new Exception('No fetch has been loaded.');
           
        }
       
        public function secure($string) {
           
            $escapedstring = mysql_real_escape_string($string);
           
            return $secure;
                       
        }
       
    }



?>

The secure method could probably be upgraded quite a bit.
Anyways, this is just a base for you start off with!
>:O lol (10char)
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 12-28-2008, 03:00 PM   #6 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Quote:
Originally Posted by Village Idiot View Post
Resources:
  • A chat room for us to chat in. I would perfer not to set one up, but to use an existing solution (line www.campfirenow.com but free).
There's always the unused IRC channel at #talkphp. Campfire would be great if the free account wasn't so heavily restricted (only 4 people online allowed!)
Salathe is offline  
Reply With Quote
Old 12-29-2008, 01:24 AM   #7 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

I'm having trouble on my main computer (bad ram :(), so I am confined to my crappy computer for now. I probably wont be coding till tomorrow evening.

Quote:
Originally Posted by Salathe View Post
There's always the unused IRC channel at #talkphp. Campfire would be great if the free account wasn't so heavily restricted (only 4 people online allowed!)
We can use that then. And campfire is amazing, I use it at work.
__________________

Village Idiot is offline  
Reply With Quote
Old 12-29-2008, 05:13 AM   #8 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Tanax, we will use that function as a base, although some modifications will probably be made. First will be the removal of the copyright, we wont want to start getting touchy with copyrights, we will have to have ownership of it if we are going to use it. We will have credits though, you can claim credit for the SQL code there.
__________________

Village Idiot is offline  
Reply With Quote
Old 12-29-2008, 05:14 AM   #9 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by Village Idiot View Post
Tanax, we will use that function as a base, although some modifications will probably be made. First will be the removal of the copyright, we wont want to start getting touchy with copyrights, we will have to have ownership of it if we are going to use it.
I'll just allow Tanax to do the DB Class, and as I can make the Config class..?
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 12-29-2008, 05:18 AM   #10 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Go ahead and do the config class, are you sure you understand what we need? I don't think I was incredibly clear in my description.

Tanax can do the DB class, but if it is going to be in the project we must own the copyright, I don't want members contributing code each under their own copyright. This is one of the few things I am going to put my foot down on.

In the meantime, I will get our user class together (I may have to wait till my main comp is working to get some code though).
__________________

Village Idiot is offline  
Reply With Quote
Old 12-29-2008, 05:36 AM   #11 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by Village Idiot View Post
Go ahead and do the config class, are you sure you understand what we need? I don't think I was incredibly clear in my description.

Tanax can do the DB class, but if it is going to be in the project we must own the copyright, I don't want members contributing code each under their own copyright. This is one of the few things I am going to put my foot down on.

In the meantime, I will get our user class together (I may have to wait till my main comp is working to get some code though).
Quote:
Config class. Loads configs into an array (key=name and value=setting value), crates configs, deletes configs. In progress by Orc
Seems kinda self explanatory. ;P Create Configs, delete configs, and loading configs into an array is no problemo. But one thing, where are configs stored? in database? or by flat file?
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 12-29-2008, 05:38 AM   #12 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

I see I'm being over descriptive here, I'll stop.

The configs are stored in a database with the following structure:
__________________

Village Idiot is offline  
Reply With Quote
Old 12-29-2008, 05:40 AM   #13 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

I'm heading to bed now, talk to you all tomorrow.
__________________

Village Idiot is offline  
Reply With Quote
Old 12-29-2008, 05:42 AM   #14 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by Village Idiot View Post
I'm heading to bed now, talk to you all tomorrow.
bye baby. lol
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 12-29-2008, 12:59 PM   #15 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

I understand that the copyright will get removed and that I will get credit for it instead. I was just copying my script, and the copyright always gets there auto when I create a new file so that's why it's there. Feel free to remove it.

Fore future possible troubles: I, Tanax(Marcus Schumann), hereby say that it's okey to remove the copyright from my script.

Just tell me what the DB class needs more/needs editing, and I'll fix it!

One idea from the top of my head: How about being able to execute a query without having to load it first?
__________________
Tanax is offline  
Reply With Quote
Old 12-29-2008, 04:54 PM   #16 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Here is what I want done with it:
  • Make the connnection a variable so we can use the connection for every query.
  • Have the SQL cleaning function return the variable as is if its an int type.
  • Remove all output form the class as throw an exception instead.
As a general rule, classes are never to give output of any kind, they strictly process data.
__________________


Last edited by Village Idiot : 12-29-2008 at 05:29 PM.
Village Idiot is offline  
Reply With Quote
Old 12-29-2008, 06:00 PM   #17 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

To all coders, please start writing and saving it via source control.
__________________

Village Idiot is offline  
Reply With Quote
Old 12-29-2008, 07:30 PM   #18 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Quote:
Originally Posted by Village Idiot View Post
Here is what I want done with it:
  • Make the connnection a variable so we can use the connection for every query.
  • Have the SQL cleaning function return the variable as is if its an int type.
  • Remove all output form the class as throw an exception instead.
As a general rule, classes are never to give output of any kind, they strictly process data.
I'm on it.
And yes, I know that.

Quote:
Originally Posted by Village Idiot View Post
To all coders, please start writing and saving it via source control.
What's source control?
__________________
Tanax is offline  
Reply With Quote
Old 12-31-2008, 11:32 PM   #19 (permalink)
The Frequenter
Prolific Welcomer Upcoming Programmer 
 
Join Date: Sep 2007
Posts: 360
Thanks: 24
Haris is on a distinguished road
Default

Quote:
Originally Posted by Tanax View Post
I'm on it.
And yes, I know that.



What's source control?
Source control example is Subversion. I hope that explains all...
__________________
Necessity is the mother of invention.

My blog
Haris is offline  
Reply With Quote
Old 01-01-2009, 04:31 AM   #20 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Source control makes sure that we are all using the same code, it synchronizes us easily. Use google to get more info on it.
__________________

Village Idiot is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql update with multi fields sarmenhb Absolute Beginners 1 02-06-2009 10:03 PM
Status List codefreek TalkPHP Developer Team 12 11-24-2008 12:23 AM
You are subscribed to this thread mysql update with multi fields sarmenhb Advanced PHP Programming 0 11-15-2008 05:00 AM
mysql update with multi fields sarmenhb General 0 11-15-2008 04:19 AM
list populating proplem Peuplarchie Absolute Beginners 7 06-09-2008 09:02 AM


All times are GMT. The time now is 11:54 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design