savannah-register-public
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Savannah-register-public] [task #7199] Submission of EasyWebContact


From: Manish
Subject: [Savannah-register-public] [task #7199] Submission of EasyWebContact
Date: Sat, 11 Aug 2007 09:47:18 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4

URL:
  <http://savannah.gnu.org/task/?7199>

                 Summary: Submission of EasyWebContact 
                 Project: Savannah Administration
            Submitted by: m4manish
            Submitted on: Saturday 08/11/2007 at 09:47
         Should Start On: Saturday 08/11/2007 at 00:00
   Should be Finished on: Tuesday 08/21/2007 at 00:00
                Category: Project Approval
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
        Percent Complete: 0%
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
                  Effort: 0.00

    _______________________________________________________

Details:

A new project has been registered at Savannah 
This project account will remain inactive until a site admin approves or
discards the registration.


= Registration Administration =

While this item will be useful to track the registration process, *approving
or discarding the registration must be done using the specific Group
Administration
<https://savannah.gnu.org/siteadmin/groupedit.php?group_id=9447> page*,
accessible only to site administrators, effectively *logged as site
administrators* (superuser):

* Group Administration
<https://savannah.gnu.org/siteadmin/groupedit.php?group_id=9447>


= Registration Details =

* Name: *EasyWebContact *
* System Name:  *manish*
* Type: Official GNU software
* License: GNU General Public License v2 or later

----

==== Description: ====
easy contact form built on php. To create web based forms, i have creates an
easy contact form with some fields and mailsender file. 

Source Code for Index File.

=====================================

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Contact From</title>
</head>

<body>
<center>

<!-- ================================ begin Contact form code
============================================= -->
<!-- begin CSS -->
<style>

#div_contact{
        font-family:Verdana, Arial, Helvetica, sans-serif;
        font-size:11px;
}

#div_contact .optional{
        font-size:9px;
}

#div_contact #powerby{
}

</style>
<!-- end CSS -->
<!-- begin javascript validator code -->
<script language="javascript" type="text/javascript"
src="validator.js"></script>
<!-- end javascript validator code -->
<?
        if(isset($_GET['msg']) && !empty($_GET['msg']))
        {
        ?>
        <script language="javascript" type="text/javascript">
                alert('<?=$_GET['msg']?>');
        </script>
        <?
        }
?>
<div id="div_contact">
        <table>
        <form action="send_email.php" method="post" name="send_email"
id="send_email" onsubmit="return validateForm(send_email)">
                <tr>
                        <td>
                                Full Name : 
                        </td>
                        <td>
                                <input type="text" name="c_full_name" id="" 
value="" size="40"
maxlength="255" />
                        </td>
                </tr>
                <tr>
                        <td>
                                Address : 
                        </td>
                        <td>
                                <input type="text" name="c_address" 
id="c_address" value="" size="40"
maxlength="255" />
                        </td>
                </tr>
                <tr>
                        <td>
                                Country : <span 
class="optional">(Optional)</span>
                        </td>
                        <td>
                                <input type="text" name="c_country" 
id="c_country" value="" size="40"
maxlength="255" />
                        </td>
                </tr>
                <tr>
                        <td>
                                Telephone Number : 
                        </td>
                        <td>
                                <input type="text" name="c_phone" id="c_phone" 
value="" size="40"
maxlength="255" />
                        </td>
                </tr>
                <tr>
                        <td>
                                Email address : 
                        </td>
                        <td>
                                <input type="text" name="c_email" id="c_email" 
value="" size="40"
maxlength="255" />
                        </td>
                </tr>
                <tr>
                        <td valign="top">
                                Comments : 
                        </td>
                        <td>
                                <textarea name="c_comments" id="c_comments" 
rows="5"
cols="35"></textarea>
                        </td>
                </tr>
                <tr>
                        <td valign="top">
                                <img
src="captcha/CaptchaSecurityImages.php?width=100&height=40&characters=5"
alt="captcha" />
                        </td>
                        <td>
                                <input id="security_code" name="security_code" 
type="text" value=""
size="6" maxlength="5" />
                        </td>
                </tr>
                <tr>
                        <td colspan="2" align="right">
                                <input type="submit" name="c_sub_send" 
value="Submit" />
                        </td>
                </tr>
        </form>
        </table>
        <div id="powerby">
                <!-- Don't Remove This Link -->
                Powered By: <a href="http://www.inetzeal.com/"; 
target="_blank">Link
Building Company</a>
        </div>
</div>
<!-- ================================ end Contact form code
============================================= -->

</center>
</body>
</html>



