Jump to content

dpuk44

Members
  • Posts

    14
  • Joined

  • Last visited

Everything posted by dpuk44

  1. Thank you Requinix. Your help and advice is much appreciated mate!
  2. Hi, can someone let me know if this script looks secure. I have tried to take as many security measures as possible (within my coding ability): <?php // define variables and set to empty values $nameErr = $telephoneErr = $emailErr = $detailsErr = $msgStatus = ""; $name = $telephone = $email = $details = ""; // if the button has been pressed if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["name"])) { $nameErr = "Name is required"; } else { $name = test_input($_POST["name"]); // check if name only contains letters and whitespace if (!preg_match("/^[a-zA-Z ]*$/",$name)) { $nameErr = "Only letters and white space allowed"; } } if (empty($_POST["telephone"])) { $telephoneErr = "Telephone is required"; } else { $telephone = test_input($_POST["telephone"]); } if (empty($_POST["email"])) { $emailErr = "Email is required"; } else { $email = test_input($_POST["email"]); // check if e-mail address is well-formed if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $emailErr = "Invalid email format"; } } if (empty($_POST["details"])) { $detailsErr = "Details is required"; } else { $details = test_input($_POST["details"]); } //there are no errors so we are ok to print the submitted post $to = "mymainemail.com"; $subject = "You have a new message from your website"; $message = "$name <br> $telephone <br> $email <br> $details"; // Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; // More headers $headers .= 'From: <[email protected]>' . "\r\n"; if (!empty($nameErr) && !empty($telephoneErr) && !empty($emailErr) && !empty($detailsErr)) { $msgStatus = "Failed to send"; } else { mail($to,$subject,$message,$headers); $msgStatus = "<span style='color: green;'>Successful</span>"; } } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?> <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>"> <span class="title">24 hour free callback request</span> <div class="form-group"> <label for="name">Name *</label> <input type="text" class="form-control" name="name"> <span class="error"><?php echo $nameErr; ?></span> </div> <div class="form-group"> <label for="telephone">Telephone</label> <input type="text" class="form-control" name="telephone"> <span class="error"><?php echo $telephoneErr; ?></span> </div> <div class="form-group"> <label for="email">Email *</label> <input type="email" class="form-control" name="email"> <span class="error"><?php echo $emailErr; ?></span> </div> <div class="form-group"> <label>Looking For:</label> <div class="checkbox"> <label><input type="checkbox" value="Insect Control" name="service">Insect Control</label> </div> <div class="checkbox"> <label><input type="checkbox" value="Rodents & Vermin" name="">Rodents & Vermin</label> </div> <div class="checkbox disabled"> <label><input type="checkbox" value="General Enquiry" name="">General Enquiry</label> </div> </div> <div class="form-group"> <label for="details">Further Details: *</label> <textarea class="form-control" rows="5" name="details"></textarea> <span class="error"><?php echo $detailsErr; ?></span> </div> <div class="form-group"> <button type="submit" class="btn btn-cta">Contact Us</button><br> <span class="error"><?php echo $msgStatus; ?></span> </div> </form>
  3. I have my menu in an include file called menu.php and I want to assign a class called 'active' to the <li> to the page that I am on. How can I do this in PHP? <!-- navigation --> <nav class="navbar navbar-default" role="navigation"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div class="collapse navbar-collapse" id="collapse"> <ul class="nav navbar-nav navbar-right"> <li><a href="index.php">Home</a></li> <li><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Insect Control <span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="insect-control.php">Insect Control</a></li> <li><a href="ant-cockroach-control.php">Ant & Cockroach Control</a></li> <li><a href="bed-bug-treatment.php">Bed Bug Treatments</a></li> <li><a href="fly-control.php">Fly Control</a></li> <li><a href="wasp-hornets-bee-control.php">Wasp, Hornet & Bee Control</a></li> </ul> </li> <li><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Rodent & Vermin <span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="rodent-vermin.php">Rodent & Vermin</a></li> <li><a href="rats-mice-infestation.php">Rats & Mice Infestation</a></li> <li><a href="squirrel-control.php">Squirrel Control</a></li> </ul> <li><a href="#">Contact</a></li> </ul> </div> </nav> <!-- end navigation -->
  4. Hi, I have checked the source code and I can see the below. The URL seems empty as does the banner-box div which should pull in the data from the metabox. <div class="jumbotron" style="background-image: url('');"> <div class="banner-box"><h1></h1></div> </div>
  5. I cant work this one out for the life of me. The following code works great on my page.php, but cant get the same result on home.php <!-- Main component for a primary marketing message or call to action --> <?php $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?> <div class="jumbotron" style="background-image: url('<?php echo $feat_image; ?>');"> <div class="banner-box"><h1><?php $meta_value = get_post_meta( get_the_ID(), 'meta-text', true ); echo $meta_value; ?></h1></div> </div> Anyone?
  6. Hi I have appears to be an issue with the plugin
  7. Hi, Does anyone know how I can fix this? Fatal error: Call to undefined function pmpro_https_filter() in /home/wholondo/public_html/wp-content/plugins/pmpro-register-helper-master/pmpro-register-helper.php on line 177 www.wholondon.co.uk Happened after updating my pmpro plugin
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.