Showing posts with label php. Show all posts
Showing posts with label php. Show all posts

Monday, 8 April 2013

301 redirect HTTPS to HTTP on Apache server

Redirecting https to http site-wide using the .htaccess file would be done through:



Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteCond %{SERVER_PORT} ^443$ [OR]
RewriteCond %{HTTPS} =on
RewriteRule ^(.*)$ http://yousitename.com/$1 [R=301,L]


One way is as in this example:


RewriteEngine on
#this page has to be on https
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} ^/secure-page1.php$ [NC]
RewriteRule ^(.*)$ https://
yousitename.com/$1 [L,R=301]

#this page has to be on https
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} ^/secure-page2.php$ [NC]
RewriteRule ^(.*)$ https://example.com/$1 [L,R=301]

#all other pages have to be on http
RewriteCond %{SERVER_PORT} ^443$  [OR]
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^/secure-page1.php$ [NC]
RewriteCond %{REQUEST_URI} !^/secure-page2.php$ [NC]
RewriteRule ^(.*)$ http://
yousitename.com/$1 [L,R=301]


So assuming you have a good reason to want some urls as https AND have them indexed, then you can add php scripting to each page and determine whether it has to be http or https.
To permit the use of php on pages suffixed as .html you need to add an Apache handler in the .htaccess file:


# parsing html as php
AddHandler application/x-httpd-php .html 
NB: The above directiove can vary greatly depending on the rexact server configuration. It can be any of the below directives (or none for that matter):
Addhandler application/x+https-php5 .html
or
AddType application/x-httpd-php5 .html
or another combination like that.  It's bewildering how many different Apache server configuraiotns the can be and how much basic directievs can differ. The trouble is if yuo use the wrong one, you get a 500 error. So it ends up being trial and error all the way.

 php script to be added at the top of every page where you need to 301 redirect from https to http, before any other line of source code would be: 



<?php
if  ( $_SERVER['HTTPS'] )
        {
                $host = $_SERVER['HTTP_HOST'];
                $request_uri = $_SERVER['REQUEST_URI'];
                $good_url = "http://" . $host . $request_uri; 

                header( "HTTP/1.1 301 Moved Permanently" );
                header( "Location: $good_url" );
                exit;
        }
?> 




Friday, 15 February 2013

multiple file attachment in php script and sending mail


<html>
<head>
<title>GLobal web solution Tutorial</title>
</head>
<body>
<form action="php_sendmail_multiple_upload2.php" method="post" name="form1" enctype="multipart/form-data">
<table width="343" border="1">
<tr>
<td>To</td>
<td><input name="txtTo" type="text" id="txtTo"></td>
</tr>
<tr>
<td>Subject</td>
<td><input name="txtSubject" type="text" id="txtSubject"></td>
</tr>
<tr>
<td>Description</td>
<td><textarea name="txtDescription" cols="30" rows="4" id="txtDescription"></textarea></td>
</tr>
<tr>
<td>Form Name</td>
<td><input name="txtFormName" type="text"></td>
</tr>
<tr>
<tr>
<td>Form Email</td>
<td><input name="txtFormEmail" type="text"></td>
</tr>
<tr>
 <td>Attachment</td>
 <td>
<input name="fileAttach[]" type="file"><br>
<input name="fileAttach[]" type="file"><br>
<input name="fileAttach[]" type="file"><br>
<input name="fileAttach[]" type="file"><br>
<input name="fileAttach[]" type="file"><br>
<input name="fileAttach[]" type="file"><br>
 </td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Send"></td>
</tr>
</table>
</form>
</body>
</html>







<html>
<head>

</head>
<body>
<?
$strTo = $_POST["txtTo"];
$strSubject = $_POST["txtSubject"];
$strMessage = nl2br($_POST["txtDescription"]);

//*** Uniqid Session ***//
$strSid = md5(uniqid(time()));

$strHeader = "";
$strHeader .= "From: ".$_POST["txtFormName"]."<".$_POST["txtFormEmail"].">\nReply-To: ".$_POST["txtFormEmail"]."";

