Jump to content

M.O.S. Studios

Members
  • Posts

    299
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

M.O.S. Studios's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

4

Community Answers

  1. Hey everyone, I am trying to take information from a DB and convert it into a string that has CSV values. some of the values have commas and double quotes, which messes up the end product. is there a way to escape the string so it is rfc 4180 compliant? I don’t want to create a file. I know I can use str_putcsv along with php://temp; but ideally I wouldn’t do that. Mostly because my shared hosting has issues php://temp thanks in advance!
  2. I might have worded it wrong. I want it so that if any of those three methods have an exception, it will bubble up to the try/except in the _construct method. for example: class myclass{ public function func1(){ //line of code that creates fatal error } function __contruct(){ try(){ $this->func1(); }catch(Exception $e){ echo "found a error"; } } } the above will work only if the exception is thorwn within the scope of func1(). if func1() calls an external function that throws an exception, it wont catch it. It doesn't "bubble up". if I change it to: class myclass{ public function func1(){ try(){ buggyFunc(); }catch(Exception $e){ throw new Exception($e); } } function __contruct(){ try(){ $this->func1(); }catch(Exception $e){ echo "found an error"; } } } this works. The problem is, if you look back to my original example: I don't want any subsequent functions to run if the previous function had an error. At the same time, I don't want to a script filled with "try/catch/throw" commands
  3. Hey Everyone, Odd question. I am working with a class that runs methods when a new instance is created. Is there a way to catch any errors thrown within the methods? Here is the code: function __construct(){ try{ $this->val1 = $this->func1; $this->val1 = $this->func2; $this->val1 = $this->func3; }catch(Exception $e){ $this->notes($e); $this->errors = true; } } Ideally, if method "func1" throws an error at anypoint within it, then it will be caught by "catch" in _construct. Is this possible, or do I need to add "try/catch" to each method?
  4. This looks awesome! Probably just what I need. stupid question: I’m on shared hosting with no terminal. So that means no composer. Do you think I can install this another way?
  5. Hey Everyone, I am working on a short script that transfers information from one source to another. Both have a ReST api. I was curious if anyone knew any resources that can make that easier. Ideally, it would be a php file I can use to make an object for each API? Any ideas?
  6. function spamTest($header){ $output_array = preg_grep('/^(X-Spam-Score:)\s([-+]?\d{1,3}\.\d)?/i', explode("\n", $header)); list($xSpamScore, $score) = explode(": ", $output_array[array_key_first($output_array)]); return ($score < 5); } I ran the email header into this and it seems to work.
  7. Ok! So I have been doing the following research: I watched this video to understand how these protocols work I took a look at the headers you posted I sent my php script some real, and spoofed emails I now have a better understanding of what you were explaining to me. My email server does all the checking for me and puts the results into the header of the email. All I need to do is create a php script that checks the headers to see if it passed. Thus the regex code. Is that correct?
  8. Is it really just regex? That’s way easier than I thought it was going to be. I assumed I needed to grab some kind of address, then verify it using a service. thanks! I will look more into this andmuodate the post
  9. Sorry, I meant can you recommend a good php library that can verify its not a spoof once I get the headers.
  10. Yeah, That's so amazing to hear. Do you have any libraries you can recommend? When I look up this topic, the majority of stuff is about validating the content of an outgoing email, as opposed to what I am looking for.
  11. Thanks for the reply. That's unfortunate. I am not using it as a client e-mail validator. Here in Canada, we use E-transfer for payments. Essentially, people can send you money all they need to know is your email. It's pretty awesome. When you receive payment; you get an email from Interac (it's like Visa, but only for debit transactions). I plan to have a dedicated email for E-transfers and pipe all incoming e-mails to a PHP script. When Interact sends a confirmation email; the php program will automatically mark the order as paid. My concern is that someone could easily spoof an email like that. So I was hoping there was a way to validate the email
  12. Hey everyone, I am piping email to a php scripts. I am doing this to automate some processes. I would like to program the script to check the email of the sender, and delete any that are not on an approved list. Is there a way to validate the email isn't spoofed? I’d like to make sure the email is actually from the domain they claim to be from Thanks in advance!
  13. Hey Everyone, I am hoping to find a framework that can easily do the following: 1. Take the information I feed it, and turn it into a simple form that can store and validate entries into a MYSQL Database 2. Use entries from one table as drop-down options for another 3. Allow me to search the database and display them easily. I originally used Google Sheets for it, but I'm finding that is going to be a lot of work. I attached screenshots of the documents to give an idea of what the functionality is going to be I know none of this is hard to do. I don't want to go through the trouble of making a front-end, and troubleshooting if there is a faster way.
  14. this worked exactly as needed!
  15. Ah, so if I log in on one page, and make a Ajax call to another page; it should work? Even if the link is an absolute address like https://myodomain/page.php opposed to page.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.