Results 1 to 1 of 1
Like Tree1Likes
  • 1 Post By Nachoman

Gmail Dot Trick PHP

This is a discussion on Gmail Dot Trick PHP within the Source Code Samples forums, part of the Programming category; This is the code for gmail dot trick. I had added this to TC but people abuse it and it ...

  1. #1
    Nachoman's Avatar
    Nachoman is offline Superhero in disguise
    Join Date
    Oct 2008
    Posts
    1,654

    Default Gmail Dot Trick PHP

    This is the code for gmail dot trick. I had added this to TC but people abuse it and it eats server resources. So for those who were looking for it..

    Credit to A.Gamer ..
    Code:
    <?php  
        function add_dot($str){  
            if ((strlen($str) > 1) && (strlen($str) < 31)) {  
                $ca = preg_split("//",$str);  
                array_shift($ca);  
                array_pop($ca);  
                $head = array_shift($ca);  
                $res = add_dot(join('',$ca));  
                $result = array();  
                foreach($res as $val){  
                    $result[] = $head . $val;  
                    $result[] = $head . '.' .$val;  
                }  
                return $result;  
            }  
            return array($str);  
        }  
    
    $res = add_dot("yourname");
    foreach($res as $val) echo $val,"@gmail.com, "; 
    ?>
    Of course this is pretty basic and would need edited for something pretty. Actually, I found the exact post in google And yes it was A Gamer

    C & P

    Assuming you have access to a server that supports PHP... <)

    Simply cut-past the code above into a file ending with a php extension. Example:

    c:\gmailtrick.php

    Without making any changes to the code above, you will get all possible iterations for yourname@gmail.com, which is probably not what you want. So, change the "yourname" (line 19) to the part of your email that is in front of the @ sign and upload the file to your server (or place in the correct directory if you are running an HTTPd on your computer).

    Then access the page via your browser for the results. Example:

    Code:
    http://yourserver.tld/userpath/gmailtrick.php
    If you wanted to make it dynamic, then you could create a form and replace the "yourname" with the appropriate $_POST (or $_REQUEST) variable.

    Or a quick way to make a dynamic page without a form would be to replace "yourname" with $_REQUEST['name'] and then access your file with the 'name' parameter. Example:

    (see attached file for working example code)

    This is by no means 'complete' code... It is the minimum required for the desired results. The output is not going to be HTTP compliant (i.e. no <html><body> tags, etc).

    But it should be enough for most beginners to be able to build a proper web page around it if they wanted to. Just put all your HTML stuff before and after the <?PHP and ?> tags.

    Note: I can never simply copy-n-paste code from sites like this because it inserts 'gremlins' (i.e. non-breaking spaces) in order to get the code to align in the browser. If you are getting PHP errors in the first or second line when you try to access your page, then download the attached text/php file and go from there.
    Attached Files
    Seatbelt99 likes this.

  2.   Alt These ads help cover server costs and such.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Facebook Bots | Admin Forum