MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 3.139.108.99
Web Server : Apache
System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : ppcad7no ( 715)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0750) :  /home2/ppcad7no/akelectricalsrepairing.com/../.pki/../ssl/../trishaanfoundation.org/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/akelectricalsrepairing.com/../.pki/../ssl/../trishaanfoundation.org/donation.php
<?php
    // include_once('admin/config.php');
    
    function isAllowedMessage($message) {
        $allowedChars = '/^[a-zA-Z0-9,@. ]*$/';
        return preg_match($allowedChars, $message);
    }
    
    if ($_SERVER["REQUEST_METHOD"] === "POST") {
        if (isset($_POST['submit'])) {
            $name = $_POST['name'];
            $phone = $_POST['phone'];
            $email = $_POST['email'];
            $city = $_POST['city'];
            $amount = $_POST['amount'];
            $pan = $_POST['pan'];
            $message = $_POST['message'];
            date_default_timezone_set("Asia/Kolkata");
            $currentTime = date("Y-m-d H:i:s");
            $errors = array();
    
            // Validate input
            if (empty($name)) {
                $errors[] = "Name field is required.";
            } elseif (!preg_match('/^[a-zA-Z ]+$/', $name)) {
                $errors[] = "Name can only contain alphabets.";
            }
    
            if (empty($email)) {
                $errors[] = "Email field is required.";
            } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
                $errors[] = "Invalid email format.";
            }
    
            if (empty($phone)) {
                $errors[] = "Phone field is required.";
            } elseif (!preg_match('/^\d{10}$/', $phone)) {
                $errors[] = "Phone number should have exactly 10 digits.";
            }
    
            // Sanitize input
            $name = filter_var($name, FILTER_SANITIZE_STRING);
            $phone = filter_var($phone, FILTER_SANITIZE_NUMBER_INT);
            $amount = filter_var($amount, FILTER_SANITIZE_NUMBER_INT);
            $email = filter_var($email, FILTER_SANITIZE_EMAIL);
            $message = htmlspecialchars($message, ENT_QUOTES, 'UTF-8');
    
            // Check for potentially malicious content in the message
            if (!isAllowedMessage($message)) {
                $errors[] = "Your message contains potentially malicious content or disallowed characters.";
            }
    
    if (empty($errors)) {
                $to = "info@trishaanfoundation.org";
                $subject = "New Query Submitted From Trishaan Foundation Donate";
                $emailMessage = "A new query has been submitted for Donate:\n\n";
                $emailMessage .= "Name: $name\n";
                $emailMessage .= "Phone: $phone\n";
                $emailMessage .= "Email: $email\n";
                $emailMessage .= "Amount: $amount\n";
                $emailMessage .= "City: $city\n";
                $emailMessage .= "Pan: $pan\n";
                $emailMessage .= "Message: $message\n";
                
                $headers = "From: $email";
                
                if (mail($to, $subject, $emailMessage, $headers)) {
                echo "<script>
                window.alert('Successfully Sent! We will contact you soon');
                window.location.href = 'index.html';
                </script>";
            } else {
               echo "Error sending email.";
                }
        } else {
        // Display validation errors in an alert
        echo "<script>
            var errorMessage = '";
        foreach ($errors as $error) {
            echo addslashes($error) . "\\n";
        }
        echo "';
            window.alert(errorMessage);
        </script>";
    }
        }
    }
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Donate Now | Trishaan Netralaya</title>
    <?php include "top-links.php";?>

