Fix de bugs

This commit is contained in:
Pierre-Lin Bonnemaison 2015-08-09 21:58:31 +02:00
parent e47d769964
commit 1dda3958d9
11 changed files with 23 additions and 22 deletions

View File

@ -52,7 +52,9 @@
return false; return false;
} }
if (sha1($password) != $users[0]['password']) $user = $users[0];
if (sha1($password) != $user['password'])
{ {
$_SESSION['errormessage'] = 'Cet e-mail n\'existe pas.'; $_SESSION['errormessage'] = 'Cet e-mail n\'existe pas.';
header('Location: ' . $this->generateUrl('connect', 'login')); header('Location: ' . $this->generateUrl('connect', 'login'));

View File

@ -162,7 +162,7 @@
continue; continue;
} }
$db->updateTableWhere('contacts', ['name' => $contact['name'], 'number' => $number], ['id' => $contact['id']]); $db->updateTableWhere('contacts', ['name' => $contact['name'], 'number' => $number], ['id' => $id]);
} }
//Si on a eu des erreurs //Si on a eu des erreurs

View File

@ -48,7 +48,7 @@
//On vérifie que le jeton csrf est bon //On vérifie que le jeton csrf est bon
if (!internalTools::verifyCSRF($csrf)) if (!internalTools::verifyCSRF($csrf))
{ {
$_SESSION['errormessage'] => 'Jeton CSRF invalide !'; $_SESSION['errormessage'] = 'Jeton CSRF invalide !';
header('Location: ' . $this->generateUrl('groups', 'showAll')); header('Location: ' . $this->generateUrl('groups', 'showAll'));
return false; return false;
} }
@ -110,7 +110,7 @@
global $db; global $db;
$nom = $_POST['name']; $nom = $_POST['name'];
if (!$db->insertIntoTable('groups' ['name' => $nom])) if (!$db->insertIntoTable('groups', ['name' => $nom]))
{ {
$_SESSION['errormessage'] = 'Impossible de créer ce groupe.'; $_SESSION['errormessage'] = 'Impossible de créer ce groupe.';
header('Location: ' . $this->generateUrl('groups', 'showAll')); header('Location: ' . $this->generateUrl('groups', 'showAll'));
@ -170,6 +170,6 @@
{ {
global $db; global $db;
echo json_encode($db->getAll('groups')); echo json_encode($db->getFromTableWhere('groups'));
} }
} }

View File

