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 01-20-2008, 11:05 AM   #21 (permalink)
The Frequenter
Prolific Welcomer Upcoming Programmer 
 
Join Date: Sep 2007
Posts: 360
Thanks: 24
Haris is on a distinguished road
Default

Heh.

Now they're.
__________________
Necessity is the mother of invention.

My blog
Haris is offline  
Reply With Quote
Old 01-20-2008, 02:51 PM   #22 (permalink)
The Contributor
 
buggabill's Avatar
 
Join Date: Jan 2008
Location: Maine, USA
Posts: 92
Thanks: 2
buggabill is on a distinguished road
Default

I have seen a lot of stuff about Zend. Maybe I will try that one first... Whatever I do, They are all cool to use.
__________________
-- Bill
"Why is it drug addicts and computer aficionados are both called users?" -Clifford Stoll
buggabill is offline  
Reply With Quote
Old 01-29-2008, 06:33 PM   #23 (permalink)
Alan @ CIT
Member of the Month
The Frequenter
Member of the Month Top Contributor 
 
Alan @ CIT's Avatar
 
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
Alan @ CIT is on a distinguished road
Default

I actually got around to writing some PHP code today so here is this weeks 5 lines from me

PHP Code:
            $result mysql_query($query$this->link);

            if (
$result === FALSE)
            {
                throw new 
Exception('Query failed: ' mysql_error($this->link), 1007);
            }

            if (
mysql_affected_rows($this->link) == 0)
            {
                throw new 
Exception('No rows deleted by query: ' $query1008);
            } 
I'm knocking up a small email verification script for a friend - will probably release it here if he doesn't mind when it's finished.

Alan
Send a message via MSN to Alan @ CIT
Alan @ CIT is offline  
Reply With Quote
Old 01-29-2008, 07:28 PM   #24 (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

These are the last five that I wrote, but I have modified many lines since last night

PHP Code:
$file "../sitemap.xml";
$file_handle fopen($file'w') or die("can't open file");
fwrite($file_handle$sitemap_string);
fclose($file_handle);


echo 
"Instalation Complete, please delete the install directory."
__________________

Village Idiot is offline  
Reply With Quote
Old 01-29-2008, 11:23 PM   #25 (permalink)
The Acquainted
 
wGEric's Avatar
 
Join Date: Nov 2007
Posts: 166
Thanks: 0
wGEric is on a distinguished road
Default

Quote:
Instalation
Typo.

blah blah blah blah blah, is it long enough yet?
__________________
Eric
wGEric is offline  
Reply With Quote
Old 01-30-2008, 02:38 AM   #26 (permalink)
The Frequenter
Prolific Welcomer Upcoming Programmer 
 
Join Date: Sep 2007
Posts: 360
Thanks: 24
Haris is on a distinguished road
Default

php Code:
// Query for retriving comments
  $sql = 'SELECT ' . $wpdb->comments . '.* FROM ' . $wpdb->comments .
    ' LEFT JOIN ' . $wpdb->posts . ' ON (' . $wpdb->posts . '.ID = ' . $wpdb->comments . '.comment_post_ID' . ')' .
    ' WHERE ' . $type .
    ' ' . $wpdb->comments . '.acs_approval_date >= "' . $current_timestamp .
    '" && ' . $wpdb->comments . '.acs_approval_date <= "' . $ajax_timestamp .
__________________
Necessity is the mother of invention.

My blog
Haris is offline  
Reply With Quote
Old 01-30-2008, 03:44 AM   #27 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

PHP Code:
  public static function connect($connectSMTP$port)
         {
             try {
             if (!
ini_set('SMTP'$connectSMTP) && !ini_set('smtp_port'$port) )
             {
                 
$ini = array(
                 
=> ini_set('SMTP'$connectSMTP),
                 
=> ini_set('smtp_port'$port)
                 );
                 
                 foreach(
$ini as $_ini => $val)
                 {
                     return 
$ini[$val];
                     
                 }
         }
       } catch (
Exception $_1error)
       {
           
$_1error 'There seems to be a problem with the connection';
           return 
$_1error;
       } 
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 02-06-2008, 03:37 PM   #28 (permalink)
The Addict
Top Contributor Good Samaritan 
 
Join Date: Jan 2008
Location: USA
Posts: 217
Thanks: 16
RobertK is on a distinguished road
Default

Been a little while, but here's my last five lines. Turning a database class into a singleton factory capable of self-initialization and global-less connection abilities. I didn't count the tidy line that I wrapped as two though, so it's still five lines.

PHP Code:
  public static function getInstance() {
    if(
self::$pInstance == null) {
      
self::$pInstance = new Database();
      
self::$pInstance->connect(Config::get('db_host'), Config::get('db_user'), Config::get('db_pass'))
                      ->
selectDB(Config::get('db_name'));
    }
    return 
self::$pInstance
__________________
Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning. - Rich Cook
RobertK is offline  
Reply With Quote
Old 02-27-2008, 08:19 PM   #29 (permalink)
Alan @ CIT
Member of the Month
The Frequenter
Member of the Month Top Contributor 
 
Alan @ CIT's Avatar
 
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
Alan @ CIT is on a distinguished road
Default

My 5 lines aren't particularly interesting this week - just an error check:

PHP Code:
            if ($result === null)
            {
                
// Email address or confirmation code invalid
                
$this->_flashMessenger->addMessage($this->language->_('theEmailAddressAndConfirmationCodeDontMatch'));
                
$this->_redirect('/member/reset-password');
                return;
            } 
Alan
Send a message via MSN to Alan @ CIT
Alan @ CIT is offline  
Reply With Quote
Old 02-27-2008, 09:10 PM   #30 (permalink)
The Contributor
 
abiko's Avatar
 
Join Date: Feb 2008
Location: Croatia
Posts: 90
Thanks: 4
abiko is on a distinguished road
Default

Ok. Last 5 lines..
Error handle in add function..

PHP Code:
                    case '1':                        
                        
$engine->tmpl->catError         'error';
                        
$engine->tmpl->catErrorData    =    $fields;                        
                        
$engine->tmpl->catInfo            =    $data;                        
                    break; 
__________________
Back from sysadmins to the programmers.
Send a message via ICQ to abiko Send a message via MSN to abiko
abiko 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


All times are GMT. The time now is 06:48 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