$strHeader .= "MIME-Version: 1.0\n";
$strHeader .= "Content-Type: multipart/mixed; boundary=\"".$strSid."\"\n\n";
$strHeader .= "This is a multi-part message in MIME format.\n";

$strHeader .= "--".$strSid."\n";
$strHeader .= "Content-type: text/html; charset=utf-8\n";
$strHeader .= "Content-Transfer-Encoding: 7bit\n\n";
$strHeader .= $strMessage."\n\n";

//*** Attachment ***//
for($i=0;$i<count($_FILES["fileAttach"]["name"]);$i++)
{
if($_FILES["fileAttach"]["name"][$i] != "")
{
$strFilesName = $_FILES["fileAttach"]["name"][$i];
$strContent = chunk_split(base64_encode(file_get_contents($_FILES["fileAttach"]["tmp_name"][$i])));
$strHeader .= "--".$strSid."\n";
$strHeader .= "Content-Type: application/octet-stream; name=\"".$strFilesName."\"\n";
$strHeader .= "Content-Transfer-Encoding: base64\n";
$strHeader .= "Content-Disposition: attachment; filename=\"".$strFilesName."\"\n\n";
$strHeader .= $strContent."\n\n";
}
}


$flgSend = @mail($strTo,$strSubject,null,$strHeader);  // @ = No Show Error //

if($flgSend)
{
echo "Mail send completed.";
}
else
{
echo "Cannot send mail.";
}
?>
</body>
</html>

Thursday, 6 December 2012

what's new in php 5.4 and php 5.4 here


New features

PHP 5.4.0 offers a wide range of new features:
  • Support for traits has been added.
  • Short array syntax has been added, e.g. $a = [1, 2, 3, 4]; or $a = ['one' => 1, 'two' => 2, 'three' => 3, 'four' => 4];.
  • Function array dereferencing has been added, e.g. foo()[0].
  • Closures now support $this.
  • <?= is now always available, regardless of the short_open_tag php.ini option.
  • Class member access on instantiation has been added, e.g. (new Foo)->bar().
  • Class::{expr}() syntax is now supported.
  • Binary number format has been added, e.g. 0b001001101.
  • Improved parse error messages and improved incompatible arguments warnings.
  • The session extension can now track the upload progress of files.
  • Built-in development web server in CLI mode.     

Backward Incompatible Changes

Although most existing PHP 5 code should work without changes, please take note of some backward incompatible changes:
  • Safe mode is no longer supported. Any applications that rely on safe mode may need adjustment, in terms of security.
  • Magic quotes has been removed. Applications relying on this feature may need to be updated, to avoid security issues. get_magic_quotes_gpc() and get_magic_quotes_runtime() now always return FALSE. set_magic_quotes_runtime() raises an E_CORE_ERROR level error.
  • The register_globals and register_long_arrays php.ini directives have been removed.
  • Call-time pass by reference has been removed.
  • The break and continue statements no longer accept variable arguments (e.g., break 1 + foo() * $bar;). Static arguments still work, such as break 2;. As a side effect of this change break 0; and continue 0; are no longer allowed.
  • In the date and time extension, the timezone can no longer be set using the TZ environment variable. Instead you have to specify a timezone using the date.timezone php.ini option or date_default_timezone_set() function. PHP will no longer attempt to guess the timezone, and will instead fall back to "UTC" and issue a E_WARNING.
  • Non-numeric string offsets - e.g. $a['foo'] where $a is a string - now return false on isset() and true on empty(), and produce a E_WARNING if you try to use them. Offsets of types double, bool and null produce a E_NOTICE. Numeric strings (e.g. $a['2']) still work as before. Note that offsets like '12.3' and '5 foobar' are considered non-numeric and produce a E_WARNING, but are converted to 12 and 5 respectively, for backward compatibility reasons. Note: Following code returns different result. $str='abc';var_dump(isset($str['x'])); // false for PHP 5.4 or later, but true for 5.3 or less
  • Converting an array to a string will now generate an E_NOTICE level error, but the result of the cast will still be the string "Array".
  • Turning NULL, FALSE, or an empty string into an object by adding a property will now emit an E_WARNING level error, instead of E_STRICT.
  • Parameter names that shadow super globals now cause a fatal error. This prohibits code like function foo($_GET, $_POST) {}.
  • The Salsa10 and Salsa20 hash algorithms have been removed.
  • array_combine() now returns array() instead of FALSE when two empty arrays are provided as parameters.
  • If you use htmlentities() with asian character sets, it works like htmlspecialchars() - this has always been the case in previous versions of PHP, but now an E_STRICT level error is emitted.     