@ -44,7 +44,7 @@
if (!internalTools::verifyCSRF($csrf)) if (!internalTools::verifyCSRF($csrf))
{ {
$_SESSION['errormessage'] = 'Jeton CSRF invalide !'; $_SESSION['errormessage'] = 'Jeton CSRF invalide !';
header('Location: ' . $this->generateUrl('profile', 'showAll'); header('Location: ' . $this->generateUrl('profile', 'showAll'));
return false; return false;
} }
@ -61,7 +61,7 @@
$user = $db->getFromTableWhere('users', ['email' => $_SESSION['email']]); $user = $db->getFromTableWhere('users', ['email' => $_SESSION['email']]);
$password = sha1($_POST['password']); $password = sha1($_POST['password']);
if (!$db->updateTableWhere('users', ['password' => $password], ['id' => $user['id']])) if (!$db->updateTableWhere('users', ['password' => $password], ['id' => $user[0]['id']]))
{ {
$_SESSION['errormessage'] = 'Impossible de mettre à jour le mot de passe.'; $_SESSION['errormessage'] = 'Impossible de mettre à jour le mot de passe.';
header('Location: ' . $this->generateUrl('profile', 'show')); header('Location: ' . $this->generateUrl('profile', 'show'));
@ -86,7 +86,7 @@
if (!internalTools::verifyCSRF($csrf)) if (!internalTools::verifyCSRF($csrf))
{ {
$_SESSION['errormessage'] = 'Jeton CSRF invalide !'; $_SESSION['errormessage'] = 'Jeton CSRF invalide !';
header('Location: ' . $this->generateUrl('profile', 'showAll'); header('Location: ' . $this->generateUrl('profile', 'showAll'));
return false; return false;
} }
@ -114,7 +114,7 @@
$user = $db->getFromTableWhere('users', ['email' => $_SESSION['email']]); $user = $db->getFromTableWhere('users', ['email' => $_SESSION['email']]);
if (!$db->updateTableWhere('users', ['email' => $email], ['id' => $user['id']])) if (!$db->updateTableWhere('users', ['email' => $email], ['id' => $user[0]['id']]))
{ {
$_SESSION['errormessage'] = 'Cette adresse e-mail est déjà utilisée.'; $_SESSION['errormessage'] = 'Cette adresse e-mail est déjà utilisée.';
header('Location: ' . $this->generateUrl('profile', 'show')); header('Location: ' . $this->generateUrl('profile', 'show'));
@ -139,7 +139,7 @@
if (!internalTools::verifyCSRF($csrf)) if (!internalTools::verifyCSRF($csrf))
{ {
$_SESSION['errormessage'] = 'Jeton CSRF invalide !'; $_SESSION['errormessage'] = 'Jeton CSRF invalide !';
header('Location: ' . $this->generateUrl('profile', 'showAll'); header('Location: ' . $this->generateUrl('profile', 'showAll'));
return false; return false;
} }

View File

@ -49,7 +49,7 @@
if (!internalTools::verifyCSRF($csrf)) if (!internalTools::verifyCSRF($csrf))
{ {
$_SESSION['errormessage'] = 'Jeton CSRF invalide !'; $_SESSION['errormessage'] = 'Jeton CSRF invalide !';
header('Location: ' . $this->generateUrl('profile', 'showAll'); header('Location: ' . $this->generateUrl('profile', 'showAll'));
return false; return false;
} }
@ -119,13 +119,12 @@
if (!internalTools::verifyCSRF($csrf)) if (!internalTools::verifyCSRF($csrf))
{ {
$_SESSION['errormessage'] = 'Jeton CSRF invalide !'; $_SESSION['errormessage'] = 'Jeton CSRF invalide !';
header('Location: ' . $this->generateUrl('profile', 'showAll'); header('Location: ' . $this->generateUrl('profile', 'showAll'));
return false; return false;
} }
} }
global $db; global $db;
$date = $_POST['date']; $date = $_POST['date'];
$content = $_POST['content']; $content = $_POST['content'];
@ -215,7 +214,7 @@
if (!$api) if (!$api)
{ {
$_SESSION['errormessage'] = 'Le SMS a bien été créé, mais certains numéro ne sont pas valides.'; $_SESSION['errormessage'] = 'Le SMS a bien été créé, mais certains numéro ne sont pas valides.';
header('Location: ' . $this->generateUrl('scheduleds', 'showAll'); header('Location: ' . $this->generateUrl('scheduleds', 'showAll'));
} }
return true; return true;
} }
@ -223,7 +222,7 @@
if (!$api) if (!$api)
{ {
$_SESSION['successmessage'] = 'Le SMS a bien été créé.'; $_SESSION['successmessage'] = 'Le SMS a bien été créé.';
header('Location: ' . $this->generateUrl('scheduleds', 'showAll'); header('Location: ' . $this->generateUrl('scheduleds', 'showAll'));
} }
return true; return true;
} }
@ -239,7 +238,7 @@
if (!internalTools::verifyCSRF($csrf)) if (!internalTools::verifyCSRF($csrf))
{ {
$_SESSION['successmessage'] = 'Jeton CSRF invalide !'; $_SESSION['successmessage'] = 'Jeton CSRF invalide !';
header('Location: ' . $this->generateUrl('scheduleds', 'showAll'); header('Location: ' . $this->generateUrl('scheduleds', 'showAll'));
return false; return false;
} }

View File

@ -96,7 +96,7 @@
var url = jQuery(this).attr('href'); var url = jQuery(this).attr('href');
jQuery(target).find('input:checked').each(function () jQuery(target).find('input:checked').each(function ()
{ {
url += '/command' + jQuery(this).val() + '_' + jQuery(this).val(); url += '/' + jQuery(this).val();
}); });
window.location = url; window.location = url;
}); });

View File

@ -94,7 +94,7 @@
var url = jQuery(this).attr('href'); var url = jQuery(this).attr('href');
jQuery(target).find('input:checked').each(function () jQuery(target).find('input:checked').each(function ()
{ {
url += '/contacts' + jQuery(this).val() + '_' + jQuery(this).val(); url += '/' + jQuery(this).val();
}); });
window.location = url; window.location = url;
}); });

View File

@ -94,7 +94,7 @@
var url = jQuery(this).attr('href'); var url = jQuery(this).attr('href');
jQuery(target).find('input:checked').each(function () jQuery(target).find('input:checked').each(function ()
{ {
url += '/groups' + jQuery(this).val() + '_' + jQuery(this).val(); url += '/' + jQuery(this).val();
}); });
window.location = url; window.location = url;
}); });

View File

@ -121,7 +121,7 @@
var url = jQuery(this).attr('href'); var url = jQuery(this).attr('href');
jQuery(target).find('input:checked').each(function () jQuery(target).find('input:checked').each(function ()
{ {
url += '/users' + jQuery(this).val() + '_' + jQuery(this).val(); url += '/' + jQuery(this).val();
}); });
window.location = url; window.location = url;
}); });

View File

@ -94,7 +94,7 @@
var url = jQuery(this).attr('href'); var url = jQuery(this).attr('href');
jQuery(target).find('input:checked').each(function () jQuery(target).find('input:checked').each(function ()
{ {
url += '/scheduleds' + jQuery(this).val() + '_' + jQuery(this).val(); url += '/' + jQuery(this).val();
}); });
window.location = url; window.location = url;
}); });

View File

@ -93,7 +93,7 @@
var url = jQuery(this).attr('href'); var url = jQuery(this).attr('href');
jQuery(target).find('input:checked').each(function () jQuery(target).find('input:checked').each(function ()
{ {
url += '/users' + jQuery(this).val() + '_' + jQuery(this).val(); url += '/' + jQuery(this).val();
}); });
window.location = url; window.location = url;
}); });