dimanche 16 août 2015

Creating Folder using php and user id through php session

So I want to make a little web app for me and my family and the thing that does not work is the session that is set in verify.php

$sql_select = 'select id from email="'.$_SESSION['name'].'" ';

$result = mysql_query($sql_select);
$row = mysql_fetch_array($result);

$id = $row['id'];


        $_SESSION['id']= $id;
    header('Location: home.php');
        exit;

And then I will make a folder and insert and image in upload .php

<?php
session_start();

$id = $_SESSION['id']; 
var_dump($_SESSION);
$gallery = 'gallery';
$dir=$_SERVER['DOCUMENT_ROOT'].'/files/'.$id.'/'.$gallery.'/';
@mkdir($dir, 0777, true);
move_uploaded_file($_FILES['file']['tmp_name'], $dir.$_FILES['file']    ['name']);

?>

The image is just uploading to a gallery folder but not to the actual users folder and this comes out when a var dump array(3) { ["logged_in"]=> int(1) ["name"]=> NULL ["id"]=> NULL } But I am sure the session is alive , any help?




Aucun commentaire:

Enregistrer un commentaire