Author Topic: ERS - EMail Reporting System  (Read 31357 times)

0 Members and 5 Guests are viewing this topic.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: ERS - EMail Reporting System
« Reply #30 on: August 03, 2014, 02:42:00 PM »
okay..

Try removing the headers from the mail function entirely then.

Code: [Select]
mail($to, $subject, $message);

Offline DarKevin

  • Newbie
  • *
  • Posts: 23
  • Karma: 1
  • sup
Re: ERS - EMail Reporting System
« Reply #31 on: August 03, 2014, 03:58:52 PM »
okay..

Try removing the headers from the mail function entirely then.

Code: [Select]
mail($to, $subject, $message);
Tried that, no success :l

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: ERS - EMail Reporting System
« Reply #32 on: August 03, 2014, 05:25:43 PM »
I don't get it then. That removes all of the variables that make the script different from what you said worked.

Try one last thing. Replace the mail line with...

Code: [Select]
mail("youremail@domain.com", "TEST SUBJECT", "TEST MESSAGE");

Keep it inside of the report.php script though.

Offline DarKevin

  • Newbie
  • *
  • Posts: 23
  • Karma: 1
  • sup
Re: ERS - EMail Reporting System
« Reply #33 on: August 04, 2014, 01:44:05 PM »
Alright, gonna try that next.
Thanks for the support.

Edit: No luck here as well :(

As soon as I switched to the simple report.php (with my code from above) it started working again :l
I'll try to send a bigger test message and see if it gets "blocked" by my webspace host.

Edit2: When I do "too much", it's actually not sent (looks like max is 5kb, your report.php is ~2kb only, though)
On the other hand, it didn't work with the short

mail("youremail@domain.com", "TEST SUBJECT", "TEST MESSAGE");

as well. But there seems to be some filter going on.
I have another webhost to test, but I don't know if they have webmail.
Worth a try.

Edit3:
I tested it with the other webhost (000webhost.com)
The simple report.php (my code) works, the real code one doesn't, so it's the same thing :/
« Last Edit: August 04, 2014, 04:08:19 PM by DarKevin »

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: ERS - EMail Reporting System
« Reply #34 on: August 04, 2014, 06:02:53 PM »
I have an idea.. I don't see why, but maybe the CRC32 is different on different versions of php or on different hosts or something, so try this:

Code: [Select]
<?php

$type =  strip_tags($_POST["type"]);
$rplayer =  strip_tags($_POST["rplayer"]);
$oplayer =  strip_tags($_POST["oplayer"]);
$rtext =  strip_tags($_POST["rtext"]);
$from strip_tags($_POST["from"]);
$sip strip_tags($_POST["sip"]);
$sport strip_tags($_POST["sport"]);

$to strip_tags($_POST["sendto"]);

$headers "From: no-reply@g4p.org\r\n";
$headers .= "Reply-To: no-reply@g4p.org\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

if($type=="PLAYER REPORT")
{

$subject 'Automated Player Report From: ' $from;

$message '<html><body>';
$message .= '<b><font color=\'#FF0000\'>Report Type:</font></b> ' $type '<br />';
$message .= '<b><font color=\'#FF0000\'>Reporting Player:</font></b> ' $rplayer '<br />';
$message .= '<b><font color=\'#FF0000\'>Reported Player:</font></b> ' $oplayer '<br />';
$message .= '<b><font color=\'#FF0000\'>Report Text:</font></b> ' $rtext '<br /><br /><br />';
$message .= '<i><a href=\'steam://connect/' $sip ':' $sport '\'>Click Here to join the server.</a></i>';
$message .= "</body></html>";

}
else
{

$subject 'Automated Bug Report From: ' $from;

$message '<html><body>';
$message .= '<b><font color=\'#FF0000\'>Report Type:</font></b> ' $type '<br />';
$message .= '<b><font color=\'#FF0000\'>Reporting Player:</font></b> ' $rplayer '<br />';
$message .= '<b><font color=\'#FF0000\'>Report Text:</font></b> ' $rtext '<br /><br /><br />';
$message .= '<i><a href=\'steam://connect/' $sip ':' $sport '\'>Click Here to join the server.</a></i>';
$message .= "</body></html>";

}
mail($to$subject$message$headers);
}

?>


Try it first with all the headers. Just change the Reply-To and From fields in the code.

I appreciate you helping me figure this out. There are quite a few people with this same issue, but it works for me on my host, so it's hard to tell what the cause is.

Offline DarKevin

  • Newbie
  • *
  • Posts: 23
  • Karma: 1
  • sup
