ruạṛ
<?php session_start(); require_once $_SERVER['DOCUMENT_ROOT'].'/admin/scripts-includes/universal.php'; $connID = connect_to_db(); $name = clean_plain_data($_POST['gallery_name']); //validate if($name == '') { getout('Please enter a name for your gallery.'); exit; } elseif(select_one('gallery_data','gallery_id','gallery_name',$name)) { getout('A gallery with that name already exists.'); exit; } // print_r($path); exit; //debugging //insert if(!$insert = mysql_query("insert into gallery_data (gallery_name) values ('$name')") ) { getout('There was an error creating the gallery.'); //.mysql_error() exit; } $gallery_id = mysql_insert_id(); $path = '/resources/images/gallery/'.$gallery_id; mysql_query("update gallery_data set gallery_path = '$path/' where gallery_id = '$gallery_id'"); $dir = DOC_ROOT.$path; if(!mkdir($dir, 0755)) { mysql_query("delete from gallery_data where gallery_id='$gallery_id'"); //empty for retry getout('There was an error creating the directory path.'); exit; } chmod($dir, DIR_PERMS); $message = 'Gallery created successfully.'; $url = '../edit-gallery.php?gallery='.$gallery_id; getout($message,$url); exit; ?>
cải xoăn