Jump to content

njdubois

Members
  • Posts

    200
  • Joined

  • Last visited

Everything posted by njdubois

  1. Ok, I apologize a million times. I'd delete this post completely if I could figure out how. I am normally a laravel developer and most of our projects are laravel, except this one which is cakephp. Regardless, I realize now that when I need to look into is event listeners. I should be able to find more targeted documentation on this and maybe solve my own problem. Thanks anyways!
  2. Oh my gosh!! I'm so sorry. This is a cakePhp project. Not a laravel project. Wishful thinking...
  3. I think i may have accidentally stumbled on a clue. https://laracasts.com/discuss/channels/eloquent/listen-to-any-saveupdatecreate-event-for-any-model
  4. Hi! I'd like to create a function in an eloquent model that gets called whenever create() or save() is called on that model. This function updates an "updated_at" time stamp in a parent table. I don't even know what to search for in google that will lead me to a tutorial, or documentation explaining this. For example: I have 2 tables, Conferences (has "updated_at" timestamp field) and Maps (When ever a new map is saved, or existing updated I want to update the timestamp field "updated_at" in the Conferences table). I know I could create a class with a function that does this and do a find for ->save() and after call my function. But why do that? Shouldn't I be able to put a method in the Maps Model that, when CRUD happens, will automatically fire? I guess it would look something like this: private function onCrud() { $confObj = Conference::where("id", "=", $session(['currentConfId']))->first(); $confObj->updated_at = date("whatever format..."); $confObj->save(); } How do I tell laravel/eloquent to fire this method when ever a save is called on the model? Any direction with this is greatly appreciated! Thanks, Nick
  5. Maybe a year ago php freaks shut down? I cried! phpFreaks was my go to when I was learning php! You guys and gals had been with me from the start! phpFreaks is back and today will be a good day!
  6. Hello fellow PHP Freaks! I need some guidance on an issue I'm dealing with. I have a Non-Profit Association client, and we have been trying to get setup with a system to manage all the doings for the organization. The issue really comes down to the end cost of all the services in both time, cost and a combination of the 2. We have a list of the things we would like to do, adding and modifying content from a back end, displaying the content on the front end, and a feature rich process to get data out of the system. I really like Drupal+civicrm but it would take me a long long time to figure it out all and get it up and running. I could also do a custom setup, but that would take just as long and I feel silly re-inventing the wheel. There are a lot of services that can setup and provide the type of services that we need, but they see Non-Profit and they assume that there is a bank account with a balance containing a lot of zeros. We are not hot on hiring a free lance type person to handle this as we need results. So... what do I do? I wish there was a service you could get in contact with that would recommend something, but everyone we talk to is tied to a service and of course they want you to use theirs. Does anyone have experience in setting up this kind of system for a non profit client of your own? What worked, what didn't? Who did you absolutely not like? What did you learn in the process? How did you find the choice you went with? Thanks in advance!
  7. Just wanted to fill you in. We ended up using cURL to solve the issue. Thank you all for your time!
  8. I'm sure that we could re-write the code to use cURL. The code is almost word for word copied from what bluepay is providing, because of this the issue is more "why isn't bluepays code working." Once we have exhusted all other options I think we will have no choice but to attempt another path! Thanks for the reply! DOH, we do have errors being suppressed. At some point today I will enable them and see if we get any more information about this error. Thanks!! Will have to wait for the server guy to get in on this one. Hope to have an answer for you at some point today! Thanks! Thanks all for the quick responses! We are in the middle of a launch and time is insanely tight. I will try to attempt your suggestions at some point today! Thanks again!
  9. Sorry, I should have included that little tidbit of information! I have tried that. The error I get is still "false." There wasn't any error output. Using error_get_last() the error output was: fopen(https://secure.bluepay.com/interfaces/bpdailyreport2): failed to open stream: operation failed Additional information: We have the same code on another server and it runs ok. This is definitely a server issue. I have been looking for php.ini requirements for fopen. For both servers, allow_url_fopen is set to local: on master: on And I believe that allow_url_include is also important for fopen, and in both cases again both servers are set to local:off, master: off. Thoughts? Thanks for the assistance!
  10. Just recently updated our servers version of php. From 5.3 (or 5.2.3) to 5.6. The code found at this link (I'll include the code below so you don't have to download the file): https://www.bluepay.com/sites/default/files/documentation/BluePay_bpdailyreport2-PHP.zip Use to work, but now we get the error outputted at line 36 : Problem with API Server. Contact systems administrator We are currently waiting to hear from a bluepay developer but it has been hours. As far as I can tell by spending the morning on google is that there is some server setting, maybe in the php.ini file that we do not have set right. We were not responsible for setting up the original code, and that person is not available. Any thoughts? Your time, help and assistance is so much appreciated! Nick <?php /////////////////////////////////////////////////////////////////////////////////////// // Bluepay Daily Report 2 - Return File PHP Sample Code /////////////////////////////////////////////////////////////////////////////////////// $BP_AccountID = "BLUEPAY_ACCOUNT_ID"; $BP_SecretKey = "BLUEPAY_SECRET_KEY"; $BP_MODE = "TEST"; //TEST or LIVE // Start Date/End Date $report_start_date = (isset($argv[1])) ? $argv[1] : ""; $report_end_date = (isset($argv[2])) ? $argv[2] : ""; if ($report_start_date == "") { $report_start_date = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d")-1, date("Y"))); } if ($report_end_date == "") { $report_end_date = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d"), date("Y"))); } // Create post to daily report try { $dailyreport_url = 'https://secure.bluepay.com/interfaces/bpdailyreport2'; $tamper_proof_seal = md5("$BP_SecretKey$BP_AccountID$report_start_date$report_end_date"); $dailyreport_post_data = array('ACCOUNT_ID'=>$BP_AccountID, 'MODE'=>$BP_MODE, 'REPORT_START_DATE'=>$report_start_date, 'REPORT_END_DATE'=>$report_end_date, 'TAMPER_PROOF_SEAL'=>$tamper_proof_seal); $dailyreport_url_params = http_build_query($dailyreport_post_data); // $opts = array('http'=>array('method'=>"POST", 'content'=>$dailyreport_url_params)); $ctx = stream_context_create($opts); $fp = @fopen($dailyreport_url, 'rb', false, $ctx); if (!$fp) { echo "Problem with API Server. Contact systems administrator.\n"; exit; } $response = @stream_get_contents($fp); if ($response === false) { echo "Problem reading data. Contact systems administrator.\n"; exit; } else { $dailyreport_results = $response; } } catch (Exception $e) { echo "ERROR: Site Timeout\n"; exit; } // Write to screen echo "Start Date: $report_start_date\nEnd Date: $report_end_date\n"; echo "$dailyreport_results\n"; ?>
  11. The tool helped! It's because I still haven't finished the home screen yet and it still pushes stuff off the screen. Many many thanks! Nick
  12. Pretty similar to this issue: http://stackoverflow.com/questions/14834779/chrome-browser-adding-options-to-a-select-box-doesnt-show-in-dropdownlist Only happening on the latest version of Chrome on a Mac, Chrome on windows is ok, all other browsers are ok. I had 2 functions. One that used ajax to send the new item to a php script to add to a session variable. Then a second ajax function to a php file that builds the select html from the session variable and returns the select html. There is an in-between function that just insures that I don't add the "please select..." text after an item has been added and it resets the drop down select. Then I tried the jacascript approach and added the new option for javascript. Same thing. I have a select filled with options. When an option is selected it is supposed to be added to a select list box below it. This item is not added until they click the select drop down box a second time. The dropdown select code: <select name="Notepad" id="Notepad" onclick="test_for_change(this.value);" style="min-width:275px;"> <option>select training item...</option> <option title="option 1" value="option 1">option 1</option> <option title="option 2" value="option 2">option 2</option> <option title="option 3" value="option 3">option 3</option> </select> The javascript: function test_for_change(str) { if(str!="select training item...") { add_training_item(str) } } // This is just used for at time of load. var temp_notepad='<?php echo $_SESSION['cur_training_str']; ?>'; function add_training_item(new_item) { var xmlhttp; if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { temp_notepad=xmlhttp.responseText; document.getElementById("Notepad").value="select training item..."; // Un-rem this out and it calls the php script to return the select html code. //refresh_Used_Training_Items(); // or I un-rem the code below and it does it with pure javascript. } } // This line of code does the pure javascript. //document.getElementById("used_training").options[document.getElementById("used_training").options.length] = new Option(new_item); var subs="?i="+new_item; xmlhttp.open("POST","ajax/add_used_training_item.php"+subs,true); xmlhttp.send(); } function refresh_Used_Training_Items() { // This function calls a php script that builds the html for the select. var xmlhttp; if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("div_used_training_items").innerHTML=xmlhttp.responseText; } } xmlhttp.open("POST","ajax/create_used_training_list.php",true); xmlhttp.send(); } Neither the ajax call to the php script that returns the select, or the pure javascript add option work. This is for Chrome running on a Mac. Chrome is fully up to date. Works fine in every other browser. The problem is that when they select an item from the drop down it doesn't immediately show in the listbox select. When they click the drop down again (not even selecting anything) the listbox select updates/refreshes to show the recently added item. Thanks for reading all of this, I am going to recommend that the person use safari or firefox for the time being. At least until and IF I figure out a solution. Nick
  13. Google changed their rules, and sites that are mobile friendly get better ranking. I have noticed that google results that are mobile friendly are marked so, but my site using bootstrap is not? Is google looking to see if boot strap is used? Thanks Nick
  14. Thank you so much! I only have one question so yeah, you made it pretty simple! What would $row['permalink'] be? <a href="whatever.php">blah</a> or just the url whatever.php? Thanks!! Nick
  15. I'd like to enable visitors to follow my blog using rss. How would I do that using my custom developed blog written with php? Thanks!!
  16. Sort of like a slideshow, only what I am thinking is: 1) load the page in a hidden or off screen container. 2) When all is done, slide it from the top down into place. 3) When the user clicks a navigation button, slide that container up off screen 4) repeat. What are some risks I'm taking, pitfalls? pros and cons of doing this? I know that page load time will effect this, but we are not talking much content, really it's kind of a resume type page. This isn't a how do I question, it is an if I do it this way what can I expect? Thanks a ton, Nick
  17. I agree! I think that this is the way of the future. Especially when bio-metrics take off. I've already been thinking about that. My plan is to keep it simple, and provide a package that anyone can use. SEO minded developer friendly blog platform. Having that built in may make things simpler or more complex. I have to find out, do research, for example I know you need a key for google maps. I'll look into it! Thanks for the advice. Nick
  18. Your first comment is so right on, and isn't it a shame? Regardless, based on your points I have decided to force registration. Thanks for helping me think it through! Nick
  19. I'm in the process of learning about SEO. I figured that I would design and code a simple blogging system at the same time. I need to learn to use mysqli, and how to harden my code for security reasons so I'm doing it all kinda at once. I'm just curious as I have not been much of a blogger. What is expected by users when it comes to comments, and leaving them. IE: can I get away without a user login system. Enter your name, your email and the comment and call her a day? Or should I have a user registration process? The only reason I can think of having a log in system is if I want to let users edit their comments. It would also allow me to limit spam/fake posts. Thoughts? Opinions? Previous experiences? Thanks Nick
  20. But & is, and it wasn't showing in inspect elements. I finally found a google search hit that stated to "view source" and there was the &. I added ENT_QUOTES so the code looks like: $output = htmlspecialchars("isn't it nice & clean", ENT_QUOTES); echo $output; and now I view source instead of inspect element and I get: isn't it nice & clean I had seen many posts to "htmlspecialchars not working" and they all said if you inspect element you will see. Yet inspect element didn't work. Did something change? Either way, foolish of me to trust inspect element. Thanks for the reply! Nick
  21. Hello friends! I have to be missing something, and I hope you can point it out! $output = htmlspecialchars("isn't it nice & clean"); echo $output; outputs: isn't it nice & clean I inspect element in chrome and I see: isn't it nice & clean Shouldn't it be: isn't it nice & clean ?? Confused! Thanks Nick
  22. It seemed like they were something more than just animations. Some weave back and forth, some fade in from nothing, some drop down from the top and than slide up a little bit. Was hoping there was a pre built library that would handle those kinds of things. Based on your reply, I have to manually build those animations? Thanks for the reply!
  23. On this page http://www.jssor.com/ each slide has all sorts of elements that slide in, pop up, fade in, whatever on each slide. What are those called so I can google a tutorial on doing them? Thanks Nick
  24. An additional question I have. What are issues regarding security, or any other pitfalls when savings blog posts as their own html file on the Web host? Is this a safe practice? Thanks!
×
×
  • 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.