blob: 82ffcdea75b8a15d318cc7388e7e8efc11c73341 [file] [log] [blame]
Andreu20cbd1d2019-09-22 00:00:57 +02001<?php
Andreu2457e402019-09-22 00:52:41 +02002 require '../credentials.php';
Andreu20cbd1d2019-09-22 00:00:57 +02003 require 'utils.php';
4
5 // Check if confirmation is the same
6 if ($_POST['password'] != $_POST['confirmation']) {
7 header("Location: ../main.php?wrong_password=1");
8 die();
9 } else {
10 // Execute query to change password
11 $update_password = "UPDATE users SET password=\"".md5($_POST['password'])."\" WHERE id=".$_POST['userid'];
12 if(!$result = query($update_password)) header("Location: ../main.php?errordb=1");
13
14 // Save 'password' to cookies
15 setcookie('password', md5($_POST['password']), time() + (86400 * 10), "/");
16
17 // Go back to main page
18 header("Location: ../main.php?successpassword=1");
19 }
20?>