想要将电子邮件ID和用户名与密码一起发送

时间:2015-06-30 13:19:35

标签: php email post login-script

我是PHP的新手。我已经为我的网页实现了webkreation登录表单,一切正常,但是这段代码只给我发了密码。 请帮我收到电子邮件ID和用户名。谢谢。 下面是代码的一部分,如果有人需要我将发布整个代码。

image = Image.new('RGBA', size=(50,50), color=(256,0,0))
image_file = BytesIO()
image.save(image_file, 'PNG') # or whatever format you prefer
file = ImageFile(image_file)
MyModel.objects.create(img=file, name='123',)

1 个答案:

答案 0 :(得分:0)

So you put these into the database, at the top of your code:

'".$_POST['username']."',
'".md5($pass)."',
'".$_POST['email']."',
'".$_SERVER['REMOTE_ADDR']."',

We'll ignore that this is very bad practice and open to MySQL injection and move on.

We can probably make a guess that $_POST['username'] is the username and $pass is the password.

Could the email possibly be $_POST['email']?

To send email, you use the following code:

send_mail(  'info@mydomain.com',
    $_POST['admin'],
    'Registration System-  - Your New Password',
    'Your password is: '.$pass);

So you want to extend the body of the email which has the password already there. It makes sense to me that the body of the email is "Your password is: xxxx".

To add it all together, this would work:

send_mail(  'info@mydomain.com',
    $_POST['admin'],
    'Registration System-  - Your New Password',
    'Your password is: '.$pass.'<br/>Your username is '.$_POST['username'].'<br/>Your email is '.$_POST['email']);

More important than this: please understand that there is no more support for mysql_* functions, they are officially deprecated, no longer maintained and will be removed in the future. You should update your code with PDO or MySQLi to ensure the functionality of your project in the future.