Deprecated features in PHP 5.4.x

Deprecated functions:

Changed Functions

OpenSSL:

Other changes

  • The default character set for htmlspecialchars() and htmlentities() is now UTF-8, instead of ISO-8859-1. Note that changing your output charset via the default_charset configuration setting does not affect htmlspecialchars/htmlentities unless you are passing "" (an empty string) as the encoding parameter to your htmlspecialchars()/ htmlentities() calls. Generally we do not recommend doing this because you should be able to change your output charset without affecting the runtime charset used by these functions. The safest approach is to explicitly set the charset on each call to htmlspecialchars() and htmlentities().
  • E_ALL now includes E_STRICT level errors in the error_reporting configuration directive.
  • SNMP now has an OOP API. Functions now return FALSE on every error condition including SNMP-related (no such instance, end of MIB, etc). Thus, in particular, breaks previous behavior of get/walk functions returning an empty string on SNMP-related errors. Multi OID get/getnext/set queries are now supported. Dropped UCD-SNMP compatibility code, consider upgrading to net-snmp v5.3+, Net-SNMP v5.4+ is required for Windows version. In sake of adding support for IPv6 DNS name resolution of remote SNMP agent (peer) is done by extension now, not by Net-SNMP library anymore.
  • OpenSSL now supports AES.
  • CLI SAPI doesn't terminate any more on fatal errors when using interactive mode with readline support.
  • $_SERVER['REQUEST_TIME_FLOAT'] has been added to include microsecond precision.
  • Added new hash algorithms: fnv132, fnv164, joaat
  • Chained string offsets - e.g. $a[0][0] where $a is a string - now work.
  • Arrays cast from SimpleXMLElement now always contain all nodes instead of just the first matching node. All SimpleXMLElement children are now always printed when using var_dump(), var_export() and print_r().
  • It's now possible to enforce the class' __construct arguments in an abstract constructor in the base class.     
    

Thursday, 16 August 2012

integrate icici payment gateway php without JavaBridge/JDK



The Installation process for SFAClient.zip

 

1.     Unzip SFAClient.zip. This will create a folder called SFAClient
2.    SFAClient contains the following files and directory.
1.     Sfa – SFA Client library (contains the PHP Sfa library)
2.     Test Pages – Sample pages for transactions and a test page (test.php) for testing php.
3.     sfa.properties

PHP Web Application Directory Structure – Sample Example

·         Create the following  PHP Web application directory structure as given below
o   E.g. the Merchant website directory name is “Merchant_Site_Dir”.
·         Copy all the directory and files from unzipped SFAClient to Merchant_Site_Dir .



§  Place the directory Merchant_Site_Dir in C:/wamp/www/ as shown below.
·         Sfa, Test Pages and sfa.properties



Note:
§  Sfa folder should be copied to the folder where TestPages/Merchant pages are present.
§  The directory names are case sensitive. Create them as mention above.











Changes in Test Pages

  • Open the SFAResponse.php and made some changes