=========================================================================================================================


Source Code for send_mail


<?

// ====================== begin SETTINGS
==========================================
# To Email Address
$emailaddress='address@hidden';
        
# Message Subject
$emailsubject='This is a test mail with some attachments';

# if you are hosted on a windows server, simply replace all "\n" or "\n\n" in
the below code to "\r\n" or "\r\n\r\n" respectively.
$eol="\r\n";

# script will redirected to this url after the successful email sending
$url_succ_send = 'index.php';
        
# script will redirected to this url after the unsuccessful email sending
$url_not_succ_send = 'index.php';

# script will show this message after the successful email sending
$msg_succ_send = 'Email was send.';

# script will show this message after the unsuccessful email sending
$msg_not_succ_send = 'Email was not send. Please, try later.';

# script will show this message after the unsuccessful code entering
$msg_not_succ_code = 'Code is wrong.';
// ====================== end SETTINGS
==========================================



//==============================================Send email code

if(isset($_POST['c_sub_send']))
{
 
   session_start();
   if(($_SESSION['security_code'] == $_POST['security_code']) &&
(!empty($_SESSION['security_code'])) )
   {
        unset($_SESSION['security_code']);
                
                # From Email Address
                $fromaddress = $_POST['c_email'];
                
                # From Email Address
                $fromname = $_POST['c_full_name'];
                
                # Message Body
                $body = '';
                $body .= 'Full Name : '.$_POST['c_full_name'].$eol;
                $body .= 'Address : '.$_POST['c_address'].$eol;
                if(!empty($_POST['c_country']))
                        $body .= 'Country : '.$_POST['c_country'].$eol;
                $body .= 'Telephone Number : '.$_POST['c_phone'].$eol;
                $body .= 'Comments : '.$_POST['c_comments'].$eol;
                
                if(send_mail($emailaddress, $fromaddress, $fromname, 
$emailsubject,
$body))
                {
                        redirect($url_succ_send,$msg_succ_send);
                }
                else
                {
                        redirect($url_not_succ_send,$msg_not_succ_send);
                }
   } 
   else
   {
                redirect($url_not_succ_send,$msg_not_succ_code);
   }

}

//============================================= Functions

function send_mail($emailaddress, $fromaddress, $fromname, $emailsubject,
$body)
{
  global $eol;
  
  $mime_boundary=md5(time());
  $now = mktime().".".md5(rand(1000,9999));
 
  # Common Headers
  $headers = 'From: '.$fromname.'<'.$fromaddress.'>'.$eol;
  $headers .= 'Reply-To: '.$fromname.'<'.$fromaddress.'>'.$eol;
  $headers .= 'Return-Path: '.$fromname.'<'.$fromaddress.'>'.$eol;    //
these two to set reply address
  $headers .= "Message-ID: <".$now."
TheSystem@".$_SERVER['SERVER_NAME'].">".$eol;
  $headers .= "X-Mailer: PHP v".phpversion().$eol;          // These two to
help avoid spam-filters

  # Boundry for marking the split & Multitype Headers
  $headers .= 'MIME-Version: 1.0'.$eol;
  $headers .= "Content-Type: multipart/related;
boundary=\"".$mime_boundary."\"".$eol;

  $msg = "";     
 
  # Setup for text OR html
  $msg .= "Content-Type: multipart/alternative".$eol;
 
 /* # Text Version
  $msg .= "--".$mime_boundary.$eol;
  $msg .= "Content-Type: text/plain; charset=iso-8859-1".$eol;
  $msg .= "Content-Transfer-Encoding: 8bit".$eol;
  $msg .= strip_tags(str_replace("<br>", "\n", $body)).$eol.$eol;
 
  # HTML Version
  $msg .= "--".$mime_boundary.$eol;
  $msg .= "Content-Type: text/html; charset=iso-8859-1".$eol;
  $msg .= "Content-Transfer-Encoding: 8bit".$eol;
  $msg .= $body.$eol.$eol;*/

  # Finished
  $msg .= "--".$mime_boundary."--".$eol.$eol;  // finish with two eol's for
better security. see Injection.
   
  # SEND THE EMAIL
  ini_set('sendmail_from',$fromaddress);  // the INI lines are to force the
>From Address to be used !
  $res = @mail($emailaddress, $emailsubject, $msg, $headers);
  ini_restore('sendmail_from');
  
  return $res;
}

function redirect($url, $msg)
{
        header('location: '.$url.'?msg='.$msg);
        exit;
}

?>


==== Other Software Required: ====
none






    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/task/?7199>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]