Skip to content

Commit

Permalink
Format code with standardjs, prettier and php-cs-fixer
Browse files Browse the repository at this point in the history
This commit fixes the style issues introduced in bf09518 according to the output
from standardjs, prettier and php-cs-fixer.

Details: https://deepsource.io/gh/davidbelfiori/JobInt/transform/01a1d6d9-894b-47c6-bcda-41f63e351281/
  • Loading branch information
deepsource-autofix[bot] committed May 6, 2022
1 parent bf09518 commit 3ce31a2
Show file tree
Hide file tree
Showing 34 changed files with 939 additions and 1,001 deletions.
58 changes: 29 additions & 29 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{
"sqltools.connections": [
{
"mysqlOptions": {
"authProtocol": "default"
},
"previewLimit": 50,
"server": "localhost",
"port": 3306,
"driver": "MySQL",
"name": "localhost",
"database": "provaphplogin",
"username": "root",
"password": "root"
},
{
"mysqlOptions": {
"authProtocol": "default"
},
"previewLimit": 50,
"server": "localhost",
"port": 3306,
"driver": "MySQL",
"name": "JobInt",
"database": "jobint",
"username": "root",
"password": "root"
}
]
}
"sqltools.connections": [
{
"mysqlOptions": {
"authProtocol": "default"
},
"previewLimit": 50,
"server": "localhost",
"port": 3306,
"driver": "MySQL",
"name": "localhost",
"database": "provaphplogin",
"username": "root",
"password": "root"
},
{
"mysqlOptions": {
"authProtocol": "default"
},
"previewLimit": 50,
"server": "localhost",
"port": 3306,
"driver": "MySQL",
"name": "JobInt",
"database": "jobint",
"username": "root",
"password": "root"
}
]
}
5 changes: 2 additions & 3 deletions db/database_connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ function fetch_user_last_activity($user_id, $conn)
ORDER BY last_activity DESC
LIMIT 1
";
$result= mysqli_query($conn,$query);
while($row = mysqli_fetch_assoc($result)){
$result= mysqli_query($conn, $query);
while ($row = mysqli_fetch_assoc($result)) {
return $row['last_activity'];
}
}
?>
7 changes: 3 additions & 4 deletions page/Unlike.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?php

include "../db/config.php";

if(isset($_GET['id'])){
if (isset($_GET['id'])) {
$idLavoratore=$_GET['id'];
$sql_query="delete from `like` where idLavoratore='$idLavoratore'";
$result = mysqli_query($conn,$sql_query);
$result = mysqli_query($conn, $sql_query);

header("Location: likeProfili.php");

}
?>
2 changes: 1 addition & 1 deletion page/chat.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
include("../db/config.php");
session_start();

if(!isset($_SESSION['user_id'])){
if (!isset($_SESSION['user_id'])) {
header("location: index.php");
}
?>
Expand Down
33 changes: 16 additions & 17 deletions page/controllerUserData.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,79 +9,78 @@
$errors = array();

//if user click continue button in forgot password form
if(isset($_POST['check-email'])){
if (isset($_POST['check-email'])) {
$email = mysqli_real_escape_string($conn, $_POST['email']);
$check_email = "SELECT * FROM user WHERE email='$email'";
$run_sql = mysqli_query($conn, $check_email);
if(mysqli_num_rows($run_sql) > 0){
if (mysqli_num_rows($run_sql) > 0) {
$code = rand(999999, 111111);
$insert_code = "UPDATE user SET code = $code WHERE email = '$email'";
$run_query = mysqli_query($conn, $insert_code);
if($run_query){
if ($run_query) {
$subject = "Password Reset Code";
$message = "Your password reset code is $code";
$sender = "From: noreply.jobint@gmail.com ";
if(mail($email, $subject, $message, $sender)){
if (mail($email, $subject, $message, $sender)) {
$info = "We've sent a passwrod reset otp to your email - $email";
$_SESSION['info'] = $info;
$_SESSION['email'] = $email;
header('location: reset-code.php');
exit();
}else{
} else {
$errors['otp-error'] = "Failed while sending code!";
}
}else{
} else {
$errors['db-error'] = "Qualcosa è andato stotro!";
}
}else{
} else {
$errors['email'] = "Questa email non esiste!";
}
}

//if user click check reset otp button
if(isset($_POST['check-reset-otp'])){
if (isset($_POST['check-reset-otp'])) {
$_SESSION['info'] = "";
$otp_code = mysqli_real_escape_string($conn, $_POST['otp']);
$check_code = "SELECT * FROM user WHERE code = $otp_code";
$code_res = mysqli_query($conn, $check_code);
if(mysqli_num_rows($code_res) > 0){
if (mysqli_num_rows($code_res) > 0) {
$fetch_data = mysqli_fetch_assoc($code_res);
$email = $fetch_data['email'];
$_SESSION['email'] = $email;
$info = "Per favore crea una nuova password che non usi su nessun altro sito.";
$_SESSION['info'] = $info;
header('location: new-password.php');
exit();
}else{
} else {
$errors['otp-error'] = "Hai inserito un codice errato!";
}
}

//if user click change password button
if(isset($_POST['change-password'])){
if (isset($_POST['change-password'])) {
$_SESSION['info'] = "";
$password = mysqli_real_escape_string($conn, $_POST['password']);
$cpassword = mysqli_real_escape_string($conn, $_POST['cpassword']);
if($password !== $cpassword){
if ($password !== $cpassword) {
$errors['password'] = "Le password non corrispondono!";
}else{
} else {
$code = 0;
$email = $_SESSION['email']; //getting this email using session
$encpass = md5($password);
$update_pass = "UPDATE user SET code = $code, password = '$encpass' WHERE email = '$email'";
$run_query = mysqli_query($conn, $update_pass);
if($run_query){
if ($run_query) {
$info = "La tua password è cambiata. Ora puoi accedere con la tua nuova password.";
$_SESSION['info'] = $info;
header('Location: password-changed.php');
}else{
} else {
$errors['db-error'] = "Impossibile modificare la password!";
}
}
}

//if login now button click
if(isset($_POST['login-now'])){
if (isset($_POST['login-now'])) {
header('Location: index.php');
}
?>

0 comments on commit 3ce31a2

Please sign in to comment.