PHP - Swiftmailer And 1and1 Causing Issues
Please note that I have not changed any code or setting in over two months. This is new and very recent issuse.
I have SwiftMailer nad 1and1 hooked up so I can send emails when registrations are submitted. It has been working fine for months now with no problem. Today (or very recently) I am unable to send any emails from any 1and1 prediefined addresses. I get "Fatal error: Uncaught exception 'Swift_TransportException' with message 'Connection could not be established with host smtp.1and1.com [Connection timed out #110]'"
As mentioned earlier, no changes were made anywhere in two months. I have googled the issue, tried many "solutions" and nothing. I played arround with ports, addresses, passwords, tls, ssl, ...
Any idea why this might be happening? I am thinking 1and1 has done something or "upgraded" something and it killed my emailing ability. I will call them, but people here are way smarter.
Thanks
Pioneer
Similar TutorialsHi There, I have an application that uses a Flash front end. The user fills out a card. The variables of that card are stored in an SQL Database and the recipient gets an email with a unique url to retrieve the card. The problem I am faced with ... is that if the user hits their ENTER key while typing their message to create line breaks.. the line breaks are causing the SWFOBJECT Flash Embed to break. The SWFOBJECT embed code looks like this Quote var flashvars = { yname: "<?php print "$yname";?>", yemail: "<?php print "$yemail";?>", fname: "<?php print "$fname";?>", femail: "<?php print "$femail";?>", greeting: "<?php print "$greeting";?>", message: "<?php print "$message";?>", fullname:"<?php print "$fullname";?>" }; The results look like this when data has been filled out Quote <script type="text/javascript"> var params = { quality: "high", //scale: "ExactFit", wmode: "transparent", menu: "false", allowfullscreen: "true", allowscriptaccess: "always", bgcolor: "#014872" }; var flashvars = { yname: "Jonathon", yemail: "name@email.com", fname: "TEST", femail: "jname@email.com", greeting: "TESTING", message: "Test Test Test", fullname:"" }; You can see the line breaks whe Test Test Test Was typed. Any ideas how to fix this ? Ok, i am adding a few things onto a "php email form" script, everything works as it should apart from this. The php email form, catches the submitted data and emails it accordingly, then after that, i use some of the data and show it, one form value i would like to show is from a radio button. Theres two radio buttons in one group. The radio buttons group name is "postage", value1 = "first" value2 = "second". $post1 is one cost, and $post2 is another cost, both get submitted an received fine. And as it stands when i submit the form without the line below, and tell it to echo "postage", it works fine. IF though i add this line after: if ($postage = "first") {$post_cost = $post1;} elseif ($postage = "second") {$post_cost = $post2;} If simply just comes threw as "first" everytime regardless, Why?? Heres the code for this section: //Collect postage details if(isset($_REQUEST['postage'])){$postage = stripslashes($_REQUEST['postage']);} if(isset($_REQUEST['post1']) && !empty($_REQUEST['post1'])){$post1 = stripslashes($_REQUEST['post1']);} if(isset($_REQUEST['post2']) && !empty($_REQUEST['post2'])){$post2 = stripslashes($_REQUEST['post2']);} if(isset($_REQUEST['Total:']) && !empty($_REQUEST['Total:'])){$total = stripslashes($_REQUEST['Total:']);} //Get disired postage type $post_cost = 0; if ($postage = "first") {$post_cost = $post1;} elseif ($postage = "second") {$post_cost = $post2;} //Work out total to pay $totaltopay = $total+$post_cost; ?> Thanks Andy I have swift mailer setup to send two message and plain and HTML. I have followed a lot of different posts and came up with a solution that works. However when I send for example 7k emails only about 500 made it out before the 30sec timeout. So I switched my timeout to 600secs and only about 3k made it out. I now I can switch my timeout to 0 or 3600sec and it will go through but it doesnt seem like this should take so long. I use Debian 6.0, Zimbra 7, Postfix, and SwiftMailer I am using the mailer like this; / Create the Transport $transport = Swift_SmtpTransport::newInstance('localhost', xx) ->setUsername('xxx') ->setPassword('xxx') ; // Create the Mailer using your created Transport $mailer = Swift_Mailer::newInstance($transport); //Starts the loop to separate the to email addresses everything past here is built for each email $to1 = explode(", ", $to); for($i = 0; $i < count($to1); $i++){ // Create a message $message = Swift_Message::newInstance($subject) ->setFrom(array($from => 'xxx')) ->setTo(array($to1[$i])) ->setBody($plaintxt) ->addPart($htmltxt, 'text/html'); $plaintxt = substr($plaintxt, 0, -$plaindumplength); $htmltxt = substr($htmltxt, 0, -$dumplength); $emailcounter += $mailer->send($message); } Hi: I have a site hosted (shared) on 1and1.com hosting, and they seem to have a file upload limit of 2MB. Is there a way to overwrite this? I have been trying a .htaccess and php.ini file, but can't get it to work. The folder with the upload form is called "admin," in the ROOT of the site. Been trying (in both the ROOT and the "admin" folder): php.ini Code: [Select] ; Maximum size of POST data that PHP will accept. post_max_size = 8M ; Maximum allowed size for uploaded files. upload_max_filesize = 8M ini_set('memory_limit','128M'); .htaccess (in both the ROOT and the "admin" folder): Code: [Select] php_value memory_limit 24M That is all the code in each file - am I missing some code? Can this be done? Thank you. So I have an webapp which has a built in proxy checker. However because I didn't write the code I am kind of confused on whats going on. I have a small amount of knowledge on php been looking all over the net to find a solution. So this file called (proxy_check.php) keeps causing my index.php to show the 404 designed page. The file is required in the index.php file. I believe its something to do with the $reponse variable. Please help <?php # Visitor proxy check snippet $v_ip = $_SERVER['REMOTE_ADDR']; $arContext['http']['timeout'] = 10; $context = stream_context_create($arContext); $response = file_get_contents('http://www.shroomery.org/ythan/proxycheck.php?ip='.$v_ip, 0, $context); if ('Y' === $response) { echo "<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'> <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'> <head> <title> The page you were looking for doesn't exist (THIS BUG)</title> <style type='text/css'> body { background-color: #efefef; color: #333; font-family: Georgia,Palatino,'Book Antiqua',serif;padding:0;margin:0;text-align:center; } p {font-style:italic;} div.dialog { width: 490px; margin: 4em auto 0 auto; } img { border:none; } </style> </head> <body> <div class='dialog'> <a><img src='assets/img/404.png'></a> <p>It looks like that page you were looking has been mislaid, sorry.</p> </div> </body> </html>"; die(); }
I am having problems understanding how to sanitize my form data so it is safe to INSERT. If I use this code... Quote $trimmed = array_map('trim', $_POST); $body = mysqli_real_escape_string($dbc, $trimmed['body']); And I enter into my form... Quote O'Reilly's book Then I see this in phpMyAdmin... Quote O\'Reilly\'s book --------- If I use this code... Quote $trimmed = array_map('trim', $_POST); $body = $trimmed['body']; And I enter into my form... Quote O'Reilly's book Then I see this in phpMyAdmin... Quote O'Reilly's book Why the strange behavior?? Debbie The code below is working in relation to what I expect it to do however it is allow causing this error on top of the form everytime... Notice: Undefined index: submit in C:\wamp\www\protek\register.php on line 130 Notice: Undefined index: fullname in C:\wamp\www\protek\register.php on line 133 Notice: Undefined index: email in C:\wamp\www\protek\register.php on line 134 Notice: Undefined index: username in C:\wamp\www\protek\register.php on line 135 Notice: Undefined index: password in C:\wamp\www\protek\register.php on line 137 Notice: Undefined index: password2 in C:\wamp\www\protek\register.php on line 138 The full code being used is > <?php //check for submit $submit =$_POST['submit']; //gather POST variable $fullname =strip_tags($_POST['fullname']); $email =strip_tags($_POST['email']); $username =strip_tags($_POST['username']); $password =strip_tags($_POST['password']); $password2 =strip_tags($_POST['password2']); if ($submit) { //check that fields were filled in if ($fullname&&$email&&$username&&$password&&$password2) { //now we can encrypt our password to md5 $password = md5($password); $password2 = md5($password2); //were done seeting md5 //check to see if our two password fields match if ($password==$password2) { //check to see if the password is greateer than 25 but less than 6 if (strlen($password)>25||strlen($password)<6) { //if it is then echo "<font color='red'>Your password must be between 6-25 characters</font>"; } //otherwise register the user else { echo "Success"; } } //otherwise if passwords don't match else echo "<font color='red'>The passwords you entered do not match</font>"; //end of checking password } else echo "<font color='red'>Please enter all fields!</font>"; } //end check for submit ?> hello. I seemed to have got lost with my if statements here and cannot see where to use elseif . I am getting the duplicate response message ok, but if I submit with blank input, it produces NaN error, which I know is JavaScript but I think it is because of the order of the if statements. If someone could help me with this I would be very grateful. Thanks. Code: [Select] if (!empty ($_POST['item'])) { $data = split(',',$_POST['item'][0]); $duplicates = array(); foreach ($data as $val) { if ( $val != "" ) { $sql = "SELECT custref FROM boxes WHERE custref='$val' Union SELECT item FROM act WHERE item='$val'"; $qry = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($qry)) { $duplicates[] = $val; } } } if(count($duplicates)) { $response_array['status'] = 'error'; $response_array['message'] = 'No duplicate files'; } } //check the name field elseif(empty($authorised)){ //set the response $response_array['status'] = 'error'; $response_array['message'] = 'Name cannot be blank'; //check the service field } I found a script online that I am trying to get working. It was giving a 500 error from the get go and I've pinpointed it to the $data = fread() line. Does anyone know why? <?php $file = "../../media/v_360.m4v"; $filesize = filesize($file); $offset = 0; $length = $filesize; if (isset($_SERVER['HTTP_RANGE'])) { // if the HTTP_RANGE header is set we're dealing with partial content $partialContent = true; // find the requested range // this might be too simplistic, apparently the client can request // multiple ranges, which can become pretty complex, so ignore it for now preg_match('/bytes=(\d+)-(\d+)?/', $_SERVER['HTTP_RANGE'], $matches); $offset = intval($matches[1]); $length = intval($matches[2]) - $offset; } else { $partialContent = false; } $file = fopen($file, 'r'); // seek to the requested offset, this is 0 if it's not a partial content request fseek($file, $offset); $data = fread($file, $length); /* fclose($file); if ($partialContent) { // output the right headers for partial content header('HTTP/1.1 206 Partial Content'); header('Content-Range: bytes ' . $offset . '-' . ($offset + $length) . '/' . $filesize); } // output the regular HTTP headers header('Content-Type: ' . $ctype); header('Content-Length: ' . $filesize); header('Content-Disposition: attachment; filename="' . $fileName . '"'); header('Accept-Ranges: bytes'); // don't forget to send the data too print($data); */ ?> Its trying to read a 60mb file. Do you think it is timing out and that is causing the error? I have an FLV player and I am using a php file to read an FLV that is above webroot. It reads the FLV just fine, however, during its cache process or while it is still downloading, if I click on the home button (home button of the current site), the server does not respond until the FLV has been fully cached. Now this is only occuring in firefox, chrome and IE. In safari it works fine. Who know, maybe it is a header issue. Here is my script that I pass to my FLV player <?php include("connect.php"); if ($_SESSION['loggedIn'] == true) { $id = $_GET['id']; $query = mysql_query("SELECT video FROM reviews WHERE id = '$id'"); $row = mysql_fetch_array($query); $filename = "../../../armsmedia/videos/".$row['video']; header( 'Content-Description: File Transfer' ); header( 'Content-Type: application/octet-stream' ); header( 'Content-Disposition: attachment; filename='.basename( $filename ) ); header( 'Content-Transfer-Encoding: binary' ); header( 'Expires: 0' ); header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' ); header( 'Pragma: public' ); header( 'Content-Length: ' . filesize( $filename ) ); ob_clean(); flush(); readfile( $filename ); exit; } ?> Have a strange problem on a new server that we've migrated to. I use class.phpmailer extensively with no problems but since moving to the new one, i notice that emails sent to ids on the same domain as the sender just dont go thru . i cannot figure out why this could be happening. What could i do to resolve this problem please? Thanks: Swati. OLD SERVER : PHP 2.6.4 , MYSQL - 4.1.12 NEW SERVER PHP 3.2.4 , MYSQL 5.1.50 My code snippet <? if($_POST['submit']){ $dec = $_POST["dec"]; require("class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsMail(); $mail->From = "form@exam.com"; $mail->FromName = "exam"; if ($dec == "on"){ $mail->AddAddress("dec@exam.com"); // doesnt go thru $mail->AddAddress("dec@anyother.com"); // goes thru // add it } } ?> Hi, i'm new here and have a straightforward question. On a server I use I have this script and we use it to force the download of mp3 files on a single click of a link. (Avoid opening in an internet audio buffering plug in or application) Code: [Select] <?php $filename = $_GET['file']; // required for IE, otherwise Content-disposition is ignored if(ini_get('zlib.output_compression')) ini_set('zlib.output_compression', 'Off'); // addition by Jorg Weske $file_extension = strtolower(substr(strrchr($filename,"."),1)); if( $filename == "" ) { echo "<html><title>Download Script</title><body>ERROR: download file NOT SPECIFIED. USE force-download.php?file=filepath</body></html>"; exit; } elseif ( ! file_exists( $filename ) ) { echo "<html><title>Download Script</title><body>ERROR: File not found. USE force-download.php?file=filepath</body></html>"; exit; }; switch( $file_extension ) { case "pdf": $ctype="application/pdf"; break; case "exe": $ctype="application/octet-stream"; break; case "zip": $ctype="application/zip"; break; case "doc": $ctype="application/msword"; break; case "xls": $ctype="application/vnd.ms-excel"; break; case "ppt": $ctype="application/vnd.ms-powerpoint"; break; case "gif": $ctype="image/gif"; break; case "png": $ctype="image/png"; break; case "mp3": $ctype="audio/mpeg3"; break; case "jpeg": case "jpg": $ctype="image/jpg"; break; default: $ctype="application/force-download"; } header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); // required for certain browsers header("Content-Type: $ctype"); // change, added quotes to allow spaces in filenames, by Rajkumar Singh header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" ); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($filename)); readfile("$filename"); exit(); ?> I recently got an email from my service provider quoting the following Quote Hello, I apologize, but I was forced to suspend the script /home/mezerik/********/forcedownload.php as it was causing a high load on the server, and due to it affecting all of the other accounts on the system, I forced to take immediate action for the health of the server. Unfortunately I do not have any specific recommendations for this script, however, in general, adding some sort of caching mechanism, where the script does not need to generate a new page with every request, helps to lower the over load that a script will cause. Likely the original author or support group of the software that you are using will be able to help you to understand how to add something of this nature. If you reply back to this with your IP address (http://www.******.com/ip.shtml) we will be more than happy to go ahead enable HTTP access for you, so that you can safely work on the script without it causing further issues. Please let us know how you would like to proceed. I am not sure what is wrong with the script and if it is insecure to the server and should be edited or removed. Hello all
Was hoping someone could help. I have a .htaccess file that contains the following:
RewriteEngine On RewriteRule ^sites/([a-z0-9]+)/?$ sites.php?letter=$1 [NC,L,QSA] RewriteRule ^network-devices/([a-z0-9]+)/?$ network-devices.php?letter=$1 [NC,L,QSA] RewriteRule ^site/([0-9]+)/?$ site.php?site_id=$1 [NC,L] RewriteRule ^network-device/([0-9]+)/?$ network-device.php?device_id=$1 [NC,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php?%{QUERY_STRING} Hey, I'm writing an application that tracks attendance. There are multiple events ('events' table), in which members that are present will be found. (When an event file is uploaded, it has all members that attended the event, and adds the event entry in 'events', as well as adding each member to the 'attendance' table, with event_id(eid) and the 'did_attend' value as '1'. When the event is edited, it needs to find the other members that AREN'T in the events table, and add them to the 'attendance' table. When I use this code, it apparently keeps adding the same members. Will a LIMIT 1 stop this? I has about 65,000+ entries added before I stopped the execution of the script. Thanks! Code: [Select] $sql2 = mysql_query("SELECT * FROM members WHERE status=1 ORDER BY mid ASC"); while($row = mysql_fetch_assoc($sql2)){ $sql3 = mysql_query("SELECT * FROM attendance WHERE event='$eid' ORDER BY member ASC"); while($row2 = mysql_fetch_assoc($sql3)){ if($row2[mid] == $row[mid]){ // if the member is in the attendance db, skip }else{ //if member is not in attendance, write zero--- causing multiple entries (50,000+) $qry = mysql_query("INSERT INTO attendance (member,event,did_attend) VALUES ('$row[mid]','$eid','0')"); if(!$qry){ die("SQL: ".mysql_error()); }else{ $msg = "<br />Member ".$row[mid]." marked as absent."; } } } } i want to change this code : $result = mysql_query("select count(*) from 3gp where category='Bollywood'"); with this $result = mysql_query("select count(*) from 3gp where category='$category'"); but i am getting error message "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/funxy/public_html/salmobile.info/3gp-videos.php on line 151". I am calling the page using http://abc.com/3gp-videos.php?category=Bollywood Please help. Code: [Select] <?php $db="funxy_db"; $conn = mysql_connect("localhost","funxy_saba","myasco001"); @mysql_select_db($db) or die( "Unable to select database, Please contact your administrator"); class Pager { function getPagerData($numHits, $limit, $page) { $numHits = (int) $numHits; $limit = max((int) $limit, 1); $page = (int) $page; $numPages = ceil($numHits / $limit); $page = max($page, 1); $page = min($page, $numPages); $offset = ($page - 1) * $limit; $ret = new stdClass; $ret->offset = $offset; $ret->limit = $limit; $ret->numPages = $numPages; $ret->page = $page; return $ret; } } // get the pager input values $page = $_GET['page']; $limit = 3; $result = mysql_query("select count(*) from 3gp where category='Bollywood'"); $total = mysql_result($result, 0, 0); // work out the pager values $pager = Pager::getPagerData($total, $limit, $page); $offset = $pager->offset; $limit = $pager->limit; $page = $pager->page; // use pager values to fetch data $query = "select * from 3gp where category='Bollywood' order by id DESC limit $offset, $limit"; $result = mysql_query($query); // use $result here to output page content //my addition //grab all the content //Custom Table Stsrt// $cols = 4; //number of coloms $i =1; echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\" width=\"100%\" id=\"table1\" bordercolor=\"#FFFFFF\" bgcolor=\"#FFFFFF\">" ."<tr>"; while($r=mysql_fetch_array($result)) { //the format is $variable = $r["nameofmysqlcolumn"]; //modify these to match your mysql table columns $id=$r["id"]; $name=$r["name"]; $views=$r["views"]; $url=$r["url"]; $image=$r["image"]; $category=$r["category"]; //display the row $mybox = " <br> <a href='http://salmobile.info/3gp-videos-download.php?id=$id' class=\"classd\"><b><u> $name</u></b></a> <BR> <span class=\"text\"><img src=\"$image\" width=\"60\" height=\"60\"></span> <BR> <span class=\"text2\">Download This 3GP Video</span> <br>"; if (is_int($i / $cols)){ echo "<td width='336' align='center' style=\"border-style: dotted; border-width: 0\">$mybox</td></tr><tr>"; }else{ echo "<td width='336' align='center' style=\"border-style: dotted; border-width: 0\">$mybox</td>"; } if ( $i / $cols == 3) echo "<td colspan='3' align=\"center\"> </td></tr><tr>"; if ( $i / $cols == 8) echo "<td colspan='3' align=\"left\"> </td></tr><tr>"; $i++; //end if }//end while echo "</tr></table>"; //Custom Table End// //ends my addition // output paging system (could also do it before we output the page content) if ($page == 1) // this is the first page - there is no previous page echo "<font color=\"#FFB300\">Previous</font>"; else // not the first page, link to the previous page echo "<a href=\"http://salmobile.info/index-" . ($page - 1) . ".html\" id=\"navigationURL\"><font color=\"#FFB300\">Previous</font></a>"; for ($i = 1; $i <= $pager->numPages; $i++) { echo " <font color=\"#FFFFFF\">|</font> "; if ($i == $pager->page) echo "<font color=\"#FFB300\"> $i</font>"; else echo "<a href=\"http://salmobile.info/index-$i.html\" id=\"navigationURL\"> <font color=\"#FFB300\">$i</font></a>"; } if ($page == $pager->numPages) // this is the last page - there is no next page echo "Next"; else // not the last page, link to the next page echo " <a href=\"http://salmobile.info/index-" . ($page + 1) . ".html\" id=\"navigationURL\"><font color=\"#FFB300\">Next</font></a>"; ?> If I hard code the To address such as a@acme.com into my email function, no problems. But if I try using a variable I get an error. The error doesn't give me any valuable information and is generated from some old code that I never wrote. If I place the same variable such as "a@acme.com" into any other field such as content, subject I get the value for the variable so I know that it isn't null. I have tried all the methods of converting to a string and nothing changes. Any ideas? $params = array(); $sqlFilters = ""; if(isset($filtertown)) { $sqlFilters .= " AND town =:town"; $params["town"] = $filtertown; } if(isset($filterinstagram) && !empty($filterinstagram)) { $sqlFilters .= " AND instagram >=:instagram"; $params["instagram"] = $filterinstagram; } if(isset($filtertwitter) && !empty($filtertwitter)) { $sqlFilters .= " AND twitter >=:twitter"; $params["twitter"] = $filtertwitter; } if(isset($filterfacebook) && !empty($filterfacebook)) { $sqlFilters .= " AND facebook >=:facebook"; $params["facebook"] = $filterfacebook; } if(isset($filterpinterest) && !empty($filterpinterest)) { $sqlFilters .= " AND pinterest >=:pinterest"; $params["pinterest"] = $filterpinterest; } if(isset($filteryoutube) && !empty($filteryoutube)) { $sqlFilters .= " AND youtube >=:youtube"; $params["youtube"] = $filteryoutube; } if (isset($userstatus)) { if ($userstatus == "active") { $sqlFilters .=" AND profilecomplete = 'yes'";} if ($userstatus == "incomplete") { $sqlFilters .=" AND profilecomplete IS NULL";} if ($userstatus == "block") { $sqlFilters .=" AND status = 'block'";} if ($userstatus == "cancel") { $sqlFilters .=" AND status = 'cancel'";} if ($userstatus == "showall") { $sqlFilters .=" AND status IS NULL";} } if (isset($search)) { if (isset($searchfirstname)) { $sqlFilters .= " AND firstname LIKE :searchfirstname"; $params["searchfirstname"] = $searchfirstname; } if (isset($searchsurname)) { $sqlFilters .= " AND surname LIKE :searchsurname"; $params["searchsurname"] = $searchsurname; } } if (isset($sort)) { $sqlStart = "SELECT * FROM users WHERE usertype = 'influencer'"; $sqlEnd = " ORDER BY `$col` $order LIMIT $offset, $rowsPerPage;"; $sql = $sqlStart.$sqlFilters.$sqlEnd; $sqlfiltercount = $sqlStart.$sqlFilters; $result = $pdo->prepare($sql); $result->execute($params); $resultfiltercount = $pdo->prepare($sqlfiltercount); $resultfiltercount->execute($params); $num_users = $result->rowCount(); $num_usersfiltered = $resultfiltercount->rowCount(); } else { $sqlStart = "SELECT * FROM users WHERE usertype = 'influencer'"; $sqlEnd = " LIMIT $offset, $rowsPerPage;"; $sql = $sqlStart.$sqlFilters.$sqlEnd; // sqlfiltercount removes the LIMIT to show ALL users on this userstatus filter $sqlfiltercount = $sqlStart.$sqlFilters; $result = $pdo->prepare($sql); $result->execute($params); $num_users = $result->rowCount(); echo "$sqlfiltercount"; $resultfiltercount = $pdo->query($sqlfiltercount); $num_usersfiltered = $resultfiltercount->rowCount(); } Hi there. I am writing a tool that displays a list of users. The page has pagination, set at 99 per page. This script combines the various filters added by the administrator, but if they select Active, Blocked or a few others, it bypasses that and runs the bottom {} brackets of query. You have the $num_users which is the total on screen at the time, plus the secondary count of TOTAL users in the system. This count is then show by 'users' on the page.
This runs fine on my local machine running php7.2, but on the live 7.2 server, it's showing nothing. No errors. If I comment out the $resultfiltercount lines, the page loads, but of course no count. Why might it be getting upset at that, and why would it not throw errors on screen at me? Over the past few days I have been running into some issues with my server crashing due to apache max connections issues. I am running my site off of a hosted Cloud VPS with 200GB of storage, 8192MB Memory, 8TB of transfer, Apache, MySQL, PHP5, and CentOS.
I am afraid the issue doesn't necessarily lay in the configuration of Apache, but the way I have scripted the php on my site, the reason I am reaching out here. My site isn't your average website, it is more of a web-based customer management program. There are currently only 2 pages you can actually access via the url bar (signin.php and index.php). All other content is loaded via AJAX and JQuery processes (.load and $.getScript).
All AJAX requests are pointed toward a single file called functions.php where a _POST parameter contains the function name and any additional _POST data required by the function.
FOR EXAMPLE:
AJAX Call:
$.post('functions/functions.php',{func:'myFunctionName',ops:'whatever',a:'whatever',b:'whatever'},function(data){ DO WHATEVER I WANT WITH THE RETURN DATA HERE },"json");PHP (functions.php) require 'dbcon.php'; include 'main_class.php'; include 'f_customerdetail.php'; include 'f_listoptions.php'; include 'f_route.php'; include 'f_useractions.php'; if (isset($_POST['func'])){ $userfunc = $_POST['func']; $funcops = $_POST['ops']; if ($funcops != ''){ $userfunc($funcops); }else{ $userfunc(); } }
I have this function which works except it throws a Notice regarding the 3rd line of the function. The Notice reads "Only variables should be passed by reference..." What am I doing wrong in that 3rd line—$caller = next(debug_backtrace()) [‘function’]; ? //EMAIL_ADMIN //Sends email to site admin if email testing services fail. //Only occurs if both primary and secondary services have failed. //Calls no other function. //Called by test_email function. //*************************************************************** function email_admin($email){ global $full_site_url;//used in links. global $site_title;//used in confirmation messages. $caller = next(debug_backtrace())['function']; //assigns calling function name to $caller. if ($caller == 'alt_test_email'){ //used in email message to provide links for checking services. $primary_service = 'http://www.quickemailverification.com';//used in email message. $secondary_service = 'http://www.neverbounce.com';//used in email message. $to = get_bloginfo('admin_email'); $subject = 'EMAIL TESTING SERVICES HAVE FAILED!'; $message = 'Both email testing services have failed. Go to ' . $primary_service . ' and ' . $secondary_service . '.'; dw_send_email($to, $subject, $message);//call email sending function. } if ($caller == 'unsubscribe'){ $to = get_bloginfo('admin_email'); $subject = $site_title . " unsubscribe"; $message = $email . " has unsubscribed."; dw_send_email($to, $subject, $message);//call email sending function. } if ($caller == 'subscribe_form_display'){ $to = get_bloginfo('admin_email'); $subject = "New " . $site_title . " subscriber"; $message = $email . " has subscribed to " . $site_title . "."; dw_send_email($to, $subject, $message);//call email sending function. } }
Ok, I've spent a good part of the day trying to figure out what is going wrong with a client site. I introduced a link within document to send readers from the blogs home page to the comments section of individual posts. It's straight forward right? HTML1, been doing these kind of links for more than ten years. #respond at the end of the normal URL in a normal anchor tag should bring the browser to id="respond" or name="respond" within the document. Right? But, a.) it doesn't. And b.) once it makes a jump everything above that point disappears. Space fills out to the same page height as if it existed but you can't scroll up. You can see it in action at http://www.thebouncingbead.com/blog/ by clicking "Add Your Comment (0)" under the title of any post. Can anyone see what might be causing this problem or experienced something similar before? |