<?php
include("Sfa/EncryptionUtil.php");


                        $strMerchantId="00000001";
                        $astrFileName="c://key//sbi//00000001.key";
                        $astrClearData;
                        $ResponseCode = "";
                        $Message = "";
                        $TxnID = "";
                        $ePGTxnID = "";
                        $AuthIdCode = "";
                        $RRN = "";
                        $CVRespCode = "";
                        $Reserve1 = "";
                        $Reserve2 = "";
                        $Reserve3 = "";
                        $Reserve4 = "";
                        $Reserve5 = "";
                        $Reserve6 = "";
                        $Reserve7 = "";
                        $Reserve8 = "";
                        $Reserve9 = "";
                        $Reserve10 = "";


Note : Mercant ID must be same as the .key file name. e.g. if file is 00000001.key then Merchant ID must be 00000001.

  • According to merchant type i.e. SSL or MOTO change select the file and make the changes
    • e.g. if Merchant is SSL Merchant then change the TestSsl.php
<?php


include("Sfa/BillToAddress.php");
include("Sfa/CardInfo.php");
include("Sfa/Merchant.php");
include("Sfa/MPIData.php");
include("Sfa/ShipToAddress.php");
include("Sfa/PGResponse.php");
include("Sfa/PostLibPHP.php");
include("Sfa/PGReserveData.php");

 $oMPI                        =          new     MPIData();

 $oCI               =          new     CardInfo();

 $oPostLibphp =          new     PostLibPHP();

 $oMerchant    =          new     Merchant();

 $oBTA                       =          new     BillToAddress();

 $oSTA                        =          new     ShipToAddress();

 $oPGResp      =          new     PGResponse();

 $oPGReserveData = new PGReserveData();




 $oMerchant->setMerchantDetails("00000001","00001203","00001203","193.545.34.33",rand()."","Ord123","http://10.10.10.167/SFAResponse.php","POST","INR","INV123","req.Sale","100","","Ext1","true","Ext3","Ext4","Ext5");
?>
Put marchant id.


  • e.g. if Merchant is Moto Merchant then change the TestMoto.php



Set the key directory path


·         'Key.Directory' should contain the name of the folder, which contains the merchant key. A trailing slash has to be included at the end of this value. The name of the file (.key file) need not be set. Save the file after making other relevant changes.
§  Key.Directory=D://WAMP//WWW//key//
Note: Don’t include key in key directory path.
·         Enable the verbose parameter to “true” only when required to generate logs. These logs are to be used for debugging (while integration) and should not be set to “true” in production as it might lead to considerable amount of logs depending on the number of transactions.
·         To verify the success of the above operations open the jar file again and check if the properties file has the values set.

 

 

Enabling Curl extensions

 


The curl extension files are

  • libeay32.dll
  • ssleay32.dll

These files should be present in to C:\WINDOWS\system32 and Php installation directory.

Open the php.ini file from PHP installation directory remove the semicolon of extension=php_curl.dll.

 


Disabling mcrypt extensions (for PHP version <= 4.4.4)

 


  • Open the php.ini file from PHP installation directory add the semicolon on start of line  ;extension=php_mcrypt.dll (if semicolon not present).

 Checklist

 

·           Merchant should have access to ePG over https
·           Check connectivity between php
1.     Restart the IIS Server
2.     Browse the testjava.php page either from browser of from IIS as shown below
                                       i.    Url : http://localhost/Merchant_Site_Name/test.php



Transaction Testing

 

·         Restart the Apache
·         Open the PHP page either from browser or from Apache
·         If Merchant is SSL then open TestSsl.php else if Merchant is Moto then TestMoto.php
1.         From IIS

               2.  From Browser
·         Type the URL : http://localhost/Merchant_Site_name/TestSsl.php


Troubleshooting

 


Problem : In log file if you got SSL certificate problem….



Solution : Add the certificate CSR in \Sfa\cacerts.pem file. (Refer Adding Certificates in  Cacerts section).

Tuesday, 31 July 2012

send php mail with submit form data and file attachment

careers.html

<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 


<title>Untitled Document</title> 
</head> 