</head>
<body>
    <?php include "header.php";?>
        
        
        <section class="page-title">
            <div class="bg-layer" style="background-image: url(assets/images/background/page-title.jpg);"></div>
            <div class="auto-container">
                <div class="content-box">
                    <h1>Donate Now </h1>
                    <ul class="bread-crumb clearfix">
                        <li><a href="index-2.html">Home</a></li>
                        <li>Donate Now </li>
                    </ul>
                </div>
            </div>
        </section>
         
        
         <section class="contact-style-two p_relative">
        <div class="auto-container py-5">   
            <div class="row clearfix">
                <div class="col-lg-8 col-md-12 col-sm-12">
                    <div class="form-inner">
                        <h2>Make a Donation</h2>
                        <form action="<?php $_PHP_SELF?>" method="POST"> 
                            <div class="row clearfix">
                                <div class="col-lg-6 col-md-6 col-sm-12 form-group">
                                    <input type="text" name="name" placeholder="Your Name" required="">
                                    <?php if (isset($errors) && in_array("Name field is required.", $errors)) { ?>
                                        <p class="error">Name field is required.</p>
                                    <?php } elseif (isset($errors) && in_array("Name can only contain alphabets.", $errors)) { ?>
                                        <p class="error">Name can only contain alphabets.</p>
                                    <?php } ?>
                                </div>
                               
                                <div class="col-lg-6 col-md-6 col-sm-12 form-group">
                                    <input type="email" name="email" placeholder="Your email" required="">
                                    <?php if (isset($errors) && in_array("Email field is required.", $errors)) { ?>
                                        <p class="error">Email field is required.</p>
                                    <?php } ?>
                                </div>
                                
                                <div class="col-lg-6 col-md-6 col-sm-12 form-group">
                                    <input  type="number" name="amount" placeholder="Amount" required="">
                                </div>
                                <div class="col-lg-6 col-md-6 col-sm-12 form-group">
                                    <input  type="text" name="pan"   required placeholder="Pan No*" required="">
                                </div>
                                
                                <div class="col-lg-6 col-md-6 col-sm-12 form-group">
                                    <input type="text" name="phone" placeholder="Phone" required="" minlength="10" maxlength="10" onkeypress="return isNumberKey(event)" pattern=".{10,10}" onpaste="return false;" required>
                                    <?php if (isset($errors) && in_array("Phone field is required.", $errors)) { ?>
                                        <p class="error">Phone field is required.</p>
                                    <?php } elseif (isset($errors) && in_array("Phone number should have exactly 10 digits.", $errors)) { ?>
                                        <p class="error">Phone number should have exactly 10 digits.</p>
                                    <?php } ?>
                                </div>
                                <div class="col-lg-6 col-md-6 col-sm-12 form-group">
                                    <input type="text" name="city" placeholder="City" required="">
                                </div>
                                <div class="col-lg-12 col-md-12 col-sm-12 form-group">
                                    <textarea name="message" placeholder="Message"></textarea>
                                </div>
                                <!--<form action="#" style="display:flex;">-->
                                    <input type="checkbox" id="donationForm" name="donationForm" value="donationForm">
                                    <label for="donationForm">I agree that by accepting terms and conditions, I authorize the trust management team to contact me after filling out this form.</label>
                                     
                                 <!--</form>-->
                                <div class="col-lg-12 col-md-12 col-sm-12 form-group message-btn mr-0 centred">
                                    <button class="theme-btn btn-one" type="submit" name="submit">Donate Now</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="col-lg-4 col-md-12 col-sm-12">
                    <h4>For Online Donation Visit Link</h4>
                    <a target="_blank" href="https://www.impactguru.com/fundraiser/help-trishaan-foundation-1">For Indian Donors</a><br>
                    <a target="_blank" href="https://www.impactguru.com/fundraiser/help-shreekant-ankush-damgude">For Overseas Donation</a> 
                </div>
            </div>
        </div>
    </section>
            
            
            
            
            
            <section id="dona">
                <div class="container pb-4">
                    <h4>How You Can Help</h4>
                    <p>Donate: Every donation, no matter the size, helps us provide essential eye care to those in need. For example:
</p>
<p>₹ 3000/- covers the cost of 1 cataract surgery.</p>
<p>₹ 4000/- provides cost of 1 cataract surgery along with comprehensive post-operative care for 1 patient.</p>
<p>₹ 50000/- funds the purchase of critical surgical instruments.</p>
<p>Spread the Word: Share our story with your friends, family, and social networks. The more people know about our mission, the greater our impact will be.</p>
 
<h4>Join Us in Restoring Vision</h4>
<p>Your support can bring light into the lives of many. Together, we can ensure that no one is left in the dark due to lack of access to eye care. Let’s work hand in hand to create a world where everyone can see a brighter future.</p>
<p>Donate now and help us restore vision and transform lives!

Thank you for your generosity and support.</p>
                </div>
            </section>
            
     <?php include "footer.php";?>
</body>
</html>

MMCT - 2023