AD MANAGEMENT

Collapse

BEHOSTED

Collapse

GOOGLE

Collapse

Some Simple But Useful Snippets

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Some Simple But Useful Snippets

    Some Simple But Useful Snippets

    This is just a small list of coding snippets, which can be used within HTML/PHP Documents.

    There not the most exciting or magical snippets but there useful and can make a hell of a lot easier!

    PHP Snippets

    - Emails and Mail

    Simple Mail

    PHP Code:
        mail($to$subject$message$headers); 


    Validate Email Address

    PHP Code:
        function validate_email($str){
        
    $str strtolower($str);
        if(
    ereg("^([^[:space:]]+)@(.+). (ad|ae|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com
        |cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|fi|fj|fk|fm|fo|fr|fx|ga|gb|gov|gd|ge|gf|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|
        hr|ht|hu|id|ie|il|in|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|m
        p|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nato|nc|ne|net|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|
        se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|
        za|zm|zw)$"
    ,$str)){
        return 
    1;
        } else {
        return 
    0;
        }
        } 
    - Date and Time

    Simple Unix Timestamp Conversation

    PHP Code:
        $date_format date('G:i d-m-Y'$unix_time); 
    Will output :

    21:28 27-07-2005



    Server Time

    PHP Code:
        $date_time date('l M d, Y @ g:i A');
        echo (
    $date_time); 

    Localtime not Servertime

    PHP Code:
        $differencetolocaltime=+4;
        
    $new_U=date("U")+$differencetolocaltime*3600;
        
    $fulllocaldatetimedate("d-m-Y h:i:s A"$new_U); 

    - Passwords and Encryption

    128BIT MD5 Encryption

    PHP Code:
        function AuthenticMd5($username$password)
        {
            
    $one $username;$two $password;$thr $one $two;$fou $thr $one;$fiv $fou $one;
            
    $six $thr $thr;$sev $one $two $thr $one;
            
    $md1 md5$sev $two md5($one $fiv md5($sev strrev$sev))));
            
    $md2 md5$md1 md5$one $thr $fou md5$sev $md1)));
            
    $md3 md5$md2 md5($md1));
            
    $md4 md5$md3 $md1 $md2 md5($sev));
            return 
    $md2 $md1$md4 md5($md3 $md2);
        } 
    32BIT MD5 Encryption

    PHP Code:
        $epass md5($password); 


    HTPassword Generator

    PHP Code:
        function htpasswd($pass)
        {
             
    $pass crypt(trim($pass),base64_encode(CRYPT_STD_DES));
             return 
    $pass;
        } 

    Base64 Encryption

    PHP Code:
        $epass base64_encode($password); 
    Base64 Decryption
    PHP Code:
        $password base64_decode($epass); 


    Let me know if anyone finds these useful and / or you want me to write some more out

    As its a bit pointless me writing them out and spending time if know one will look at them

    http://img76.imageshack.us/img76/6450/sc2but4ng.gif | http://img495.imageshack.us/img495/7...gorwtan0je.gif | <a href="http://webtools.sc2.info"><img src="http://img129.imageshack.us/img129/8682/sc2webtan7ju.gif" border="1" width="100" alt="Free Webtools for all" /></a> | <a href="http://www.indexrated.com"><img src="http://img398.imageshack.us/img398/4813/listed1pb.gif" border="1" width="100" alt="Index Rated Directory - Rating Quality Sites" /></a>

    Get all Games,Apps and Wallpapers Nokia, Samsung and Sony Erricson!!


  • #2
    Re: Some Simple But Useful Snippets

    i might use the local time snippet on my site, just so that my site is more useful, why not make a site with all the snippets that you've got and all of your other codes?
    Classic Auto's | Your Ad Here | Your Ad Here | Your Ad Here | Your Ad Here |
    Your Ad Here | Your Ad Here | Your Ad Here | Your Ad Here | Your Ad Here |
    Your Ad Here | Your Ad Here | Your Ad Here | Your Ad Here | Your Ad Here |

    Comment

    Unconfigured Ad Widget

    Collapse

    Announcement

    Collapse
    1 of 2 < >

    FreeHostForum Rules and Guidelines

    Webmaster forum - Web Hosting Forum,Domain Name Forum, Web Design Forum, Travel Forum,World Forum, VPS Forum, Reseller Hosting Forum, Free Hosting Forum

    Signature

    Board-wide Policies:

    Do not post links (ads) in posts or threads in non advertising forums.

    Forum Rules
    Posts are to be made in the relevant forum. Users are asked to read the forum descriptions before posting.

    Members should post in a way that is respectful of other users. Flaming or abusing users in any way will not be tolerated and will lead to a warning or will be banned.

    Members are asked to respect the copyright of other users, sites, media, etc.

    Spam is not tolerated here in most circumstances. Users posting spam will be banned. The words and links will be censored.

    The moderating, support and other teams reserve the right to edit or remove any post at any time. The determination of what is construed as indecent, vulgar, spam, etc. as noted in these points is up to Team Members and not users.

    Any text links or images contain popups will be removed or changed.

    Signatures
    Signatures may contain up to four lines

    Text in signatures is subject to the same conditions as posts with respect decency, warez, emoticons, etc.

    Font sizes above 3 are not allowed

    Links are permitted in signatures. Such links may be made to non-Freehostforum material, commercial ventures, etc. Links are included within the text and image limits above. Links to offensive sites may be subject to removal.

    You are allowed ONLY ONE picture(banner) upto 120 pixels in width and 60 pixels in height with a maximum 30kB filesize.

    In combination with a banner/picture you can have ONLY ONE LINE text link.


    Advertising
    Webmaster related advertising is allowed in Webmaster Marketplace section only. Free of charge.

    Shopping related (tangible goods) advertising is allowed in Buy Sell Trade section only. Free of charge.

    No advertising allowed except paid stickies in other sections.

    Please make sure that your post is relevant.


    More to come soon....
    2 of 2 < >

    Advertise at FreeHostForum

    We offer competitive rates and a many kinds of advertising opportunities for both small and large scale campaigns.More and more webmasters find advertising at FreeHostForum.com is a useful way to promote their sites and services. That is why we now have many long-term advertisers.

    At here, we also want to thank you all for your support.

    For more details:
    http://www.freehostforum.com/threads...eHostForum-com

    More ad spots:
    http://www.freehostforum.com/forums/...-FreeHostForum
    See more
    See less
    Working...
    X