<body style="padding:3px; margin:0px;" bgcolor="#FFFFFF"> 
<table cellpadding="0" cellspacing="0" border="0" width="440"> 
    
    <tr><td style="height:10px"></td></tr> 
    <tr> 
      <td colspan="2" style="text-align:justify; line-height:15px;" class="body"> 
        
      <form name="frm" method="POST" action="careersuccess.php" enctype="multipart/form-data"> 
      <table cellpadding="0" cellspacing="0" border="0" width="100%"> 
          <tr> 
            <td width="23%" class="body"> Name</td> 
            <td width="3%" class="body">:</td> 
            <td width="74%"><input type="text" name="strname" class="textfield"></td> 
        </tr> 
        <tr><td style="height:3px"></td></tr> 
        <tr> 
            <td width="23%" class="body"> Address</td> 
            <td width="3%" class="body">:</td> 
            <td width="74%"><textarea cols="16" name="straddress"></textarea></td> 
        </tr> 
        <tr><td style="height:3px"></td></tr> 
        <tr> 
            <td width="23%" class="body"> City</td> 
            <td width="3%" class="body">:</td> 
            <td width="74%"><input type="text" name="strcity" class="textfield"></td> 
        </tr> 
        <tr><td style="height:3px"></td></tr> 
        <tr> 
            <td width="23%" class="body"> State</td> 
            <td width="3%" class="body">:</td> 
            <td width="74%"><input type="text" name="strstate" class="textfield"></td> 
        </tr> 
        <tr><td style="height:3px"></td></tr> 
        <tr> 
            <td width="23%" class="body"> Contact No</td> 
            <td width="3%" class="body">:</td> 
            <td width="74%"><input type="text" name="strno" class="textfield"></td> 
        </tr> 
        <tr><td style="height:3px"></td></tr> 
        <tr> 
            <td width="23%" class="body"> Email</td> 
            <td width="3%" class="body">:</td> 
            <td width="74%"><input type="text" name="stremail" class="textfield"></td> 
        </tr> 
        <tr><td style="height:3px"></td></tr> 
        <tr> 
            <td width="23%" class="body"> Comments</td> 
            <td width="3%" class="body">:</td> 
            <td width="74%"><textarea cols="16" name="strcomments"></textarea></td> 
        </tr> 
        <tr><td style="height:3px"></td></tr> 
        <tr> 
            <td width="23%" class="body"> Resume</td> 
            <td width="3%" class="body">:</td> 
            <td width="74%"><input type="file" name="strresume"></td> 
        </tr> 
        <tr><td style="height:10px"></td></tr> 
        <tr> 
            <td colspan="3" align="center"> 
                <input type="submit" value="Send" name="submit" onClick="return validate();"> <input type="reset" value="Reset" name="reset"> 
            </td> 
        </tr> 
        
      </table>    
     </form> 

</td> 
    </tr> 
    <tr> 
      <td colspan="2" align="center"> </td> 
  </tr> 
    </table> 
</body> 
</html>




careersuccess.php

<?php 
      
                      
       $strname
=ucfirst($_REQUEST["strname"]); 
    
$straddress=ucfirst($_REQUEST["straddress"]); 
    
$strcity=ucfirst($_REQUEST["strcity"]); 
    
$strstate=ucfirst($_REQUEST["strstate"]);        
        
       
$phone=$_REQUEST["strno"]; 
       if(
$phone != ""){ $strno=$phone; } else { $strno="-"; }    
        
    
$stremail=$_REQUEST["stremail"];    
    
$strcomments=ucfirst($_REQUEST["strcomments"]); 

    
    
$filename=$_FILES["strresume"]["name"]; 
    
$filetype=$_FILES["strresume"]["type"]; 
    
$filesize=$_FILES["strresume"]["size"]; 
    
