Jump to content
  • Who's Online   0 Members, 1 Anonymous, 5,374 Guests (See full list)

    • There are no registered users currently online

All Activity

This stream auto-updates

  1. Today
  2. The basis of this work is: my hot tub is [older] and the control board is flaky(?). The mfg says: "We do not share schematics". OK, BITE ME! I'll roll my own. To whit there are several questions which all end with "and that is the question". A bit of >my< background. USAF Electronics School 1961, self taught programming on a DEC PDP-7 (lac, dac, isz,...), HP-3000 UNIX ... now LAMP. My philosophy is: every line of code is an invite to a problem - therefore 7000 lines - 7000 problems. 70 lines - 10x less problems. I have an Raspberry Pi - unused, so ... and a 8 port USB relay (amazon LCOS 8 port usb relay $12) to drive 30A relays where needed. So first: build a web page to control everything - wiring tbd. Code running in the background/crontab: take temperature on the minute and record in DB. If below low-set engage Circulation pump, insure Flow SW engaged, engage Heater, update database for status (Maria sql). At noon/midnight engage Pump1 on high, Blower for 3 minutes as a cleaning cycle. Etc, etc, etc (says the bald man). Button.php sends 1/0 to relay X and update the DB. And with that I have my web page 90% the way I (think) want it - what's the 90-10 / 10-90 rule? Following is my code - it's the way "I" roll. Go ahead and "roll" >your< eyes ... <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Cal's Hot Tub Control</title> <style> table { border: 1px solid black; table-layout: fixed; width: 90%; } th, td { border: 1px solid black; width: 33%; .default-button { background-color: #40FF40; color: black; padding: 10px 20px; font-size: 20px; border: none; border-radius: 20px; } .clicked-button { background-color: white; /* Green */ font-size: 20px; color: red; border-radius: 20px; } </style> <script> function htbutton (a) { var myval1 = a; d1 = document.createElement("script"); d1.src = "button.php?info="+myval1; d1.type = "text/javascript"; document.body.appendChild(d1); } </script> </head> <body bgcolor=#27ftf5> <table align=center> <?php include 'dbconnect.php'; $q1 = mysqli_query ($db1, "select htt from temps order by id desc limit 1;"); $r1 = mysqli_fetch_row ($q1); $temp = $r1[0]; echo "<tr><td align=center border=1>"; echo date("Y-m-d H:i:s"); echo "</td><td align=center><H1>HOTTUB</H1> <a href=index.php>refresh</a></td><td align=center>rightboxtbd</td><tr>\n<tr>\n"; echo "<tr>\n <td align=center>Temp Set<br>102.5<img src=updwn.png width=50px></td>\n <td align=center><H2>$temp</H2></td>\n <td align=center>rightboxtbd</td>\n <tr>\n"; echo "<tr><td align=center colspan=3>"; $list = array ("pump1", "pump2", "circ", "blower", "heater", "light"); foreach ($list as $l) { $x = mysqli_query ($db1, "RESET QUERY CACHE;"); $q1 = mysqli_query ($db1, "select status from info where name = '$l';"); echo "<button class=default-button id=$l onclick=htbutton('$l')>"; echo strtoupper($l); echo"</button>\n"; echo "<script> document.getElementById('$l').addEventListener('click', function() { this.classList.toggle('clicked-button'); // Toggles the class }); </script>"; } echo "<tr><td colspan=3>\n"; echo "for now a place holder for a phplot graph of water temp for the past 24 hrs"; echo "</td><tr>\n"; ?> </table> </body> </html>
  3. you still haven't done this - so, you don't know what the non-printing value actually is. it is likely an empty string '', not a null value. the null in the "Call to a member function fetch() on null" error is because GetAllData() returns nothing (null) when $View doesn't match one of he 4 values. you haven't posted ../secure/SecurePDO.php or SideMenu.php. where is session_init() defined? it's likely setting $_SESSION['CounterValue'] to the offending value. since this code could be redirecting to index.php and back to statement.php, whet is the full code being used on index.php (which i already asked you to post)? do any of these filenames being required/included exist at different paths within your project, so that different parts of your code could be requiring/including a wrong version of a file? i ask this because in the related code you have posted for this problem, there have been different versions of session_init() and variables being used that haven't been assigned a value in any of the posted code.
  4. Here is the whole statment.php. As you can see on line 14. I have set the value to Show. It can only be changed if the if statment below changes it [Lines 15 and 16]. So this value can not be NULL EVER. I added lines 125 to 128 as a way of capturing null but this never gets trapped EVER? Line 133 failes with the returning null error. I am supplying the functions file SecureFunctionsBankPDO as well. The function GetAllData is on line 28 Statment.php <?php // Banking Version 2.0.0 01-12-2023 Desmond O'Toole. // Banking Version 2.0.0 01-12-2023 Desmond O'Toole. error_reporting(E_ALL); ini_set('display_errors', '1'); require ("secure/SecureFunctionsBankPDO.php"); require ("../secure/SecurePDO.php"); //session_unset(); $page = "Bank Login"; session_start(); Session_Init(); $View = 'Show'; if (isset($_SESSION['CounterValue'])) $View = $_SESSION['CounterValue']; if(!isset($_SESSION["Pk"])) { header('Location: index.php'); exit; } $Pk = $_SESSION["Pk"]; if(KeyCheckX($Pk)== 0) { header('Location: index.php'); exit; } //$EndTime = KeyTestX($Pk, 0); $EndTime = KeyShowX($Pk); $_SESSION["current_page"] = $page; $qBalance = GetBalance(); $Date = $qBalance['EntryDate']; $Value = $qBalance['BalanceValue']; $stamp = strtotime($Date); $StartDate = date('D d-M-Y' ,$stamp); $stamp = $stamp + (WEEKS * 6) + (DAYS * 1); $EndDataDate = date('D d-M-Y' ,$stamp); //$QueryDate = date('d-M-Y' ,$stamp); $curValue = $Value; /* $Cash = number_format(MonthlyTakings(CASH) , 2, ".", ","); $Shops = number_format(MonthlyTakings(SHOPS) , 2, ".", ","); $Online = number_format(MonthlyTakings(ONLINE) , 2, ".", ","); $Other = number_format(MonthlyTakings(OTHER) , 2, ".", ","); $Ebay = number_format(MonthlyTakings(EBAY) , 2, ".", ","); //$Totals = $Cash + $Shops + $Online + $Other; $Totals = number_format($Cash + $Shops + $Online + $Other + $Ebay , 2, ".", ","); */ ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Bank Home 2</title> <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <META http-equiv="imagetoolbar" CONTENT="no"> <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Expires" content="0"> <meta http-equiv="refresh" content="600"> <link rel="stylesheet" href="stylesheets/Library.css" type="text/css"> <link rel="stylesheet" href="stylesheets/LibraryMenu.css" type="text/css"> </head> <body> <div id="PageTitle"> <img src="images/LibraryBanner.jpg" alt=""> </div> <?php include('SideMenu.php'); ?> <div id="PageContent"> <form action="menu.php" method="post"> <span style="color:blue;"><b>Est: 18-July-2015</b></span> <h4><?= "Displayed data up to " . $EndDataDate?><?="<br>Log on ends on " . $EndTime?> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="DeleteOldData.php"><span style="color:blue">Clear old data</span></a> <br> </h4> <div style="width:820px;padding:0px;float:left;"> <div style="width:120px;height:10px;padding:10px;float:left;"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Date</b> </div> <div style="width:70px;height:10px;padding:10px;float:left;"><b>Money In</b> </div> <div style="width:70px;height:10px;padding:10px;float:left;"><b>Money Out</b> </div> <div style="width:70px;height:10px;padding:10px;float:left;"><b>Balance</b> </div> <div style="width:100px;height:10px;padding:10px;float:left;"><b>Reason</b> </div> <div style="width:230px;height:10px;padding:10px;float:left;"><b>Comment</b> </div> <div style="width:120px;height:4px;padding:8px;text-align:right;float:left;clear:both;"><a style="color:#ae22e2;" href="DataInput.php">* <?=$StartDate?></a> </div> <div style="width:70px;height:4px;padding:10px;text-align:right;float:left;"> </div> <div style="width:70px;height:4px;padding:10px;text-align:right;float:left;"> </div> <div style="width:70px;height:4px;padding:10px;text-align:right;float:left;">&pound;<?=number_format( $Value,2,'.',',')?> </div> <div style="width:100px;height:4px;padding:10px;float:left;"> </div> <div style="width:230px;height:4px;padding:10px;float:left;">Brought forward </div> <?php if($Date === null) { echo "$Date = NULL..."; exit; } if($View === null) { echo "$View = NULL..."; exit; } $stmt = GetAllData($Date,$View); while($row = $stmt->fetch()) { $stamp = strtotime($row['EntryDate']); $ViewDate = date('D d-M-Y' ,$stamp); $CurDate = date('D d-M-Y' ,time()); $input = '&pound;' . $row['Input']; if($row['Input'] == '0.00') $input = ""; $out = '&pound;' . $row['Output']; if($row['Output'] == '0.00') $out = ""; $reason = GetReasonName($row['Reason']); $colorSelect = ColourPicker($row['Reason'],$row['EntryDate']); $AddDate = $row['AddDate']; $x = strtotime($AddDate); $MyDate = date("D dS M H:i", $x); $curValue = $Value + $row['Input'] - $row['Output']; //$curValue = RestoreDecimal($curValue); $DisplayCurValue = number_format( $curValue,2,'.',','); $Value = $curValue; $Comment = $row['Comment']; $Comment = str_replace("£","&pound;", $Comment); // $Comment, "£", "&pound;" $Comment = trim($Comment); $Bold = $row['B']; if($Bold == 1) $Comment = "<b>" . $Comment . "</b>"; $ID = TransposeKey($row['Tag']); //$ID = $row['Tag']; $x = ""; if($colorSelect == "#777777") { ?> <div style="width:120px;height:4px;padding:10px;text-align:right;float:left;text-color:green;clear:both;"><dfn title="Test"></dfn><?=$ViewDate?> </div> <?php } else { ?> <div style="width:115px;height:4px;padding:10px;text-align:right;float:left;text-color:green;clear:both;"> <a href="StatementEntry.php?ID=<?=$ID?>" title="<?=$MyDate?>"> <?=$ViewDate?></a></div> <?php } ?> <div style="width:70px;height:4px;padding:10px;color:<?=$colorSelect?>;<?=$x?>text-align:right;float:left;"><?=$input?> </div> <div style="width:70px;height:4px;padding:10px;color:<?=$colorSelect?>;<?=$x?>text-align:right;float:left;"><?=$out?> </div> <div style="width:70px;height:4px;padding:10px;color:<?=$colorSelect?>;<?=$x?>text-align:right;float:left;">&pound;<?=$DisplayCurValue?> </div> <div style="width:100px;height:4px;padding:10px;color:<?=$colorSelect?>;<?=$x?>float:left;"><?=$reason?> </div> <div style="width:250px;height:4px;padding:10px;color:<?=$colorSelect?>;<?=$x?>float:left;"><?=$Comment?> </div> <?php } ?> <div style="width:70px;height:1px;padding:10px;float:left;clear:both">&nbsp;</div> </div> <div style="width:670px;height:50px;padding:0px;float:left;"> <input class="MyButton"type="submit" name="direction" value="Main Menu"> <br> </div> </form> </div> </body> </html> SecureFunctionsBankPDO <?php //include_once ("../secure/SecurePDO.php"); error_reporting(E_ALL); ini_set('display_errors', '1'); define ('OTHER', 1); define ('SHOPS', 10); define ('ONLINE', 11); define ('CASH', 12); define ('EBAY', 15); define ('ARGOS', 16); // System time values define ('MINUTES',60); define ('HOURS',(MINUTES * 60)); define ('DAYS',(HOURS * 24) ); define ('WEEKS',(DAYS * 7)); global $View; function GetBalance() { $pdo = connectDB(); $stmt = $pdo->query("SELECT * FROM Bank_config"); $row = $stmt->fetch(); return $row; } function GetAllData($StartDate, $View) { StoreData($StartDate ."-" . $View); // *** Store data to trap this error *** $pdo = connectDB(); if($View == 'Show' or $View == 'Show+' ) //Desmond. or Desmond.. { $sqlAllData = "SELECT * FROM Bank_Data WHERE EntryDate > ? AND EntryDate <= DATE_ADD(?, INTERVAL 6 WEEK) ORDER BY EntryDate ASC, Output"; $stmt = $pdo->prepare($sqlAllData); $stmt->execute( [ $StartDate, $StartDate] ); return $stmt; } if($View == 'Total' or $View == 'Database' ) { $sqlAllData = "SELECT * FROM Bank_Data ORDER BY EntryDate ASC, Output"; $stmt = $pdo->prepare($sqlAllData); $stmt->execute(); return $stmt; } } function MonthlyTakings($Cat) // E2011 { $pdo = connectDB(); //$sqlWithdraw = "SELECT Sum(Output) FROM Bank_Data WHERE EntryDate >= '2015-07-07' AND EntryDate <= '2015-08-07' AND (Reason = 1 OR Reason = 10) ORDER BY EntryDate"; $sqlWithdraw = "SELECT Sum(Output) FROM Bank_Data WHERE EntryDate > DATE_ADD( CURDATE() ,INTERVAL -30 DAY) AND EntryDate <= DATE_ADD( CURDATE() ,INTERVAL 0 DAY) AND (Reason = $Cat) ORDER BY EntryDate"; $stmt = $pdo->query($sqlWithdraw); //echo $sqlWithdraw; //exit; $row = $stmt->fetch(); if($row["Output"] != "") $ret = $row[0]; else $ret = "0.00"; return $ret; } function GetReasonName($r) // E2006 { $pdo = connectDB(); $sqlReason = "SELECT Reason FROM Bank_Reason WHERE ReasonID = " . $r; $stmt = $pdo->query($sqlReason); $row = $stmt->fetch(); return $row["Reason"]; } function ColourPicker($ref,$date) // E2007 { $CurDate = time(); $EntryDate = strtotime($date); $Diff = $EntryDate - $CurDate + (DAYS * 3); // Entries allowed to be edited. Less than 0 = Disabled. if($_SESSION['CounterValue'] == "Show") //Desmond. $Diff = $EntryDate - $CurDate + (DAYS * 14); if($_SESSION['CounterValue'] == "Total") //Desmond... $Diff = $EntryDate - $CurDate + (DAYS * 7); if($_SESSION['CounterValue'] == "Database") //Desmond+ $Diff = 1; if ($Diff <0) $Diff = -1; else $Diff = 1; $val = "#000000"; if($ref == 1) $val = "#0000ff"; // Other Blue if($ref == 4) $val = "#ff00ff"; // CT Pink if($ref == 5) $val = "#c51010"; // Energy Burgandy if($ref == 6) $val = "#27b30b"; // TT_M Dark green if($ref == 7) $val = "#06b8b6"; // TT_BB Cyan if($ref == 8) $val = "#00aa00"; // MNOPF Green if($ref == 9) $val = "#aa7700"; // Water Brown if($ref == 10) $val = "#ff0000"; // Shop Red if($ref == 11) $val = "#7777ff"; // Online light Blue if($ref == 15) $val = "#7a061c"; // Ebay Royal green if($ref == 18) $val = "#aa00aa"; // HSBC if($ref == 19) $val = "#aa7700"; // Amazon Orders Brown if($ref == 20) $val = "#301de8"; // State Pension if ($Diff == -1) $val = "#777777"; return $val; } function DeleteOldData() { $pdo = connectDB(); $Date = time(); $Month = date('m' ,$Date); $Year = date('Y' ,$Date); $Month -= 1; if ($Month == 0) { $Month = 12; $Year -= 1; } $Date = $Year . "-" . $Month . "-01"; $sqlOldData = "DELETE from `Bank_Data` Where EntryDate < ? "; // $sqlOldData = "DELETE FROM Bank_Data WHERE EntryDate < CURDATE() - INTERVAL 1 MONTH"; // date('Y-m-d', strtotime('first day of last month')) $stmt = $pdo->prepare($sqlOldData); $return = $stmt->execute([$Date]); } function greeting() // E102 { $pdo = connectDB(); $sql = "SELECT UserF, UserS FROM LIBusersX WHERE User = '" . $_SESSION['Uk'] . "'"; $stmt = $pdo->query($sql); $rs = $stmt->fetch(); echo $rs['UserF'] . " " . $rs['UserS']; } function GetReason() // E2001 { $pdo = connectDB(); $sqlList = "SELECT * FROM Bank_Reason Order by Reason ASC"; $stmt = $pdo->query($sqlList); //$qList = mysql_query($sqlList) or die ("E2001-01A"); return $stmt; } function AddRecord($EntryDate,$input,$out,$Reason,$Comment) // E2002 { $pdo = connectDB(); $AddDateStamp = time(); $AddDate = date("Y-m-d H:i", $AddDateStamp); $Transaction = dechex(strtotime($EntryDate)); $Insertion = dechex(time()); $package = md5($Transaction . $Insertion); $Hilight = 0; $sqlGetCount = "Select * FROM Bank_Data"; $stmt = $pdo->prepare($sqlGetCount); $stmt->execute(); $Count = $stmt->rowCount(); $Count = dechex($Count += 256); $Tag = substr(($Count . $Transaction . $Insertion . $package),0,32); $sqlList = " INSERT INTO Bank_Data SET EntryDate = :Entry, Input = :In, Output = :Out, Reason = :Reason, Comment = :Comment, AddDate = :AddDate, Tag = :Tag, B = :B "; $stmt = $pdo->prepare($sqlList); $stmt->execute([ ':Entry' => $EntryDate, ':In' => $input, ':Out' => $out, ':Reason' => $Reason, ':Comment' => $Comment, ':AddDate' => $AddDate, ':Tag' => $Tag, ':B' => $Hilight ]); return; } function UpdateBalance($BF,$EntryDate) { $pdo = connectDB(); //echo $BF . " - " . $EntryDate; //exit; $sqlBalanceUpdate = "UPDATE Bank_config SET EntryDate = ?, BalanceValue = ?"; $stmt = $pdo->prepare($sqlBalanceUpdate); $stmt->execute([$EntryDate, $BF]); return; } function EntryDetails($Tag) // E2008 { $pdo = connectDB(); $sqlDataEntry = "SELECT * FROM Bank_Data WHERE Tag = ?"; $stmt = $pdo->prepare($sqlDataEntry); $stmt->execute([$Tag]); return $stmt; } function UpdateRecord($EntryDate,$input,$out,$Reason,$Comment,$Bold) // E2009 { $pdo = connectDB(); $Comment = addslashes($Comment); $Tag = $_SESSION['Tag']; $sqlList = "UPDATE Bank_Data SET EntryDate = :Entry, Input = :In, Output = :Out, Reason = :Reason, Comment = :Comment, B = :Bold WHERE Tag = :Tag "; $stmt = $pdo->prepare($sqlList); $stmt->execute([ ':Entry' => $EntryDate, ':In' => $input, ':Out' => $out, ':Reason' => $Reason, ':Comment' => $Comment, ':Bold' => $Bold, ':Tag' => $Tag ]); return; } function DeleteRec($Tag) // E2010 { $pdo = connectDB(); $sqlDeleteRec = "DELETE FROM Bank_Data WHERE Tag = '" . $Tag . "'"; $stmt = $pdo->prepare($sqlDeleteRec); $stmt->execute(); //$stmt->execute([$Tag]); } ?> One point here is that in the function GetAllData, I have added a trap that logs the values passed to this function in a database table Line 36 shows that a variable is missing. I should have the date follows by '-' and the variable $View so I should see '2025-07-31-Show' but on line 36 I get '2025-07-31-'. The variable $View is clearly missing. (35, '2025-08-01', '1754065485', '86.1.133.80', '2025-07-31-Show', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36', 'N'), (36, '2025-08-01', '1754079812', '86.1.133.80', '2025-07-31-', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36', 'N'), (37, '2025-08-01', '1754079819', '86.1.133.80', '2025-07-31-Show', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36', 'N'), These are all the files needed here..
  5. Last week
  6. Based on my understanding of the datasheet I saw, I don't think your current code is correct, but it might still work if the boards firmware is ignoring unnecessary data. The 0x you have at the front of your strings should not be there as far as my understanding goes, you should just be sending raw byte values for the on/off/query commands. Did you look at the code in the previous thread I posted that was generated by the AI? It appears to be correct based on my understanding of the datasheet I read. You could use that as a starting point, then modify it to query the board also (AI could probably do it for you if you). You'd create a new function that sends the "\xFF" byte, then read 8 bytes and check if they are equal to "\x00" or "\x01" to determine the relays status. Also, as mentioned, you need to use r+ mode when opening the device to be able to read from it, w mode is a write-only mode, so you'd be unable to read the results using that mode.
  7. I say again: did you try to fopen with "r+"? If you fopen with "w" that is write only mode, and you can't read from it.
  8. $oo = 0 for turn off / 1 for turn on $relay = 1 [...8] $on = array ("", "\xa0\x01\x01\xa2", "\xa0\x02\x01\xa3",... the second octet is the relay number, third is on/off, 4th cksum $off = array ("", "\xa0\x01\x00\xa1", "\xa0\x02\x00\xa2",... $fd = fopen ("/dev/ttyUSB0", "w"); switch ($oo) { case 0: fprintf ($fd, "0x%s", $off[$relay]); break; case 1: fprintf ($fd, "0x%s", $on[$relay]); break; } The above code works fine. Comm with mfg says 341 chip doesn't xmit only rec. ?? lost in translation. Web pages seem to say "0xFF" will return 01001000 - ???? Thanks for any help
  9. Ok.. I am a total plonker! I looked a bit harder and the declarations are in fact made conditionally. I've moved them outside of the if() block. That'll solve the issue. My fault, my bad, apologies for wasting peoples time.
  10. this isn't a php version problem. the problem may have always existed, but you just likely have error_reporting/display_errors set to values now that's reporting and displaying this error. note: a nonexistent variable is loosely a false value, so any == or != comparison or if($var) of if(!$var) will logically work. your code could be unsetting it, or you have a character set problem, where either the definition or usage isn't exactly what it appears to be. i would delete and retype one or both lines or copy just those lines into their own file file and run them. edit: here's another possibility - the php code where the definition is at, isn't actually php code, due to the use of a short open tag. if you cannot determine the cause of the problem, you will need to post enough of the code that reproduces the problem.
  11. Fair comments but no, it’s an unconditional declaration and in the same scope. #baffled
  12. A couple of possibilities spring to mind. Are the definition and the usage of the variable inside the same scope; for example - is it used inside a function but defined outside that function? Is the definition inside a conditional block of code (eg if() )so that it has not been executed because the condition was false?
  13. Hi folks, first time here although I've been coding in PHP for more years than I can remember. I'm in the process of moving some legacy code from v7.4 upto 8.2, which has the following declaration: $pri_sec_replaced = FALSE; However, when executed I receive the following warning: PHP Warning: Undefined variable $pri_sec_replaced in ... Am I missing something fundamental here? As far as I'm concerned the boolean has been declared and set. Thanks in advance.
  14. What's the underlying OS, and what MUA (SMTP program) is running? /var/log/maillog /etc/maillog - Sendmail, etc. /var/log/exim4/mainlog, /var/log/exim4/paniclog - Exim No idea if you're using QMail; but logfiles are usually very insightful in these cases.
  15. Sounds reasonable.
  16. It's either an issue with the existing code, or an issue with your server environment. Because the script is generating a 500 error, this is something that needs to be debugged. Optimistically, this probably a sub 4 hour job, but I have no idea what that means for freelancer or other sites of that type. There's also the issue of preparation of an environment for testing the code, and version control. Assuming none of those things are in place, is the developer going to YOLO on your production server? In order to even figure it out, you probably want a developer with strong sysadmin skills who can diagnose what is going on with your hosting environment. So I'd build your estimate with a range from 4-8 hours.
  17. We would need to see some code, as well as a link to the documentation. One obvious thing to try would be to open the connection using "r+" instead of "w+".
  18. I'm working on a new project to control my hottub. I'm designing using a RasPi 3+ and an 8 chan relay board. I have a php function that does "$fd = fopen (/dev/ttyUSB0, w+) and fprint (fd, "0x%s", an octal string); and relay 1 turns on, turns off - as does 2 thru 8. on off on off on... life is good. My problem: Mfg info says 0xFF will return the status of all 8 relays as in "00100110". I have tried all sorts of combinations of fprint 0xFF which seems to go OK. Then fgets, fscanf, fread and the code just hangs. Has anyone gotten this to work? Can someone offer some help? Thanks in advance. (I'll owe u a beer)
  19. Also, what would be an estimated budget for completing this project? Freelancer is recommending the following options: Micro ($30 - $250) and Entry ($250 - $750).
  20. Earlier
  21. Thank you for the detailed information regarding this issue. So, is this simply a matter of hiring a programmer and having them update the code on the form to PHP v8.3 and imagemagick, or is there something further that needs to be done? Are there any recommendations for where to find a programmer? I've had success with Freelancer.com in the past, but that was awhile ago and was only for smaller fixes. Any further assistance or recommendations would be greatly appreciated.
  22. Beyond mac's insights and salient comments, the code snippet you provided tells us nothing, as it is not the code you are using. The only way to gain insight into this is having detailed logging to review when the mailer freezes. I'd also suggest scanning the release notes in regards to the phpMailer releases, to check if there are any Breaking changes you might have missed, or things that are now handled differently between the two versions. There are 2 likely possibilities based on your comments: There are some emails that are causing issues when delivered. The way the code is written (and the environment involved) uses up available resources (network connections, database handles, or other available memory). Many companies use phpMailer so I am doubtful that there is an issue with it that would be trivially obvious, but regardless of that, you need detailed debugging which will be best facilitated by the injection of an object that implements PSR3 as described in the phpMailer source code here. If you don't already have that, here's a bit more on setting that up: After the instantiation of the PHPMailer object, that would involve a call like this: $mail->Debugoutput = new myPsr3Logger; A lot of projects use the well regarded monolog library which allows for logging to be integrated into many different logging systems, but in your case, just insuring it is writing to a log file on your system would be sufficient. As for some trivia, the author of monolog is the same guy who created PHP's dependency management tool Composer. The documentation states that the only log level that will be used is the 'Debug' level.
  23. It is the scripts in the subdirectory named boatlettering. There are 2 I see being called: The image src runs boatNamePreviewImage-new.php load_image2.php gets called when changes to the parameters are made. Obviously things on the server changed and this is probably because your code uses an ancient and long end of life version: php5.6. On top of that, it relies on the imagemagick library, so any issues with the version of imagemagik that supported that old version of php will also cause it to no longer function. I don't see this as being a quick fix, and there is very little people here could do for you, even with the source code, as your existing code is antiquated, and needs to be updated to run under supported versions of php and the imagemagick library, as well as running on a supported operating system, which it most likely did not previously, or now that it has been updated, will no longer support the old code.
  24. What you will see if you open that PHP file in a text editor such as Notepad.
  25. What is the "source code"?
  26. We can't help unless you share the source code of the script. All I could say at this point is the script outputs a 0 byte image.
  27. I have a boat name designer that uses ImageMagick to generate the image. It has been working fine for years and then suddenly stopped working this morning. When I clicked on the link, instead of the designer I got a "500 server error". I contacted the Host provider and they were able to get the designer back online but the image preview did not work. Here is our communication from oldest to newest: ================================================= The website has a form that should generate an image, but it fails to do so, everything else works except for that particular component. The customer wanted to revert to a backup, but it did not work. Opened the ticket to take a deeper look. ================================================= After investigating the issue, we were not able to find the root cause of the Image preview issue. At first, there was an issue with the suPHP module as it was not installed on the shared host. I had to edit a line of code in the `.htaccess` file so the 500 error you called for went away. Adding a `#` to every line of the block so it was disabled: ``` # #suPHP_ConfigPath /home/boatlett/public_html/boatlettering/ # # #order allow,deny #deny from all # ``` Before that, I also installed the module to prevent any code modifications. This created issues on the server overall, so I had to revert to the previous setting. The logs are not giving us any explicit cause of the issue. So the best option will be to contact a developer so they have a better solution to the issue with the form, as it looks like it should run with PHP 5.6, according to this line: ``` AddType application/x-httpd-ea-php56 .php .php5 .phtml ``` ================================================= Unfortunately there are no errors being displayed, so we would have nothing to work off of in reviewing the 'BoatLetteringPreviewForm.php' script. No errors are shown when checking the F12 developer console, and no errors are being logged in the site's home directory. In such a case, you would need to contact the script's developer to determine why the script is not functioning properly. If the script requires some specific PHP version or extension, we could set the site to use it, though we would not be able to determine the script's requirements simply by looking at it. ================================================= At this point I suggested they reinstall the ImageMagick module as I recalled this issue happened a few times in the past and was fixed rather quickly by doing that. Here is their reply: ================================================= I checked the module and tried to reinstall, but I do not think it will take any effect. I did found old similar tickets for the same problem and noticed we also suggested a developer to look into the same issue further. (But reinstalling fixed the issue so no need to contact a developer) You can try to change the PHP version and see how it goes, but a developer would be indeed more suited to check the issues here. ================================================= It seems to me they don't want to reinstall ImageMagick because they don't think it will do any good. Should I push them on the matter? If nothing more than to eliminate it as a cause? I was hoping someone could take a look at the page: https://www.boatlettering.net/boatlettering/BoatLetteringPreviewForm.php and give me an idea of what's going on and why the image generation portion would suddenly stop working without making any changes to it? Sincerely,
  28. That was the question originally posed as I interpreted it. This is why the OP posted interest in the ESP32, which is a line of 32 bit Microcontrollers. They are typically used for IOT projects, and I don't think are a good match for this. A Raspberry pi, Orange Pi, or even a GMTek Mini PC are all a lot more viable given the OP's professed direction in this project, involving an OS capable of running an HTTP server and app server.
  1. Load more activity
×
×
  • 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.