Jump to content

gavin.sibley

Members
  • Posts

    54
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male
  • Location
    United Kingdom

gavin.sibley's Achievements

Member

Member (2/5)

0

Reputation

  1. Hello Wigwambam, thanks for your reply. i am a novice to php though (just trying to fix a website that someone else broke) is there any chance you could tell me how to do what you said, if i post the code for the current button? <?php if($slide[upload_photo_zip] == "none"){ echo("Not Uploaded Yet"); }else{ echo("<a href='http://www.mydomain.co.uk/generate.php'>Download</a>"); } ?>)</em></td> thats the code for the curent download button. if you could tell me how to insert your suggestion into this that would be great, i have had a go but cant seem to get it working? many thanks, gavin
  2. Hello, i have a page that retrieves information from a database, if i echo out $slide[ip] it will display the correct information. How can i send this information to another page? scenario: 1. i have a page that retrieves the information 2. when i press download on that page i need the ip field to be able to be sent to the script that generates the download. any ideas? many thanks, Gavin
  3. Hello, i am trying to send a database field (ip) from one page to a seperate script when a button is pressed. i.e press download on the page and this triggers a seperate script which forces a download of the users file. the users file is named by their [ip]. if i echo out $slide[ip] on the page it displays the correct ip address, how would i then send this information to the script so that when it downloads the file it knows to get the file that has the clients ip address in the title? i have all the code for download etc. i just need to send the $slide[ip] from the page to the script. many thanks, gavin
  4. thanks for that, any chance you can point me in the right direction? i am not a web person in the slightest but have been given the task of fixing this site that someone else built! thanks, gavin
  5. hello, i am trying to get this code to select a set of links from a database and then add the to the folder to be zipped, everything seems to be working apart from it doesnt seem to pull the url's to add to the end of the file_get_contents line, anyone have any ideas? <?php include("config.php"); require ("zipfile.inc.php"); $zipfile = new zipfile(); $filedata = implode("", file("zipfile.inc.php")); $getspdi = mysql_query("SELECT * FROM `wedding_photos` WHERE `user_hash` = '$_GET[id]' ORDER BY `id` DESC LIMIT 0, 1000") or die(mysql_error()); $getspd = mysql_fetch_array($getspdi); while ($photos = mysql_fetch_array($getspdi)) { $zipfile->add_file(file_get_contents("/var/www/vhosts/mydomain.com/httpdocs-entertainment/wuploads/"), "$photos[img]"); echo("/var/www/vhosts/soundboxaudio.com/httpdocs-entertainment/wuploads/ <br />"); } header("Content-disposition: attachment; filename=spd_$_GET[title]_$_GET[fname]_$_GET[lname]__$_GET[photos]_Photos.zip"); echo $zipfile->file(); ?> many thanks, gavin
  6. Hello, i am looking for a way of searching for all files in a directory containing a certain word in there filename, and then to zip these files and download. Problem is, i have no idea of where to start!! The word in the filename needs to be the username of whichever client i am editting at the time, this is stored in &slide[fname] and i need it to search this directory /wuploads/ this is what ive got so far:- array scandir ( string $directory [, int $sorting_order = SCANDIR_SORT_ASCENDING [, resource $context ]] ) if im right i think this will scan a directory and list all files, im not sure on how to set this however to only get files that have &slide[fname] in the filename somewhere. i then think that the code below will make it all into a zip file, im just not sure on how/if i can glue the two together! < ?php // Class definition found at http://www.zend.com/zend/spotlight/creating-zip-files3.php // Some alterations to the original posted code were made in order to get everything working properly // See example usage at the bottom of this page class zipfile { var $datasec = array(); var $ctrl_dir = array(); var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00"; var $old_offset = 0; function add_dir($name) { $name = str_replace("", "/", $name); $fr = "\x50\x4b\x03\x04"; $fr .= "\x0a\x00"; $fr .= "\x00\x00"; $fr .= "\x00\x00"; $fr .= "\x00\x00\x00\x00"; $fr .= pack("V",0); $fr .= pack("V",0); $fr .= pack("V",0); $fr .= pack("v", strlen($name) ); $fr .= pack("v", 0 ); $fr .= $name; $fr .= pack("V", 0); $fr .= pack("V", 0); $fr .= pack("V", 0); $this -> datasec[] = $fr; $new_offset = strlen(implode("", $this->datasec)); $cdrec = "\x50\x4b\x01\x02"; $cdrec .="\x00\x00"; $cdrec .="\x0a\x00"; $cdrec .="\x00\x00"; $cdrec .="\x00\x00"; $cdrec .="\x00\x00\x00\x00"; $cdrec .= pack("V",0); $cdrec .= pack("V",0); $cdrec .= pack("V",0); $cdrec .= pack("v", strlen($name) ); $cdrec .= pack("v", 0 ); $cdrec .= pack("v", 0 ); $cdrec .= pack("v", 0 ); $cdrec .= pack("v", 0 ); $ext = "\x00\x00\x10\x00"; $ext = "\xff\xff\xff\xff"; $cdrec .= pack("V", 16 ); $cdrec .= pack("V", $this -> old_offset ); $cdrec .= $name; $this -> ctrl_dir[] = $cdrec; $this -> old_offset = $new_offset; return; } function add_file($data, $name) { $fp = fopen($data,"r"); $data = fread($fp,filesize($data)); fclose($fp); $name = str_replace("", "/", $name); $unc_len = strlen($data); $crc = crc32($data); $zdata = gzcompress($data); $zdata = substr ($zdata, 2, -4); $c_len = strlen($zdata); $fr = "\x50\x4b\x03\x04"; $fr .= "\x14\x00"; $fr .= "\x00\x00"; $fr .= "\x08\x00"; $fr .= "\x00\x00\x00\x00"; $fr .= pack("V",$crc); $fr .= pack("V",$c_len); $fr .= pack("V",$unc_len); $fr .= pack("v", strlen($name) ); $fr .= pack("v", 0 ); $fr .= $name; $fr .= $zdata; $fr .= pack("V",$crc); $fr .= pack("V",$c_len); $fr .= pack("V",$unc_len); $this -> datasec[] = $fr; $new_offset = strlen(implode("", $this->datasec)); $cdrec = "\x50\x4b\x01\x02"; $cdrec .="\x00\x00"; $cdrec .="\x14\x00"; $cdrec .="\x00\x00"; $cdrec .="\x08\x00"; $cdrec .="\x00\x00\x00\x00"; $cdrec .= pack("V",$crc); $cdrec .= pack("V",$c_len); $cdrec .= pack("V",$unc_len); $cdrec .= pack("v", strlen($name) ); $cdrec .= pack("v", 0 ); $cdrec .= pack("v", 0 ); $cdrec .= pack("v", 0 ); $cdrec .= pack("v", 0 ); $cdrec .= pack("V", 32 ); $cdrec .= pack("V", $this -> old_offset ); $this -> old_offset = $new_offset; $cdrec .= $name; $this -> ctrl_dir[] = $cdrec; } function file() { $data = implode("", $this -> datasec); $ctrldir = implode("", $this -> ctrl_dir); return $data . $ctrldir . $this -> eof_ctrl_dir . pack("v", sizeof($this -> ctrl_dir)) . pack("v", sizeof($this -> ctrl_dir)) . pack("V", strlen($ctrldir)) . pack("V", strlen($data)) . "\x00\x00"; } } // Test this class $zipTest = new zipfile(); $zipTest->add_dir("images/"); $zipTest->add_file("images/box1.jpg", "images/box1.jpg"); $zipTest->add_file("images/box2.jpg", "images/box2.jpg"); // Return Zip File to Browser Header("Content-type: application/octet-stream"); Header ("Content-disposition: attachment; filename=zipTest.zip"); echo $zipTest->file(); // Alternatively, you can write the file to the file system and provide a link: /* $filename = "output.zip"; $fd = fopen ($filename, "wb"); $out = fwrite ($fd, $zipTest -> file()); fclose ($fd); echo "Click here to download the new zip file."; */ any help would be much appreciated! thanks, gavin
  7. found a solution for it now so no worries and its sort of half and half im trying to create this redirect script to insert into a wordpress page...
  8. after looking around a bit (thank you google!) i have found this information that i think may help me, but as i said, having no idea about php really doesnt help! ?php global $current_user; get_currentuserinfo(); echo 'Username: ' . $current_user->user_login . "\n"; echo 'User email: ' . $current_user->user_email . "\n"; echo 'User first name: ' . $current_user->user_firstname . "\n"; echo 'User last name: ' . $current_user->user_lastname . "\n"; echo 'User display name: ' . $current_user->display_name . "\n"; echo 'User ID: ' . $current_user->ID . "\n"; ?> is there anyway of using this to do what im trying to do? to get the user_login? thanks, gavin
  9. Just to add a bit more info, the redirect is working however its not including the user_login in the url so i am ending up with:- mydomain.com/-manager rather than mydomain.com/(user_login)-manager thanks
  10. What im trying to do is for each user to be redirected to there own homepage when they click the home page button, obviously there user_login is stored in the database so was hoping there was someway such as this to insert the user_login straight into a url redirector. doesnt seem to like the code above though, giving me a 404 error
  11. Hello, i am trying t set up a redirect depending on the username of the person. I am new to php so not exactly sure how to set it up. i have this so far, what is needed to make this work? <?php &user = GET_$user_login header( 'Location: http://www.mydomain.com/[&user]-manager' ) ; ?> thanks,gavin
  12. Not the foggiest im sorry, i never use php im building a site in wordpress but need to add this one line of php to be able to set up this redirect.
  13. Thats great thanks, any idea on how i would change this redirect using a field in a database depending on the current logged in user? i.e redirect to page 1 when user 1 logged in, redirect to page 2 when user 2 logged in etc. thanks, gavin
  14. Hello, Im trying to set up a page that will redirect users to other pages depending on there login credentials. The user name is stored in the under user_login and the page i want them to be redirected to is in the same table and is called HomePage. I havent got a clue when it comes to php so any help would be much appreciated. thanks, gavin
  15. This works perfectly, media player is working as it should and is authenticating the users on their IP address. brilliant!! thanks so much!
×
×
  • 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.