Evolvemod Report to Email Plugin

Hello. I have a Working PHP Script and Its Working in-game. But I need to add more arguments and essentially mix two lua codes together.

I need to mix this code:
[lua]
filex.Append( “ev_reports.txt”, “[” … os.date() … “] " … evolve:PlayerLogStr( ply ) … " reported " … evolve:PlayerLogStr( pl[1] ) … " with reason '” … msg … "’
"
[/lua]

With this code:
[lua]
http.Get(“http://www.matthewjeanes.info/report.php?report=”…msg , “” , function() end )
[/lua]

I want it so it shows who reported the player, which player was reported, And why.

Thanks for any help in advance, Matt J

Well, if you want that extra information, you’ll have to edit the PHP script to allow it, using the $_GET functions you’re clearly aware of already. So like

<?php

$report = $_GET['report'];
$reporter = $_GET['reporter'];
$reportedplayer = $_GET['rp'];

//Then just do what you want with the information above, stick them in an MySQL database, maybe?
?>

Then of course the report.php?report=whatever&reporter=whatever&rp=whatever

Then you just do the lua code, so like.

[lua]http.Get(“http://www.matthewjeanes.info/report.php?report=whatever&reporter=whatever&rp=whatever”)[/lua]

Hmm, my main problem is spaces though

When someone add’s a space to their report, E.G making it more then one word, It wont send the email

I’ve tryed various ways of converting spaces to %20 but its just not working, Any Ideas Anyone?

**[String.gsub

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=String.gsub)**

that might help you

I’ve already tried that but it won’t change spaces…

[lua]
local msg = “Your message here”
local newmsg = string.gsub(msg," “,”+")
print(newmsg) – Prints “Your+message+here”
[/lua]

% is a pattern escape character. To replace %20 with spaces, you should do this

(“http://whatever.com/some%20folder/some%20file.mp3"):gsub("%%20” , " ")

[editline]11th February 2011[/editline]

That way, you escape the %, leaving it with %20 as the characters to be replaced.

Wait, I want to replace spaces in the lua string into %20 so it works in the URL.

Or is that what that would do?

Oh right. Just swap the args around.

:gsub(" " , “%%20”)

Lol ok thanks

[editline]11th February 2011[/editline]

It works! Thanks so much!