Jump to content

cool.works

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

cool.works's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. thank you for all replays and sorry for mistakes this is the code : <?php require_once(ROOT_PATH.'themes/shared.js.php'); ?> thnkx
  2. check your php.ini configuration file such as : php_value upload_max_filesize 10M php_value post_max_size 10M php_value max_input_time 300 php_value max_execution_time 300 you can define the constraints within your PHP application: ini_set('upload_max_filesize', '10M'); ini_set('post_max_size', '90M'); ini_set('max_input_time', 300); ini_set('max_execution_time', 300); hope that helps you
  3. hi for all am installing php security user mangement but i got some errors during install am using xampp 1.7.7 for windows but when i runed the script for the first time i got this message Warning: require_once(C:/xampp/htdocs/xampp/psumthemes/shared.js.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\xampp\psum\index.php on line 20 Fatal error: require_once() [function.require]: Failed opening required 'C:/xampp/htdocs/xampp/psumthemes/shared.js.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\xampp\psum\index.php on line 20 any ideas please my document root is C:/xampp/htdocs
  4. did you check my code please fix it cause am not familiar with session
  5. there are a login form any way you can check my code in the attachment please help it made me carzy [attachment deleted by admin]
  6. hi for all am trying to insert $_SESSION['SESS_MEMBER_ID'] in a mysql table called file. All other parameters can be sent to database only this variable this is my code : <?php // Check if a file has been uploaded if(isset($_FILES['uploaded'])) { // Make sure the file was sent without errors if($_FILES['uploaded']['error'] == 0) { // Connect to the database $dbLink = new mysqli('localhost', 'root', '', 'myfile'); if(mysqli_connect_errno()) { die("MySQL connection failed: ". mysqli_connect_error()); } // Gather all required data $name = $dbLink->real_escape_string($_FILES['uploaded']['name']); $mime = $dbLink->real_escape_string($_FILES['uploaded']['type']); $data = $dbLink->real_escape_string(file_get_contents($_FILES ['uploaded']['tmp_name'])); $size = intval($_FILES['uploaded']['size']); // Create the SQL query $query = " INSERT INTO `file` ( `name`, `mime`, `size`, `data`, `created`,`login` ) VALUES ( '{$name}', '{$mime}', {$size}, '{$data}' , NOW(),'".$_SESSION['SESS_MEMBER_ID']."' )"; // Execute the query $result = $dbLink->query($query); // Check if it was successfull if($result) { echo 'Success! Your file was successfully added!'; } else { echo 'Error! Failed to insert the file' . "<pre>{$dbLink->error}</pre>"; } } else { echo 'An error accured while the file was being uploaded. ' . 'Error code: '. intval($_FILES['uploaded_file']['error']); } // Close the mysql connection $dbLink->close(); } else { echo 'Error! A file was not sent!'; } // Echo a link back to the main page echo '<p>Click <a href="upload.php">here</a> to go back</p>'; //move to file section $target = "uploads/"; $target = $target . basename( $_FILES['uploaded']['name']) ; if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else { echo "Sorry, there was a problem uploading your file."; } ?> The $_SESSION['SESS_MEMBER_ID'] is the result of query and this is the code : <?php //Start session session_start(); //Include database connection details require_once('config.php'); //Array to store validation errors $errmsg_arr = array(); //Validation error flag $errflag = false; //Connect to mysql server $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //Select database $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } //Function to sanitize values received from the form. Prevents SQL injection function clean($str) { $str = @trim($str); if(get_magic_quotes_gpc()) { $str = stripslashes($str); } return mysql_real_escape_string($str); } //Sanitize the POST values $login = clean($_POST['login']); $password = clean($_POST['password']); //Input Validations if($login == '') { $errmsg_arr[] = 'Login ID missing'; $errflag = true; } if($password == '') { $errmsg_arr[] = 'Password missing'; $errflag = true; } //If there are input validations, redirect back to the login form if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; session_write_close(); header("location: login-form.php"); exit(); } //Create query $qry="SELECT * FROM members WHERE login='$login' AND passwd='".md5($_POST['password'])."'"; $result=mysql_query($qry); //Check whether the query was successful or not if($result) { if(mysql_num_rows($result) == 1) { //Login Successful session_regenerate_id(); $member = mysql_fetch_assoc($result); $_SESSION['SESS_MEMBER_ID'] = $member['member_id']; $_SESSION['SESS_FIRST_NAME'] = $member['firstname']; $_SESSION['SESS_LAST_NAME'] = $member['lastname']; $_SESSION['SESS_LOGIN'] = $member['login']; session_write_close(); header("location: member-index.php"); //echo $_SESSION['SESS_MEMBER_ID']; //session_id($_SESSION['SESS_MEMBER_ID']); exit(); }else { //Login failed header("location: login-failed.php"); exit(); } }else { die("Query failed"); } ?>
  7. the problem is that i want to upload files on folder (exp : uploads/) and when the user login the script list just his recent uploaded files and download them for the moment i can't download uploaded files
  8. thank you for replaying few minuts ago i enhance the script i can upload , list and download uploded files but i need to store them in spcecific document in the server (such as uploads/ ) to edit, remove, download or list. each user have his owen files and can edit, download, remove or list just files uploded by him and can't acecss to other users files. i will attach my work [attachment deleted by admin]
  9. hI for all Am developping a script that allow to each user (seperatly ) upload or download his files and list all files in categories (such music or photos...) but i can 't achieve that the main problem is to upload files to server and store them in data base also i have to list for each user his files seperatly when he log in any idea please [attachment deleted by admin]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.