1. 40 Tips for optimizing your php Code

    Date: 10/16/07     Keywords: web

    http://reinholdweber.com/?p=3


    Not sure if this page is accurate or not but I thought I'd share.

    Source: http://community.livejournal.com/php/591041.html

  2. Sessions

    Date: 10/15/07     Keywords: no keywords

    I've been developing something on my home server, and noticed something weird...

    Does using the Header() redirect end Session variables or something? Cause mine aren't being carried over from my login script to the main page (after login).

    Source: http://community.livejournal.com/php/590784.html

  3. Retrieving array values by range of keys

    Date: 10/15/07     Keywords: no keywords

    Suppose I have an associative array that looks like this:
    $arr['alpha_1'] = 'some value';
    $arr['alpha_3'] = 'some value';
    $arr['alpha_4'] = 'some value';
    $arr['beta_2'] = 'some value';
    $arr['beta_4'] = 'some value';
    $arr['beta_6'] = 'some value';
    $arr['gamma_1'] = 'some value';
    $arr['gamma_5'] = 'some value';
    $arr['gamma_6'] = 'some value';
    $arr['gamma_7'] = 'some value';


    Let's assume that the array is reasonably large (hundreds of entries).

    Is there an efficient way of getting all the items whose key starts with 'beta'? (without doing a foreach/strncmp loop?)

    Thanks in advance!

    P.S: The array is not sorted.

    Source: http://community.livejournal.com/php/590552.html

  4. xhtml (php) to doc (rtf) or pdf

    Date: 10/13/07     Keywords: css, html

    Is there a way to convert xhtml formatted documents as a document/rich text file or a pdf on the fly?

    I have looked at htmldoc, but it does not support css in the current release and even in the upcoming 1.9 release, only CSS1 tags are supported and not the positioning tags.

    What I am looking to do is create my resumé in an xhtml 1.0 or 1.1 document and be able to have it convert to word or even pdf. All the agencies that have been contacting me have requested a doc format of my resumé. I have a doc (and pdf) version, but I hate having to do double entry and then save to pdf. I could save as html in OO.org, but I hate doing that. I like the clean xhtml resum&eacue;.

    My resumé can be found here. Already, there is a revision difference on the technical resumé. Also, the non-technical version is not offered up in doc and pdf. I have searched quite a bit and fond services, but they are using the aforementioned htmldoc toolkit. There is a lot of hits on rtf to xhtml, but not vice versa. Thanks for any help you can give. Jeff

    Source: http://community.livejournal.com/php/590286.html

  5. SMS service

    Date: 10/13/07     Keywords: web

    I'd like to set up a service that sends SMS's to my customers, and is capable of receiving messages back from them (i.e. replies for invitations). I've tried a bunch, but I can't seem to find a reasonable service. Can someone recommend a good one (for the USA)?

    Here are services I tried: 
    1) Teleflip. Free, but reliability is terrible. 
    2) SimpleWire. Want $800 to set up an evaluation license.
    3) Clickatell.com wants $1700/month for a shortcode, and says that without a shortcode, there's no way to get 2-way messaging in the US with them. 
    4) SMSXchange.com is almost, almost perfect - everything works, no crazy setup fees... Just the messages that they receive from the cell phones can be in no way correlated to what was sent in the original message (i.e. I dont' know which invitation my user is responding to - there can be several outstanding invitations per user). 

    Any advice? 

    (x-post webdev) 

    Source: http://community.livejournal.com/php/589883.html

  6. Security

    Date: 10/09/07     Keywords: php

    Whats the best way to secure a PHP driven (Image Board) script that doesn't require login/password to use?
    The admin section (using combo of cookies/session controls for login, and hashes)?

    Any pointers would be grateful.

    Source: http://community.livejournal.com/php/589649.html

  7. check boxes on form

    Date: 10/06/07     Keywords: sql

    Hello,
    I have a form built for site preferences and check boxes with Yes / No questions.
    How do I build a sql query and array to fill the check boxes with the users stored preferences?

    Source: http://community.livejournal.com/php/589491.html

  8. PHP source pretty printing

    Date: 10/05/07     Keywords: php, html

    I know there is a way to do this, but i'm at a loss to remember what it is. Given a PHP file is there an easy way to format it into HTML for nice display? Ideally with line numbers added. I want to be able to write code to help analyze my PHP source code.

    Source: http://community.livejournal.com/php/589070.html

  9. Remove attribute from a tag

    Date: 10/05/07     Keywords: no keywords

    I need to remove the text-indent attribute from a string.  The attribute may have different values, so I can't hardcode str_replace('blah','',$string);.   


    Examples:











    So I want to set something up that looks for a substring starting with text-indent and ending with the next ;, then deletes that substring. 

    I'm sure I want to use Regular Expressions, but I'm not sure what I need to use. 

    Suggestions are greatly appreciated.

    Source: http://community.livejournal.com/php/588999.html

  10. SMS

    Date: 09/28/07     Keywords: web

    How could I enable a site to receive SMS messages and post the contents to a blog of sorts (similar to LJ's text-message posting)? I understand how this would be done with email, but SMS is strange to me. I assume there's a program out there that listens in on the same protocol used by SMS, then does whatever with the data once it's received. My hackerish idea of rigging a cell phone up with an unlimited messaging plan then writing a Perl script to gank messages from it would probably work, but it won't scale up nicely :).

    I'm open to purchasing a product to just drop onto my server, but I have no idea where to begin. If someone could point me in the right direction (tutorials to do it myself or a product to purchase) I'd appreciate it! Thanks.

    --
    x-posted to '[info]'webdev

    Source: http://community.livejournal.com/php/588716.html

  11. PHP & Visual FoxPro

    Date: 09/28/07     Keywords: database

    I need to run queries on a visual foxpro database. Anyone here have experience with this? Is foxpro multiuser (ie, can I set up a read-only account)?

    thanks!

    Source: http://community.livejournal.com/php/588294.html

  12. Segfaultalicious

    Date: 09/28/07     Keywords: php, mysql, xml, sql, apache

    I am just putting the finishing touches on a year long project that included in its design the use of an Op-Cache of some sort. After spending the last week and a half slamming a dev. server with siege for testing I noticed that occasionally the apache2 would seg. fault. We're using the LTS version of Ubuntu 6.04 with a stripped down environment dedicated and slaved to Apache w/memcache. From what I've researched and tested, this is actually a pretty well known issue with APC and also xcache. I've already written a simple daemon to watch the primary error log and if it spots a segfault fault error report to restart Apache, but this feels like using a band aid on a compound fracture.... Anyone have any other suggestions?

    PHP compiled with just the bare minimums plus memcache, mysqli & mysql, JSON, and the XML library.

    Source: http://community.livejournal.com/php/588121.html

  13. Strange error....

    Date: 09/27/07     Keywords: php, web

    OK - my group is finalizing a website and we have a convoluted form ... and when we moved it from our server to the end clients we started getting the error:
    Warning: Invalid argument supplied for foreach() in /usr/local/www/vhosts/mtrinc.com/htdocs/mirror/inquiry_handler.php on line 112

    Here is the relevant code

    $section = array();
    $labels = array();
    $message = array();

    foreach ($_POST as $key => $val)
        {
        $section[] = $key;
        foreach ($val as $tit => $dat)
            {
            $labels[] = $tit;
            $message[] = $dat;
            }   
        }

    Anyone have any ideas?

    Source: http://community.livejournal.com/php/587935.html

  14. Context of Static Method Calls

    Date: 09/27/07     Keywords: no keywords

    Take this:

    abstract class A {
        public static function foo() {
            $class = "Don't know...";
            echo "$class
    ";
        }
    }

    class B extends A {
    }

    class C extends A {
    }

    B::foo();
    C::foo();

    Is there a way to determine, inside the foo() method, whether it's being called as a method of B or of C?

    Source: http://community.livejournal.com/php/587764.html

  15. php bug?

    Date: 09/25/07     Keywords: php

    i'm new to php (and this community) and just started taking an intro to php class to improve my skills. anyway, i made a mistake in some of my code at one point i wrote...

    $counter = $counter++

    to increment one instead of just...

    $counter++

    well, i had this going with a while() statement and it didn't work because $counter wasn't being incremented because $counter = counter++ isn't correct. but why is that? it still should increment, right? if you write $counter = $counter++ in the c language (well, with the appropriate syntax, as my instructor tried) it works just fine. he couldn't find any post of this php bug either. any thoughts?

    Source: http://community.livejournal.com/php/587454.html

  16. Switch and Injection

    Date: 09/25/07     Keywords: php

    I’m getting better with my sanitization, thanks to all the help here.

    Now I wonder.

    I’m combining a muti-page php form into a single (hopefully cleaner) php file. 

    Normally I would sanitize and check user rights on every single page. 

    (output from the form is dependent on individual rights of the user stored in a DB)

    I want to protect against injection, and my gut says I should simply place the sanitization function and user rights verification at the top of the page….but I wonder if it should be placed at the top of every switch case. 

    Thoughts?

    Thanks All…!

    (I’m going to start helping an actual php programmer with a side project of his…I'm sure to learn a lot, so hopefully I’ll be able to stop asking so many questions, and start helping to answer a few.  I appreciate everyone’s generous help!)

     

    Source: http://community.livejournal.com/php/587204.html

  17. How do I look up…

    Date: 09/21/07     Keywords: no keywords

    In a follow up to '[info]'pkbarbiedoll’s recent post….

    I’m not sure how to learn what the (I think they are called) “special characters” and syntax used in the post.

    I was able to find what \s means (and subsequently \t \n \r \0 and \xOB )
    From

    '[info]'switchstatement’s reply and link.

     

    But how would find all of these (special characters?)…to be able to decipher and use?

    • Is there a list somewhere?
    • What wording should I use in a search?


    I know I’m completely lame…but I saw this somewhere in a sanitize string…and I’m lost

    '/(;|\||`|>|<|&|^|"|'."\n|\r|'".'|{|}|[|]|\)|\()/i'

    Source: http://community.livejournal.com/php/587001.html

  18. Strip all whitespace characters except ' ' (space)

    Date: 09/21/07     Keywords: no keywords

    I need to remove the leading and trailing whitespace and line returns from the following variable:

    $section_description = "
       
    asdf test one two three

    ";
    The following removes -all- whitespace:
    $section_description    = preg_replace('/\s+/','',$section_description);

    echo $section_description;
    asdftestonetwothree

    This has no effect:
    $section_description    = preg_replace('/ \t\n\x0B\f\r+/','',$section_description);


    echo $section_description;
       
    asdf test one two three

     
    I read that \s is synonymous with \t\n\x0B\f\r.  But that doesn't appear to be the case, or I'm misunderstanding something..

    Any help?

    Source: http://community.livejournal.com/php/586664.html

  19. Inheritance and constants

    Date: 09/15/07     Keywords: php

    I'm trying to push PHP5 OOP to the limit, and it's breaking instead of bending :) What am I doing wrong? 

    Here's what I'd like to do - 

    class Message {
       public static function getMessageType() {
         return self::MY_CONSTANT;
      }
    }

    class IncomingMessage extends Message {
       const MY_CONSTANT = "a";
    }

    class OutgoingMessage extends Message {
       const MY_CONSTANT = "b";
    }

    Then, I'd like to call OutgoingMessage::getMessageType(), and receive a valid value of the constant ("b")...Putting in a declaration of MY_CONSTANT into the base Message class doesn't help. 

    Any ideas? What's a better way of doing this statically? I don't want to make the constant an object property, ad there are other elements in my interface that should be called statically. 

    Here's me trying to do this through static class variables - returns "0" instead of "b":

    class Message {
       public static function test() {
         return self::getMyConstant();
      }
     
      public static function getMyConstant() {
       return "0";
      }
    }

    class IncomingMessage extends Message {
       public static function getMyConstant() {return "a";}
    }

    class OutgoingMessage extends Message {
       public static function getMyConstant() {return "b";}
    }

    echo OutgoingMessage::test();

    Source: http://community.livejournal.com/php/585907.html

  20. field checking

    Date: 09/15/07     Keywords: database

    I'm making a sign up form, and I'm worried about abuse. Does anyone have good resources I can read for checking fields like FirstName, LastName, UserName, and correct email addresses.
    I'm trying to avoid allowing junk data being inserted into the database.

    Source: http://community.livejournal.com/php/585614.html

Previous page  ||  Next page


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home