Jump to content

dschuett

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Everything posted by dschuett

  1. ok, We are getting closer: I changed it to this in uploadify.php[code[<?phpsession_id($_POST[session_name()]);session_start();ob_start(); //Start bufferingvar_dump($_POST); //print the result$output = ob_get_contents(); //get the result from bufferob_end_clean(); //close buffer$h = fopen('log.txt', 'w+'); //open a filefwrite($h, $output); //write the output textfclose($h); //close file?> and get this outputted to my log.txt file: array(4) { ["Filename"]=> string(12) "purppete.jpg" ["folder"]=> string(15) "/upload/uploads" ["PHPSESSID"]=> string(26) "ggrjejvqqbpbdoe05ucph2ank1" ["Upload"]=> string(12) "Submit Query" } How can i get $_SESSION['current_email'] as PHPSESSID? I apologize for bot being able to understand this more...I am still very much in the learning stage of php. I really do appreciate your help!
  2. Just to clarify, log.txt shows: array(0) { } The above is outputted into log.txt when i try to upload a file from uploadify index.php
  3. @PFMaBiSmAd I still can't get it to work. I have a session called $_SESSION['current_email'] which is created when a form is submitted. (This holds a users email). I have done this to my uploadify index.php: <?php session_start(); if ($_SESSION['level']=="1"){echo "<b>Welcome, ".$_SESSION['firstname']."!</b><br><br>";echo "<a href='http://sbslogin.ath.cx:8080/register'>Home</a> | <a href='/logout/index.php'>Log Out</a><br /><hr width='100%'></hr><br>";}else{ die("Access Denied.");}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Shots by Shell Pictures Upload</title><link href="/scripts/default.css" rel="stylesheet" type="text/css" /><link href="/scripts/uploadify.css" rel="stylesheet" type="text/css" /><script type="text/javascript" src="/scripts/jquery-1.3.2.min.js"></script><script type="text/javascript" src="/scripts/swfobject.js"></script><script type="text/javascript" src="/scripts/jquery.uploadify.v2.1.0.min.js"></script><script type="text/javascript">$(document).ready(function() {$("#uploadify").uploadify({ 'uploader' : '/scripts/uploadify.swf', 'script' : 'uploadify.php', 'cancelImg' : '/images/cancel.png', 'folder' : 'uploads', 'queueID' : 'fileQueue', 'auto' : true, 'multi' : true, scriptData : { <?php echo session_name(); ?>: '<?php echo session_id();?>'} });});</script></head><body><div id="upload_wrapper"><div id="fileQueue"></div><input type="file" name="uploadify" id="uploadify" /><p><a href="javascript:jQuery('#uploadify').uploadifyClearQueue()">Cancel All Uploads</a></p></div></body></html> I have this in uploadify.php (just for testing purposes as of now): <?php$session_name = session_name();session_id($_GET[$session_name]);session_start();ob_start(); //Start bufferingvar_dump($_GET); //print the result$output = ob_get_contents(); //get the result from bufferob_end_clean(); //close buffer$h = fopen('log.txt', 'w+'); //open a filefwrite($h, $output); //write the output textfclose($h); //close file?> log.txt shows: array(0) { }
  4. That is what I'm after but I still can't get it working. Here is what i'm working with: I have a form that the ADMIN fills out to register a user: once the form is submitted, I do the following to capture the user's email address that I JUST registered: $currentemail=$_REQUEST['Email']; $_SESSION['current_email']=$currentemail; header('Location:/upload'); As you can see the above also redirects the ADMIN to upload/index.php (which is the front end of uploadify - where you can select files to upload): index.php looks like this: <?php session_start(); if ($_SESSION['level']=="1"){ echo "<b>Welcome, ".$_SESSION['firstname']."!</b><br><br>"; echo "<a href='/register'>Home</a> | <a href='/logout/index.php'>Log Out</a><br /><hr width='100%'></hr><br>"; }else{ die("Access Denied."); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Shots by Shell Pictures Upload</title> <link href="/scripts/default.css" rel="stylesheet" type="text/css" /> <link href="/scripts/uploadify.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="/scripts/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="/scripts/swfobject.js"></script> <script type="text/javascript" src="/scripts/jquery.uploadify.v2.1.0.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#uploadify").uploadify({ 'uploader' : '/scripts/uploadify.swf', 'script' : 'upload.php', 'cancelImg' : '/images/cancel.png', 'folder' : 'uploads', 'queueID' : 'fileQueue', 'auto' : true, 'multi' : true, 'scriptData' :{'current_email':'<?php echo session_id();?>'} }); }); </script> </head> <body> <div id="fileQueue"></div> <input type="file" name="uploadify" id="uploadify" /> <p><a href="javascript:jQuery('#uploadify').uploadifyClearQueue()">Cancel All Uploads</a></p> </body> </html> 'scriptData' :{'current_email':'<?php echo session_id();?>'} is the line I can't figure out how to set in order to get $_SESSION['current_email'] to pass to uploadify.php. This is necessary, because i need to get that user's email into a database as shown below in my upload.php: <?php session_start(); // var_dump($_SESSION); if (!empty($_FILES)) { $con = mysql_connect("localhost", "xxx", "xxx") or die("cannot connect"); mysql_select_db("xxx", $con) or die("cannot select DB"); $tempFile = $_FILES["Filedata"]["tmp_name"]; $name = $_FILES["Filedata"]["name"]; $targetPath = "uploads/"; $targetFile = str_replace('//','/',$targetPath) . $_FILES["Filedata"]['name']; $size = $_FILES["Filedata"]["size"]; $oext = getExtension($name); $ext = strtolower($oext); $whois = $_SERVER['REMOTE_ADDR']; // THIS ISN'T GETTING PASSED $email = $_SESSION['current_email']; if ($ext == "jpg" || $ext == "jpeg" || $ext == "bmp" || $ext == "gif") { if ($size < 1024 * 1024) { if (file_exists("uploads/" . $name)) { move_uploaded_file($tempFile, "uploads/" . $name); $qry = "select id from pictures where path='$targetFile' and type='$ext'"; $res = mysql_fetch_array(mysql_query($qry)); $id = $res['id']; $qry = "UPDATE pictures SET path='$targetFile', type='$ext', size='$size', whois='$whois', date=NOW() where id=$id"; mysql_query($qry); echo "1"; ?><div style="float:right; text-align:left; width:400px;"><?php echo "Image '$name' <font color='blue'>updated</font><br />"; } else { move_uploaded_file($tempFile, "uploads/" . $name); $qry = "INSERT INTO pictures(id, path, type, size, email, whois, date) VALUES ('', '$targetFile', '$ext', '$size', '$email', '$whois', NOW())"; mysql_query($qry, $con); echo "1"; ?><div style="float:right; text-align:left; width:400px;"><?php echo "Image '$name' <font color='green'>uploaded</font><br />"; } } else { ?><div style="float:right; text-align:left width:400px;"><?php echo "<font color='red'><B>Image size excedded.<br />File size should be less than 1Mb</B></font><br />"; } } else { ?><div style="float:right; text-align:left; width:400px;"><?php echo "<font color='red'><B>Invalid file extension '.$oext'</B></font><br />"; } } function getExtension($image_name) { return substr($image_name, strrpos($image_name, '.') + 1); } ?> I appreciate you helping me out! - especially on this old of thread
  5. Sorry to pull up a fairly old thread, but I am having the same problem passing my $_SESSION['email'] to uploadify.php How did you ever get this working? Thanks!
  6. Ok I am very new to the php mysql world so please bare with me. I have set up a database for an apartment complex with a table containing the following: create table apartments (apt_num int not null, available varchar(5) not null, beds int not null, baths int not null, pets varchar(5) not null, lease_start varchar(25), lease_end VARCHAR(25), descr varchar(25) not null, primary key (apt_num)); I am now creating a form that contains check boxes for users to select what they want to search for, and return the correct results... for example: <input type=”checkbox” checked="checked" name=”bdrm[]” value=”Any″> <input type=”checkbox” name=”bdrm[]” value=”1″> <input type=”checkbox” name=”bdrm[]” value=”2″> <input type=”checkbox” name=”bdrm[]” value=”3″> <input type=”checkbox” checked="checked" name=”btrm[]” value=”Any″> <input type=”checkbox” name=”btrm[]” value=”1″> <input type=”checkbox” name=”btrm[]” value=”2″> <input type=”checkbox” checked="checked" name=”pets[]” value=”Any″> <input type=”checkbox” name=”pets[]” value=”Yes″> <input type=”checkbox” name=”pets[]” value=”No″> my question is: how would i use php to insert it into a query such as this: SELECT * FROM apartments WHERE beds='bdrmChecked' AND baths='btrmChecked' AND pets='petsChecked'; Another problem is that if a user checked "Any" it wouldn't return any results because the value "Any" wouldn't exist in the table... Any help is appreciated!
×
×
  • 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.