Everything posted by jonatha
-
GmailPHP problem
Hello, I have a client who wanted me to manage their website, it had been created by somebody else. I have since been told by the client that he isn't receiving his emails to his Gmail account from the contact form. Has anybody got any idea why this isn't getting to his email? It works on other none gmail emails. Here is the code... ======= <?php session_start(); if($_SESSION['security_code'] != $_POST['security_code']){ //incorrect code unset($_SESSION['security_code']); $loc = "quotationsagain.php"; header("Location: ". $loc); }else{ $goemail = $_POST["goemail"]; if (!$goemail){ exit; } else { $recipientemail = "creativewebsiteproblems@gmail.com"; $returnURL = "quotations_success.php"; ############## You don't have to change anything below this line ############## $subject = "Quotations Form Received"; $name = strip_tags(trim(addslashes($_POST["name"]))); $email = strip_tags(trim(addslashes($_POST["email"]))); $company = strip_tags(trim(stripslashes($_POST["company"]))); $telephone = strip_tags(trim(addslashes($_POST["telephone"]))); $address = strip_tags(trim(addslashes($_POST["address"]))); $calendar = strip_tags(trim(addslashes($_POST["calendar"]))); $quantity = strip_tags(trim(addslashes($_POST["quantity"]))); $colours = strip_tags(trim(addslashes($_POST["colours"]))); $comments = strip_tags(trim(addslashes($_POST["comments"]))); $datetime = date("D, dS F, Y @ H:i:s T"); $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= 'From: "'.$from.'" <'.$replyemail.' >' . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $msgbody =' <style type="text/css"> <!-- .style1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; } --> </style> <table border=0 cellspacing=0 cellpadding=5 width="100%" class="style1"> <tr> <td colspan="2" >You have received contact from your website.</td> </tr> <tr> <td colspan="2" > </td> </tr> <tr> <td><b>Name:</b></td><td>'.$name.'</td> </tr> <tr> <td><b>Email:</b></td><td>'.$email.'</td> </tr> <tr> <td><b>Telephone Number:</b></td><td>'.$telephone.'</td> </tr> <tr> <td><b>Fax:</b></td><td>'.$fax.'</td> </tr> <tr> <td><b>Address:</b></td><td>'.$address.'</td> </tr> <tr> <td><b>Calendar:</b></td><td>'.$calendar.'</td> </tr> <tr> <td><b>Quantity:</b></td><td>'.$quantity.'</td> </tr> <tr> <td><b>Colours:</b></td><td>'.$colours.'</td> </tr> <tr> <td><b>Comments:</b></td><td>'.$comments.'</td> </tr> </table> '; $message = $msgbody; $message = str_replace('\n', "<br>" ,$message); $message = str_replace("#messagedate#",$datetime, $message); $success = mail($recipientemail, $subject, $message, $headers, "-f".$recipientemail); if ($success){ header("location: ".$returnURL); } } } ?> ======== Many thanks Jonathan
-
PHP MySQL Search Problem
<?php if (!isset($_SESSION)) { session_start(); } $MM_authorizedUsers = ""; $MM_donotCheckaccess = "true"; // *** Restrict Access To Page: Grant or deny access to this page function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { // For security, start by assuming the visitor is NOT authorized. $isValid = False; // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. // Therefore, we know that a user is NOT logged in if that Session variable is blank. if (!empty($UserName)) { // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. // Parse the strings into arrays. $arrUsers = Explode(",", $strUsers); $arrGroups = Explode(",", $strGroups); if (in_array($UserName, $arrUsers)) { $isValid = true; } // Or, you may restrict access to only certain users based on their username. if (in_array($UserGroup, $arrGroups)) { $isValid = true; } if (($strUsers == "") && true) { $isValid = true; } } return $isValid; } $MM_restrictGoTo = "login.php"; if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) { $MM_qsChar = "?"; $MM_referrer = $_SERVER['PHP_SELF']; if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&"; if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) $MM_referrer .= "?" . $QUERY_STRING; $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer); header("Location: ". $MM_restrictGoTo); exit; } ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $currentPage = $_SERVER["PHP_SELF"]; $maxRows_Recordset1 = 1; $pageNum_Recordset1 = 0; if (isset($_GET['pageNum_Recordset1'])) { $pageNum_Recordset1 = $_GET['pageNum_Recordset1']; } $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1; mysql_select_db($database_latest, $latest); $query_Recordset1 = "SELECT * FROM laaccess"; $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1); $Recordset1 = mysql_query($query_limit_Recordset1, $latest) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $colname_Recordset1 = "-1"; if (isset($_POST['findac'])) { $colname_Recordset1 = $_POST['findac']; } $maxRows_Recordset1 = 10; $pageNum_Recordset1 = 0; if (isset($_GET['pageNum_Recordset1'])) { $pageNum_Recordset1 = $_GET['pageNum_Recordset1']; } $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1; $colname_Recordset1 = "-1"; if (isset($_POST['findac'])) { $colname_Recordset1 = $_POST['findac']; } mysql_select_db($database_latest, $latest); if($_POST['findac']){ $query_Recordset1 = sprintf("SELECT * FROM laaccess WHERE CONCAT(Title, ' ', Description, ' ', Code) LIKE %s", GetSQLValueString("%" . $colname_Recordset1 . "%", "text")); }else{ $query_Recordset1 = sprintf("SELECT * FROM laaccess ORDER BY Title"); } $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1); $Recordset1 = mysql_query($query_limit_Recordset1, $latest) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); if (isset($_GET['totalRows_Recordset1'])) { $totalRows_Recordset1 = $_GET['totalRows_Recordset1']; } else { $all_Recordset1 = mysql_query($query_Recordset1); $totalRows_Recordset1 = mysql_num_rows($all_Recordset1); } $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1; $queryString_Recordset1 = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_Recordset1") == false && stristr($param, "totalRows_Recordset1") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams)); } } $queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1); ?>
-
PHP MySQL Search Problem
Hi J05hr Has this code been altered.. If so can you tell me what was wrong with it? Thanks
-
PHP MySQL Search Problem
Hi Rallport, How do I do that? I am a bit new to this. But thanks for taking the time Cheers lamby quote name='rallport' timestamp='1302382387' post='302587'] Put your PHP output in code tags ()<> icon on the forum text editor) and I'll take a look. H
-
PHP MySQL Search Problem
Hi all, I am new to PHP and MySQL and I have a problem with a search page showing the correct results for the search query. This is the code on my search page and it returns the right search results for page one of 10 results, then on the subsequent pages of 10 results there are random results some with and some without the search term in there? I have no idea why this is happening? Can anybody point me in the right direction? I really need help on this. Thanks === <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $currentPage = $_SERVER["PHP_SELF"]; $maxRows_Recordset1 = 15; $pageNum_Recordset1 = 0; if (isset($_GET['pageNum_Recordset1'])) { $pageNum_Recordset1 = $_GET['pageNum_Recordset1']; } $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1; mysql_select_db($database_latest, $latest); $query_Recordset1 = "SELECT * FROM laaccess ORDER BY Title"; $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1); $Recordset1 = mysql_query($query_limit_Recordset1, $latest) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); if (isset($_GET['totalRows_Recordset1'])) { $totalRows_Recordset1 = $_GET['totalRows_Recordset1']; } else { $all_Recordset1 = mysql_query($query_Recordset1); $totalRows_Recordset1 = mysql_num_rows($all_Recordset1); } $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1; $colname_Recordset1 = "-1"; if (isset($_POST['findac'])) { $colname_Recordset1 = $_POST['findac']; } $maxRows_Recordset1 = 15; $pageNum_Recordset1 = 0; if (isset($_GET['pageNum_Recordset1'])) { $pageNum_Recordset1 = $_GET['pageNum_Recordset1']; } $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1; $colname_Recordset1 = "-1"; if (isset($_POST['findac'])) { $colname_Recordset1 = $_POST['findac']; } mysql_select_db($database_latest, $latest); if($_POST['findac']){ $query_Recordset1 = sprintf("SELECT * FROM laaccess WHERE CONCAT(Title, ' ', Description, ' ', Code) LIKE %s", GetSQLValueString("%" . $colname_Recordset1 . "%", "text")); }else{ $query_Recordset1 = sprintf("SELECT * FROM laaccess ORDER BY Title"); } $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1); $Recordset1 = mysql_query($query_limit_Recordset1, $latest) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); if (isset($_GET['totalRows_Recordset1'])) { $totalRows_Recordset1 = $_GET['totalRows_Recordset1']; } else { $all_Recordset1 = mysql_query($query_Recordset1); $totalRows_Recordset1 = mysql_num_rows($all_Recordset1); } $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1; $queryString_Recordset1 = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_Recordset1") == false && stristr($param, "totalRows_Recordset1") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams)); } } $queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1); ?> ===== Many thanks Lamby
-
PHP/MySQL Search Results
Cheers thanks for that, I will try it and let you know.
-
PHP/MySQL Search Results
Hi all, I have this code on my search page and it returns results for page one of 15 results fine, then on the next page of 15 there are random results without the search term in there? I have no idea why this is happening? Can anybody point me in the right direction? === <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $currentPage = $_SERVER["PHP_SELF"]; $maxRows_Recordset1 = 15; $pageNum_Recordset1 = 0; if (isset($_GET['pageNum_Recordset1'])) { $pageNum_Recordset1 = $_GET['pageNum_Recordset1']; } $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1; mysql_select_db($database_latest, $latest); $query_Recordset1 = "SELECT * FROM laaccess ORDER BY Title"; $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1); $Recordset1 = mysql_query($query_limit_Recordset1, $latest) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); if (isset($_GET['totalRows_Recordset1'])) { $totalRows_Recordset1 = $_GET['totalRows_Recordset1']; } else { $all_Recordset1 = mysql_query($query_Recordset1); $totalRows_Recordset1 = mysql_num_rows($all_Recordset1); } $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1; $colname_Recordset1 = "-1"; if (isset($_POST['findac'])) { $colname_Recordset1 = $_POST['findac']; } $maxRows_Recordset1 = 15; $pageNum_Recordset1 = 0; if (isset($_GET['pageNum_Recordset1'])) { $pageNum_Recordset1 = $_GET['pageNum_Recordset1']; } $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1; $colname_Recordset1 = "-1"; if (isset($_POST['findac'])) { $colname_Recordset1 = $_POST['findac']; } mysql_select_db($database_latest, $latest); if($_POST['findac']){ $query_Recordset1 = sprintf("SELECT * FROM laaccess WHERE CONCAT(Title, ' ', Description, ' ', Code) LIKE %s", GetSQLValueString("%" . $colname_Recordset1 . "%", "text")); }else{ $query_Recordset1 = sprintf("SELECT * FROM laaccess ORDER BY Title"); } $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1); $Recordset1 = mysql_query($query_limit_Recordset1, $latest) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); if (isset($_GET['totalRows_Recordset1'])) { $totalRows_Recordset1 = $_GET['totalRows_Recordset1']; } else { $all_Recordset1 = mysql_query($query_Recordset1); $totalRows_Recordset1 = mysql_num_rows($all_Recordset1); } $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1; $queryString_Recordset1 = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_Recordset1") == false && stristr($param, "totalRows_Recordset1") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams)); } } $queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1); ?> ===== I am fairly inexperienced with PHP / MySQL searching. Many thanks Lamby
-
PHP Search page Problem
Cheers I will look now for MATCH
-
PHP Search page Problem
Hi I building a website and on the 'accessories' page they want a searchable list of items, I have the database working fine and the customer can add items, delete etc. But on the public side, the accessories page shows a list which is great, but if the search doesn't show any results, where in the script do I place no results found? I have tried but cannot get it to show. Also how do you search for more than one word, ie a phrase? It just returns no results if you have more than one word? I have pasted the code below.. ===== <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $currentPage = $_SERVER["PHP_SELF"]; $maxRows_Recordset1 = 15; $pageNum_Recordset1 = 0; if (isset($_GET['pageNum_Recordset1'])) { $pageNum_Recordset1 = $_GET['pageNum_Recordset1']; } $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1; mysql_select_db($database_latest, $latest); $query_Recordset1 = "SELECT * FROM laaccess"; $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1); $Recordset1 = mysql_query($query_limit_Recordset1, $latest) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); if (isset($_GET['totalRows_Recordset1'])) { $totalRows_Recordset1 = $_GET['totalRows_Recordset1']; } else { $all_Recordset1 = mysql_query($query_Recordset1); $totalRows_Recordset1 = mysql_num_rows($all_Recordset1); } $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1; $colname_Recordset1 = "-1"; if (isset($_POST['Title'])) { $colname_Recordset1 = $_POST['Title']; } $maxRows_Recordset1 = 15; $pageNum_Recordset1 = 0; if (isset($_GET['pageNum_Recordset1'])) { $pageNum_Recordset1 = $_GET['pageNum_Recordset1']; } $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1; $colname_Recordset1 = "-1"; if (isset($_POST['Title'])) { $colname_Recordset1 = $_POST['Title']; } mysql_select_db($database_latest, $latest); if($_POST['Title']){ $query_Recordset1 = sprintf("SELECT * FROM laaccess WHERE Description LIKE %s", GetSQLValueString("%" . $colname_Recordset1 . "%", "text")); }else{ $query_Recordset1 = sprintf("SELECT * FROM laaccess"); } $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1); $Recordset1 = mysql_query($query_limit_Recordset1, $latest) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); if (isset($_GET['totalRows_Recordset1'])) { $totalRows_Recordset1 = $_GET['totalRows_Recordset1']; } else { $all_Recordset1 = mysql_query($query_Recordset1); $totalRows_Recordset1 = mysql_num_rows($all_Recordset1); } $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1; $queryString_Recordset1 = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_Recordset1") == false && stristr($param, "totalRows_Recordset1") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams)); } } $queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1); ?> ===== I am fairly new to PHP and MySQL and it shows. But what it can do is brilliant. Many thanks Lamby
-
Pricing Calculator
Hi Dan, I have tried using the script you sent me, but it is asking for a calculator.php? Where do I get this from? Thanks Jon
-
Pricing Calculator
Thanks Dan,sorry for the delay in replying, had a family meal which turned into a day!! I will try this and get back to you with the results. Cheers Jon
-
Pricing Calculator
Hi I am new to this forum but I have been building a website for an Ironing company and they have a table for their prices at the moment. What I would like to know is how do I get an online pricing calculator on the site? I have a little knowledge of PHP but this seems daunting. Has anybody any ideas how I could implement one. You know adds up 5 shirts, 3 duvets etc and comes up with a total. Any info would be gratefully received. Thanks Jon