$filetemp=$_FILES["strresume"]["tmp_name"]; 


        
    if(
$filetype=="application/octet-stream" or $filetype=="text/plain" or $filetype=="application/msword") 
    { 
    
        
$message= ' 
    
    
            <table cellspacing="0" cellpadding="8" border="0" width="400"> 
            <tr> 
                <td colspan="2"></td> 
            </tr> 
            <tr bgcolor="#eeeeee"> 
                <td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Name</strong></td> 
                <td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'
.$strname.'</td> 
            </tr> 
            <tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr> 
            <tr bgcolor="#eeeeee"> 
              <td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Address</strong></td> 
              <td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'
.$straddress.'</td> 
              </tr> 
            <tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr> 
            <tr bgcolor="#eeeeee"> 
              <td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>City</strong></td> 
              <td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'
.$strcity.'</td> 
              </tr> 
              <tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr> 
            <tr bgcolor="#eeeeee"> 
              <td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>State</strong></td> 
              <td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'
.$strstate.'</td> 
              </tr> 
              <tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr> 
            <tr bgcolor="#eeeeee"> 
              <td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Contact No.</strong></td> 
              <td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'
.$strno.'</td> 
              </tr> 
            <tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr> 
            <tr bgcolor="#eeeeee"> 
                <td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Email</strong></td> 
                <td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'
.$stremail.'</td> 
            </tr> 
            <tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr> 
            
            <tr bgcolor="#eeeeee"> 
                <td colspan="2" style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Comments</strong></td> 
            </tr>                
            <tr bgcolor="#eeeeee"> 
                <td colspan="2" style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'
.$strcomments.'</td> 
            </tr>                
                                    
            <tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr> 
         </table> 


            

'
; 

    
// MAIL SUBJECT 

    
$subject = "Mail with doc file attachment"; 
    
    
// TO MAIL ADDRESS 
    
    
    
$to="to@mail.com"; 
/* 
    // MAIL HEADERS 
                        
    $headers  = "MIME-Version: 1.0\n"; 
    $headers .= "Content-type: text/html; charset=iso-8859-1\n"; 
    $headers .= "From: Name <name@name.com>\n"; 

*/ 
  


    // MAIL HEADERS with attachment 

    
$fp = fopen($strresume, "rb"); 
    
$file = fread($fp, $strresume_size); 

    
$file = chunk_split(base64_encode($file)); 
    
$num = md5(time()); 
    
        
//Normal headers 

    
$headers  = "From: Name<name@name.com>\r\n"; 
       
$headers  .= "MIME-Version: 1.0\r\n"; 
       
$headers  .= "Content-Type: multipart/mixed; "; 
       
$headers  .= "boundary=".$num."\r\n"; 
       
$headers  .= "--$num\r\n"; 

        
// This two steps to help avoid spam    

    
$headers .= "Message-ID: <".$now." TheSystem@".$_SERVER['SERVER_NAME'].">\r\n"; 
    
$headers .= "X-Mailer: PHP v".phpversion()."\r\n";          

        
// With message 
        
    
$headers .= "Content-Type: text/html; charset=iso-8859-1\r\n"; 
       
$headers .= "Content-Transfer-Encoding: 8bit\r\n"; 
       
$headers .= "".$message."\n"; 
       
$headers .= "--".$num."\n" 

        
// Attachment headers 

    
$headers  .= "Content-Type:".$strresume_type." "; 
       
$headers  .= "name=\"".$strresume_name."\"r\n"; 
       
$headers  .= "Content-Transfer-Encoding: base64\r\n"; 
       
$headers  .= "Content-Disposition: attachment; "; 
       
$headers  .= "filename=\"".$strresume_name."\"\r\n\n"; 
       
$headers  .= "".$file."\r\n"; 
       
$headers  .= "--".$num."--"; 

    
    
    
// SEND MAIL 
        
       
@mail($to, $subject, $message, $headers); 
    

     
fclose($fp); 

    echo 
'<font style="font-family:Verdana, Arial; font-size:11px; color:#333333; font-weight:bold">Attachment has been sent Successfully.<br /></font>'; 
} 
else 
    { 
        echo 
'<font style="font-family:Verdana, Arial; font-size:11px; color:#F3363F; font-weight:bold">Wrong file format. Mail was not sent.</font>'; 
        
//echo "<script>window.location.href='careers.html';</script>"; 
    
} 
?>