Ajax et variable de session
Bonjour jutilise ajax de jQuery et tout allez bien jusqu'à que jais changer dans le fichier ajax.php je m'explique:
mon code avant le problème
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| <?php
require 'db.php';
//ajax update position photos
if (isset($_POST['photo'])){
foreach( $_POST['photo'] as $order => $id_photo ){
$uphoto= "UPDATE `upload`
SET `position` = '$order'
WHERE `id` = '$id_photo'";
query($uphoto);
}
}
?> |
et des que jais ajouter sa il marche plus du tout !
mon code après ajout
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| <?php
require 'db.php';
//check if admin
if(!isset($_SESSION['admin'])=='yes'){
redirect('login.php');
}
//ajax update position photos
if (isset($_POST['photo'])){
foreach( $_POST['photo'] as $order => $id_photo ){
$uphoto= "UPDATE `upload`
SET `position` = '$order'
WHERE `id` = '$id_photo'";
query($uphoto);
}
}
?> |
jais meme essayer comme sa
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| <?php
require 'db.php';
//ajax update position photos
if (isset($_POST['photo'])&&isset($_SESSION['admin'])=='yes'){
foreach( $_POST['photo'] as $order => $id_photo ){
$uphoto= "UPDATE `upload`
SET `position` = '$order'
WHERE `id` = '$id_photo'";
query($uphoto);
}
}
?> |
mais sa marche toujours pas !
vous aurez une solution ?