Handy edit to login > public.php while game is new

General Chat, Comments

Handy edit to login > public.php while game is new

Postby cbsarge » Fri Feb 10, 2017 10:09 am

For anyone else that doesn't want to have to log in constantly to see if anyone else has logged in this line of code will alert you with an email when someone logs into the game. It will include the user name of the person who logged in.

In the login module edit the public.php file around line 55.

Code: Select all
$_SESSION["userid"] = $result->fields[0];
$_SESSION["username"] = $result->fields[1];
$_SESSION["block"] = $result->fields[2];
$userId = $result->fields[0];
$result->Close();


becomes

Code: Select all
$_SESSION["userid"] = $result->fields[0];
$_SESSION["username"] = $result->fields[1];
$_SESSION["block"] = $result->fields[2];
//added to send email alerts when someone logs in
mail("somemail@somedomain.com","Someone has logged into the game!", $result->fields[1], Translate("The following player has logged into the game:"));
$userId = $result->fields[0];
$result->Close();


Obviously you'll want to substitute your real email address. :D
User avatar
cbsarge
 
Posts: 174
Joined: Mon Sep 14, 2015 10:20 am
Has thanked: 38 times
Been thanked: 0 time

Re: Handy edit to login > public.php while game is new

Postby hallsofvallhalla » Fri Feb 10, 2017 11:42 am

Thanks for sharing!
User avatar
hallsofvallhalla
Site Admin
 
Posts: 11520
Images: 13
Joined: Wed Apr 22, 2009 6:29 pm
Location: mobile, al
Has thanked: 11 times
Been thanked: 115 times
Blog: View Blog (3)

Re: Handy edit to login > public.php while game is new

Postby KyleMassacre » Sun Apr 23, 2017 9:12 pm

I like to use Slack so if this script is for a small amount of people (not every player in the game) then you could utilize the Slack API and just send a message to your Slack channel of your choice.
Skype: KyleMassacre
My NWE Modules
User avatar
KyleMassacre
 
Posts: 542
Joined: Wed Nov 27, 2013 7:42 am
Has thanked: 18 times
Been thanked: 32 times


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron

x