Re: ERS - EMail Reporting System
« Reply #35 on: August 04, 2014, 07:56:48 PM »
Still didn't work :l
I replaced the code and entered my email address in the headers, also tried to enter the address that I receive emails from, when I use the simple version, but also didn't work.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: ERS - EMail Reporting System
« Reply #36 on: August 04, 2014, 08:10:32 PM »
Do you have the ability to create FTP accounts to your web host?
If you wouldn't mind setting me up with the ability to FTP into your web host (even if it's just into a folder in your web's root) so I can do some tests.

If not, that's fine, but I don't really know what else to do right now. The PHP mail works on your server, you've tested that.. but something in the way my script builds the mail message is erroring or the mail server doesn't like it.

Even though you see the success message in game, that just means the lua script sent the POST command, not that the php server handled it properly.

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: ERS - EMail Reporting System
« Reply #37 on: August 05, 2014, 01:14:08 AM »
You should try sending POST requests from chrome. There's an app for it, but I forgot the name of it.
See if the problem is the lua part of this addon.
Out of the Garry's Mod business.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: ERS - EMail Reporting System
« Reply #38 on: August 05, 2014, 07:43:22 PM »
Neat, I didn't know that was a thing. I will look into it. But I still need access to someone's server (the web server) who is having the issues, as it works 100% fine for me on my server.

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: ERS - EMail Reporting System
« Reply #39 on: August 05, 2014, 08:05:34 PM »
Neat, I didn't know that was a thing. I will look into it. But I still need access to someone's server (the web server) who is having the issues, as it works 100% fine for me on my server.

Someone else will need to provide that, I'm using my own system for reports.
Out of the Garry's Mod business.

Offline DarKevin

  • Newbie
  • *
  • Posts: 23
  • Karma: 1
  • sup
Re: ERS - EMail Reporting System
« Reply #40 on: August 06, 2014, 07:35:18 AM »
Alright, I can set something up for you I guess ;l
Gonna PM you the Login details when it's done.

EDIT:
Hey, since you removed the "browser block" I went and opened the last php code you sent me in my browser, and it gave me an error
saying the last  } bracket at the end of code is unexpected.
I removed it, fixing the error, but still didn't receive an E-Mail.

However, in my webhost control panel it says that it sent the Mails like "2 of the maximum of 100 mails a day have been sent"
To make sure it wasn't from my simple test code, I tried it again, and it is what those "sent" mails were coming from.
Something tells me that I should contact my webhost, regarding the where-the-f**k-abouts of my dang mail, lol.

But I'll copy the php files in the test folder that I prepared for you, and send you the login details by PM soon.

PS: I also checked my mailbox's spam/virus folders, they're empty.
« Last Edit: August 06, 2014, 09:12:24 AM by DarKevin »

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: ERS - EMail Reporting System
« Reply #41 on: August 06, 2014, 08:12:32 PM »
Thanks, I'll take a look soon when I get the chance. It'll be nice having access to another server to test on. (Especially one that someone has a known problem)

Offline fortyeightthousand

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: ERS - EMail Reporting System
« Reply #42 on: August 19, 2014, 09:49:31 AM »
Haven't seen anything new with this topic in a couple weeks.  Any updates?

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: ERS - EMail Reporting System
« Reply #43 on: August 19, 2014, 03:09:26 PM »
Nothing yet. Haven't had the time.

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: ERS - EMail Reporting System
« Reply #44 on: August 23, 2014, 01:23:30 PM »
Here's a quote from http://php.net/manual/en/function.crc32.php.

Quote
Because PHP's integer type is signed many crc32 checksums will result in negative integers on 32bit platforms. On 64bit installations all crc32() results will be positive integers though.
So you need to use the "%u" formatter of sprintf() or printf() to get the string representation of the unsigned crc32() checksum in decimal format.
For a hexadecimal representation of the checksum you can either use the "%x" formatter of sprintf() or printf() or the dechex() conversion functions, both of these also take care of converting the crc32() result to an unsigned integer.
Having 64bit installations also return negative integers for higher result values was considered but would break the hexadecimal conversion as negatives would get an extra 0xFFFFFFFF######## offset then. As hexadecimal representation seems to be the most common use case we decided to not break this even if it breaks direct decimal comparisons in about 50% of the cases when moving from 32 to 64bits.
In retrospect having the function return an integer maybe wasn't the best idea and returning a hex string representation right away (as e.g. md5() does) might have been a better plan to begin with.
For a more portable solution you may also consider the generic hash(). hash("crc32b", $str) will return the same string as dechex(crc32($str)).
Out of the Garry's Mod business.