Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Saz
    Saz is offline
    Regular Coder
    Join Date
    Jun 2005
    Posts
    277
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Can anyone help with this tell a friend script please ?

    Been trying to setup a tell a friend script for quite a while, but can't seem to find the solution, am looking for a script that doesn't need js at all, where visitors can use the form to let up to 3 of their friends know about the website page that they are one (the website page automatically gets inserted into their form), and the forms get copied to the website owner, plus there's a short captcha, probably 2 digits and 2 letters.

    Anyone come across a script like that at all please ?

    Any help much appreciated.

    Saz.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Have you checked hotscripts.com? I looked briefly but there isn't one that has all of the features you wanted. There is one that sends the link of the page to 3 friends but there is no captcha or what was sent to the site owner. Perhaps you should post in the work offers forum. I can make this for you btw.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Saz
    Saz is offline
    Regular Coder
    Join Date
    Jun 2005
    Posts
    277
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Thanks for that, but did check hs, and had nothing even close there, from what I could see.

    I have placed this in the work offered forum as well.

    Any help appreciated.

    Saz.

  • #4
    Regular Coder
    Join Date
    Sep 2006
    Location
    Vermont, USA
    Posts
    154
    Thanks
    0
    Thanked 6 Times in 6 Posts
    Saz this might help you out, thou it doesnt address the captcha directly, it codes for it. You'll still need to plug in script that will set a session named captcha.

    As always, completely untested. If nothing else, use as a starting point.

    PHP Code:
    <?php
        
    # Mini-config
        
    session_start();
        
    $friend_limit 3;

        function 
    validate_form() { 
            
    $found 0;

            foreach(
    $_POST['friends'] as $friend) : 
                if(
    trim($friend['email']) != '') : 
                    ++
    $found;
                endif;
            endif;

            if(
    $found == || trim($_POST['captcha']) == '' || $_POST['captcha'] !== $_SESSION['captcha']) : 
                return 
    false;
            endif;

            return 
    true;
        }

        if(
    $_POST) : 
            if(
    $status validate_form()) : 
                
    # Sending the email can be done 1 of two ways
                #    1. Loop the post fields and send an individual email to each friend + admin
                #    2. Send a single email with multiple to addresses and a bcc to the admin
                # For simplicity, we're going with #2

                
    $subject    'From your friend';
                
    $body        'Visit this: http://myboguswebsite.com/';
                
    $headers    = array('From: Me <automated@myboguswebsite.com>''Content-type: text/plain''Bcc: admin@myboguswebsite.com');
                
    $to         = array();            

                foreach(
    $_POST['friends'] as $friend) : 
                    if(
    $friend['email'] == '') : 
                        continue;
                    endif;

                    if(
    $friend['name'] != '') : 
                        
    $to[] = $friend['name'].' <'.$friend['email'].'>';
                    else : 
                        
    $to[] = $friend['email'];
                    endif;
                endforeach;

                if(!@
    mail(implode(','$to), $subject$bodyimplode("\r\n"$headers))) : 
                    
    # Maybe say, failed to send emails? or just ignore it and pretend they were
                
    endif;

                die(
    header('Location: thank-you.php'));
                exit;
            endif;
        endif;

        if(isset(
    $status)) : 
            echo 
    '<div class="error">Complete the required fields</div>';
        endif;
    ?>
    <form method="post" action="this-page.php">
        <fieldset>
            <?php 
                
    for($i=0$i<$friend_limit; ++$i) : 
                    
    $required $i == ' <span class="required">*</span>' '';
            
    ?>
            <div>
                <label for="">Friends name:<?php echo $required?></label>
                <input type="text" name="friends[<?php echo $i?>][name]" id="">
            </div>
            <div>
                <label for="">Friends email:<?php echo $required?></label>
                <input type="text" name="friends[<?php echo $i?>][email]" id="">
            </div>
            <?php endfor; ?>
            <div>
                <label for="">Captcha</label>
                <img src="images/your-captcha-script.php">
            </div>
            <div>
                <label for="">&nbsp;</label>
                <input type="submit" value="Submit">
            </div>
        </fieldset>
    </form>
    Active PHP/MySQL application developer available for immediate work.
    syosoft.com mavieo.com - Remote Web Site Administration Suite - Reseller Ready


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •