Jump to content

wkilc

Members
  • Posts

    130
  • Joined

  • Last visited

Everything posted by wkilc

  1. Thank you. I took ginerjm's advice from his signature and enabled ALL errors and found that while it worked in PHP 7.4 there were deprecated issues... I will start there. Deprecated: Non-static method Action::isAvailable() should not be called statically... Deprecated: Non-static method Action::Factory() should not be called statically... ...both appear 7 or 8 times, always point to the same line. The former: if (Action::isAvailable($var['name'])) { This is the latter one: $action = Action::Factory($action_data['name']); I actually hired a Freelancer to try to fix the scripts a few days ago but we were not able to. Although, from what I've learned from this thread, along with all those new warnings from 7.4 and I think we'd have a better chance if we have another go at it.
  2. Thank so much! That does indeed squash the error... but now with PHP 8, the form outputs simply: default_page_content default_page_footer rather than the HTML form template that loads when processing with PHP 7.4.
  3. I don't know enough to follow these suggestions. I am sorry. In the main index.php file for this script, it has: /** * Path definitions */ define('PLUGINS_DIR', './plugins/'); define('CLASSES_DIR', './classes/'); define('CONFIG_FILE', './ptd_config.php'); define('ATTACHMENT_DIR', './attachments/'); define('LANGUAGE_DIR', './lang/'); define('TMP_DIR', './tmp/'); /** * Default language definition */ define('DEFAULT_LANG', 'en'); /** * Loading common classes */ require_once(PLUGINS_DIR . 'common.php'); require_once(CLASSES_DIR . 'error.class.php'); require_once(CLASSES_DIR . 'file.class.php'); require_once(CLASSES_DIR . 'config.class.php'); require_once(CLASSES_DIR . 'lang.class.php'); require_once(CLASSES_DIR . 'request.class.php'); require_once(CLASSES_DIR . 'response.class.php'); require_once(CLASSES_DIR . 'action.class.php'); require_once(CLASSES_DIR . 'validator.class.php'); require_once(CLASSES_DIR . 'executor.class.php'); require_once(CLASSES_DIR . 'outputer.class.php'); require_once(CLASSES_DIR . 'parser.class.php'); require_once(CLASSES_DIR . 'formerror.class.php'); /** * Main classes construction */ $lang = new Lang(); $config = new Config(); $formError = new FormError(); $request = new Request(); $response = new Response(); if (isset($_POST['fpp_reset'])) { $request->data['fpp_form'] = trim($_POST['fpp_form']); $request->data['fpp_output'] = 1; } /** * Checking writable dirs */ if (!is_writable(ATTACHMENT_DIR)){ $e = new Error($lang->getValue('err_dir_not_writable', ATTACHMENT_DIR)); } if (!is_writable(TMP_DIR)){ $e = new Error($lang->getValue('err_dir_not_writable', TMP_DIR)); } Is this where the changes need to be made?
  4. Thank you. Like this? __construct() { $this->response->setContent($content)); } Here's the rest of the outputter file: function Outputer(){ global $response; $this->response = $response; $this->setType(ACTION_TYPE_OUTPUTER); return true; } /** * Does contents output * * @param string $content * @return void */ function output($content, $isError = false){ if ($isError){ $request = $this->getRequestData(); $this->response->setOuputOffset($request['fpp_output']); } $this->response->setContent($content); $this->response->printOut(); } function redirect($url){ if (function_exists('ob_start')){ ob_start(); ob_clean(); } header('Location: ' . $url); exit(); } /** * Shows default page * * @return void */ function showDefaultPage(){ global $lang; $lang = new Lang(); $content = ''; $content .= '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"'."\n"; $content .= '"http://www.w3.org/TR/html4/loose.dtd">'."\n"; $content .= '<html>'; $content .= '<head>'; $content .= '<title>' . $lang->getValue('default_page_title') . '</title>'; $content .= '</head>'; $content .= '<body bgcolor="#FFFFFF" text="#000000" link="navy" vlink="navy" alink="red" style="font-family: verdana, arial, sans-serif; font-size: 8;">'; $content .= '<center><table border="0" cellpadding="0" cellspacing="0" width="600" style="font-family: verdana, arial, sans-serif; font-size: 12;">'; $content .= '<tr><td>'; $content .= '<p align="center">' . $lang->getValue('default_page_content') . '</p>'; $content .= '<p align="center">' . $lang->getValue('default_page_footer') . '</td>'; $content .= '</tr>'; $content .= '</table>'; $content .= '</center>'; $content .= '</body>'; $content .= '</html>'; $this->output($content); } }
  5. Thank you. Forgive me for asking, but could you possibly show me where in my code to add construct() so I could try it out? Or have I not posted enough to go there?
  6. Thank you. My problem is I have don't know how to remedy that. I tried: $this->response=new response(); That removes in fact removes the error, but then the form data won't get outputted to the HTML template.
  7. Hello. Despite being at this for a while, I am in reality a grade-school teacher and a PHP novice. I have a third-party PHP form mail script that I purchased years back. The company is in the Ukraine and appears to no longer be in business. (God Bless.) Anyway, the script always appeared to work perfectly with PHP 7.4. I set my site to 8.1 to test it out... saw a few minor warnings that even I could pretty easily remedy. However, there's one that has me stumped. Fatal error: Uncaught Error: Call to a member function setContent() on null in /home/www/www/fp/classes/outputer.class.php:53 Stack trace: #0 /home/www/www/fp/classes/outputer.class.php(92): Outputer->output('<!DOCTYPE HTML ...') #1 /home/www/fp/ptd.php(93): Outputer->showDefaultPage() #2 {main} thrown in /home/www/www/fp/classes/outputer.class.php on line 53 I believe that this is the part of the form that processes form data and then outputs it to a HTML page template to show the results of the submission. Line 53: $this->response->setContent($content); Line 93: $this->output($content); The code surrounding line 53: function output($content, $isError = false){ if ($isError){ $request = $this->getRequestData(); $this->response->setOuputOffset($request['fpp_output']); } $this->response->setContent($content); $this->response->printOut(); } function redirect($url){ if (function_exists('ob_start')){ ob_start(); ob_clean(); } header('Location: ' . $url); exit(); } /** * Shows default page I've been researching this and I realize this is likely a result of a value of "null" coming up... but everything I've tried to remedy doesn't help. Again, rolling site back to 7.4 and everything works as it should, no errors or warnings. Many thanks for any guidance you can provide.
  8. Got it! I had to initialize $XXX = 1 outside the loop. Thank you.
  9. Hi, I am trying to modify some code to add a simple number increment to my results. There are tutorials galore, but the problem is the way the original code is set-up this way: { $XXX = 1; $op1 .= '<table>'; $op1 .= '<tr><td><input type="text" name="School'.$XXX.'" /></td> <td><input type="text" name="Student'.$XXX.'" /></td> <td><input type="text" name="Class'.$XXX.'" /></td> </tr>'; $XXX++; } $op1 .= '</table>'; } <?= $op1; ?> This is the result: <table> <tr><td><input type="text" name=School1"></td> <td><input type="text" name=Student1"></td> <td><input type="text" name=Class1"></td> </tr> <tr><td><input type="text" name=School1"></td> <td><input type="text" name=Student1"></td> <td><input type="text" name=Class1"></td> </tr> <tr><td><input type="text" name=School1"></td> <td><input type="text" name=Student1"></td> <td><input type="text" name=Class1"></td> </tr> </table> I tried: <td><input type="text" name="School'.$XXX++.'" /> but this returns: <table> <tr><td><input type="text" name=School1"></td> <td><input type="text" name=Student2"></td> <td><input type="text" name=Class3"></td> </tr> <tr><td><input type="text" name=School1"></td> <td><input type="text" name=Student2"></td> <td><input type="text" name=Class3"></td> </tr> <tr><td><input type="text" name=School1"></td> <td><input type="text" name=Student2"></td> <td><input type="text" name=Class3"></td> </tr> </table> I am looking for: <table> <tr><td><input type="text" name=School1"></td> <td><input type="text" name=Student1"></td> <td><input type="text" name=Class1"></td> </tr> <tr><td><input type="text" name=School2"></td> <td><input type="text" name=Student2"></td> <td><input type="text" name=Class2"></td> </tr> <tr><td><input type="text" name=School3"></td> <td><input type="text" name=Student3"></td> <td><input type="text" name=Class3"></td> </tr> </table> Apologies if I am not explaining this correctly or if I did not post enough info. Thanks in advance.
  10. I am editing a script that pulls values from a database to populate a pulldown menu: if($_GET['car'] == $row['car'] ){ echo "selected=\"selected\""; } print " value=\"$page_name&car=" . $row['car'] . "\">" . $row['car'] . "</option>\n"; } print "</select>"; This works great, except some of the "car" values in my table are empty... so I get one row in my pulldown menu that's empty: <option selected="selected" value="/list.php?car="></option> <option value="/list.php?car=Honda">Honda</option> <option value="/list.php?car=Hyundai">Hyundai</option> etc... How can I tell it to not print an "empty" result in my pull down? My apologies if I am not explaining this well. Thank you.
  11. That's very helpful, thank you. Sadly the database is something I have to download/import a couple times per week from another organization... and it is not practical to change the structure.
  12. Thank you. The database itself cannot be re-written, I don't think. Users have TWO potential addresses in their profile. A primary and a secondary. EITHER one can be a school/work address. (Some use the home address as primary, school as secondary, others vice versa.) I wanted my page to display (and filter using the form) the names of the schools, whether is it listed in the primary OR the secondary address. If the primary address is a home address, "School1" is empty. The secondary address is a home address "School2" is empty. In no case will they both be populated, I do believe. Point taken. I will hire someone to help with code. Thanks again.
  13. Hi all, I have a chunk of code that is used to create a pull-down menu that retrieves a list of school names: <? //remove any old school from query $tmp = array(); foreach ($_GET as $fld => $val) if (($fld != 'sn_School2')&&($fld != 'start')) $tmp[] = $fld . '=' . $val; $page_name = $_SERVER['SCRIPT_NAME'] . '?' . implode('&',$tmp); ?> <form name="form2" action="" class="tight"> <?php $result = @mysql_query("select distinct sn_School2 from user_info ORDER BY sn_School2 ASC"); if (mysql_num_rows($result) > 0) { print "<select name=\"link\" onchange=\"openURL2()\" style=\"width: 18.0em;\">"; ?>"; ?> <option <?php if(empty($_GET['sn_School2'])){ echo "selected=\"selected\""; } ?> value="<? echo "$page_name" ?>">DISPLAY ALL SCHOOLS</option> <?php while ($row = mysql_fetch_array($result)) { if(empty($row['sn_School2'])) continue; //added print "<option "; if($_GET['sn_School2'] == $row['sn_School2'] ){ echo "selected=\"selected\""; } print " value=\"$page_name&sn_School2=" . $row['sn_School2'] . "\">" . $row['sn_School2'] . "</option>\n"; } print "</select>"; } ?> </form> I didn't write it.... it sorta confuses me, but it works. It gives me a nice pull down populated by all the school names in School2. I want to add values from another column, called "School1". The way the database is set-up is that some folks have a value in "School1", while others have it listed in "School2". How can I make my pull-down and my query check both 'School1' and 'School2'? I am thinking I can't, because the query in the URL currently says "www.mysite.com?School2=Hogwarts". I'm a noob... but I think the trick might to create and array, no? Thanks.
  14. Hi all, I am a PHP novice. I use a script on my site to display multiple table rows with alternating colors and what I believe is called "pagation". (Takes 1,500 rows and displays only 25 or 50 or 100...) Anyway... my host is moving to PHP 5.5 at the end of the month, and when I tested it, it was all good, except for the ability to sort. I think it's this that is the problem: function pparams($sort) {global $sponsor, $school, $student, $instrument, $room, $time;} if (!$sort) $sort = "time"; This is because "register globals" is not supported with 5.5. Any suggestions on how to make it work? Thanks.
  15. If I query my database: www.mydomain.com/index.php?room=M210 I get both room M201 and M210B in my results. I know enough to know that is a result of: and (allstate_schedule.room LIKE '$room%') So I change it to this: and (allstate_schedule.room LIKE '$room') Now the query works correctly: www.mydomain.com/index.php?room=M210 But if I pull up an unfiltered list: www.mydomain.com/index.php ... I get my "No records found matching:" here is my code: $query = "SELECT allstate_schedule.sponsor,allstate_schedule.school,allstate_schedule.student,allstate_schedule.instrument,allstate_schedule.school,allstate_schedule.room,allstate_schedule.time from allstate_schedule WHERE ((allstate_schedule.sponsor LIKE '$sponsor%') and (allstate_schedule.student LIKE '%$student%') and (allstate_schedule.instrument LIKE '$instrument%') and (allstate_schedule.school LIKE '$school%') and (allstate_schedule.room LIKE '$room%') and (allstate_schedule.time LIKE '$time%')) ORDER BY allstate_schedule.$sort LIMIT $eu, $limit "; $resultt = mysql_query($query); // Determine the number of employees $number = mysql_num_rows($resultt); if ($number == 0) { print "<b>No records found matching</b>:"; $sponsor = $sponsor; $school = $school; $room = $room; $student = $student;
  16. Hi, I want to set two expiration dates in a form. Prior to the fall deadline, options A, B, C are displayed. After the fall date has passed, only A and B will be displayed. This works beautifully: <?php //SET THE TIME ZONE date_default_timezone_set('America/New_York'); //CREATE TIMESTAMP VARIABLES $current_ts = time(); $fall_deadline_ts = mktime(0,0,0,9,1,2014); $winter_deadline_ts = mktime(0,0,0,12,1,2014); //IF THE FALL DEADLINE HAS PASSED if($current_ts > $fall_deadline_ts) { echo "a, b"; } else { echo "a, b ,c"; } ?> How can I tweak this so that after the Winter deadline has ALSO passed, it will only display A, rather than A, B? Thanks!
  17. Thank you. Now I get: "Number of records deleted: 0" or "number of records deleted: 1" This is good, but I was hoping for a unique response for incorrect ID and password combinations. I'm a noob... so I'm starting simple. Once I got this working... I'm going to modify this code so that the user inputs his/her ID and password using a simple form... then grab the form value form that POST and either delete the row or have it return an error. <?php $id = "123456789"; $pass = "bach"; $query = "DELETE FROM my_form WHERE member = ('$id') && password = ('$pass')"; $result = mysql_query($query); printf ("Number of records deleted: %d\n", mysql_affected_rows()); ?>
  18. I'm usng this simple script to remove a row from a MySQL table: <?php $id = "123456789"; $pass = "bach"; $query = "DELETE FROM my_form WHERE member = ('$id') && password = ('$pass')"; $result = mysql_query($query); echo "The data has been deleted."; ?> Works as intended, if the password and ID match, then the row is deleted and it echos "The data has been deleted." I want to add an "else" statement... the the password and ID did not match, "the data has NOT been deleted". I know I can't use "else" if I don' begin with an "if"... but I'm not sure where to put it (after the query?) Thank you.
  19. Thanks again. This is what I've come up with: while ($row = mysql_fetch_object($result)) { $eMail=$row->eMail; $unsafe = array("@", ".com", ".edu", ".net"); $safer = array("&#64", "&#46;&#99;&#111;&#109;", "&#46;&#101;&#100;&#117;"); $NEWeMail = str_replace($unsafe, $safer, $eMail); echo "<td><a href='mailto:$NEWeMail'>$name</a></td>"; I'm going to display the name rather than the e-mail address, then use the unicode to relpace the "@" and the ".com", ".net", etc... in the domain name in the link source code. Then again, I may just protect the entire page as well...
  20. Thank you. I'm seeing a lot of ways to manually protect individual addresses... but I'm looking for a way to replace some characters dynamically as they're pulled from the db. I thought I was on to something here, but I'm getting a syntax error. while ($row = mysql_fetch_object($result)) { $eMail=$row->eMail; $NEWeMail = str_replace("@", "&#64", $eMail); echo "<td><a href='mailto:$NEWeMail'>$NEWeMail</a></td>";
  21. Hi all, I use a script that for a member directory that grabs, amongst other things, member e-mail addresses, and then displays them as part of the member directory. while ($row = mysql_fetch_object($result)) { $snre_eMail=$row->eMail; echo "<td><a href='mailto:$eMail'>$eMail</a></td>"; I know how to use JavaScript and/or unicode to hide e-mail for a "static" (hard-coded) address... but can anyone help me apply that to all these addresses pulled from the MySQL db? For instance, can we tell it to translate the "@" to its unicode equivalent "&#64;" before echoing the address, just for some basic protection? Thanks.
  22. I know this works: if($Authorized == "Declined") { echo "Didn't work"; } else { echo "Success"; } ?> What if I wanted it to echo "Didn't work" if $Authorized == "Declined" OR if the string is empty, i.e. $Authorized == "" Is this it? if($Authorized == "Declined") { echo "Didn't work"; } [elseif ($Authorized == "") { echo "Still didn't work"; }] } else { echo "Success"; } ?> Thanks.
  23. Hello, I'm pulling data from a table in order to pre-populate a form. I have either a "school" address or a "home "addresses" for each record in the table. I've already connected to the table and made the query... what I need to do now is simply create an "else" statement. If the value "Address_type" is "school", pre-populate the form... if it's not "school" then display an empty form: I think I've got the idea, but my syntax can't be right: <?php if ($Address_type = 'school') { ?> School address street</b>: <input type="text" name="Address_street" value="<?php echo stripslashes($row['school_address']); ?>" /> School address city</b>: <input type="text" name="Address_city" value="<?php echo stripslashes($row['school_city']); ?>" /> School address state</b>: <input type="text" name="Address_state" value="<?php echo stripslashes($row['school_state']); ?>" /> School address zipcode</b>: <input type="text" name="Address_zip" value="<?php echo stripslashes($row['school_zip']); ?>" /> <?php }else { ?> School address street</b>: <input type="text" name="Address_street" /> School address city</b>: <input type="text" name="Address_city" /> School address state</b>: <input type="text" name="Address_state" /> School address zipcode</b>: <input type="text" name="Address_zip" /> <?php } ?>
×
×
  • 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.