php

PHP: prompting download from ftp?

hy guys, i really need your help. i've succesfully connected to ftp server via php. i'm listing all files that are on the server. if i click a file the browser should prompt a download window to download the file. i've absolutely no idea how to do that. which method am i going to use. ftp_get kind of confuses me. it says i have to decl...

Store PostgreSQL resultset into sessions?

I'm creating a web app using PHP and PostgreSQL. Database are too big and some kinds of search takes a lot of time to process. User can wait into first search, but it sucks when paginates. Can I store the resultset into sessions vars? It would be great to deal with pagination. ...

Is fopen safe to use in public software?

I am creating a web application that I hope to release to the public for downloading and installing on anyone's own web server, however I just was informed that some webhosts disable the use of fopen in php due to "security issues", particularly on shared hosts. I use fopen during the installation process of the application, should I be ...

PHP: get remote file size with strlen? (html)

I was looking at PHP docs for fsockopen and whatnot and they say you can't use filesize() on a remote file without doing some crazy things with ftell or something (not sure what they said exactly), but I had a good thought about how to do it: $file = file_get_contents("http://www.google.com"); $filesize = mb_strlen($file) / 1000; //KBs,...

Working with vars on PHP, issue when i use -> or = to assign values.

I'm very new at php, I'm trying to run a php script on my WAMP server, this is not the first time i try a script, buy always when i assign a value to a var i do it in this way: $var1="Value of the var"; But now is the first time I'm trying to run a script who has this format: $user->logout('http://'.$_SERVER['HTTP_HOST'].$_SERVER['PH...

move_uploaded_file doesn't yield error, but doesn't move item

move_uploaded_file($_FILES['imgUploader']['tmp_name'],"images/".$name.'.'.$imgExt) None of the arguments return nil or anything, but it doesn't move the item to the specified folder. Do I have to be more specific with the tmp_name location? I've tried different chmods to see if it works, but 775 and 755 do not work. It worked locally,...

php image upload

which is a better place to upload images to? A database or in the web directory? And why? ...

Joomla - what solutions to develop a extension can work with mootools 1.1 and mootools1.2

anybody can share your solutions ? ...

Split a string array into pieces

let said I have an array that store like this. Array ( [0] => width: 650px;border: 1px solid #000; [1] => width: 100%;background: white; [2] => width: 100%;background: black; ) How should I make the array[0] string split into piece by separated the ";"? Then I want to save them in array again, or display them out. How sh...

Will IIS express run php in Visual Studio?

Will IIS express run PHP in visual studio? If so, will you be able to debug php in Visual Studio? ...

read xlsx file using php

Hi there, Can anyone reccomend a good library for reading xlsx files using php? ive looked at phpexcel, but from the examples it seems it only supports writing? ...

How can I have an `factory` method inherit properly without defining the class name in PHP?

I have an abstract base class in my application. I want to provide an factory() method to allow me to make a new model easily with a static method. public static function factory() { $class = __CLASS__; return new $class; } This obviously doesn't work as it tries to initiate the abstract class. What I wanted to know,...

csv producing diff symbol

header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Length: " . strlen($contents)); // Output to browser with appropriate mime type, you choose ;) header("Content-type: text/x-csv"); header("Content-type: text/csv"); header("Content-type: application/csv"); header("Content-Disp...

Download torrent form torcache.com using php.?

As the server is using gzip encription I am getting an error torrent while downloading. <? $path_parts = pathinfo("http://torcache.com/torrent/56A250DC4CD64F6C304631897F1108D413FE76C7.torrent"); $name= $path_parts['basename']; $d="torrent/".$name; if(!copy($f,$d)) { echo "not copied"; } else { echo "copied"; } ?> Then i used this ...

PHP: breadcrumb path?

hey guys, i wonder if you could help me building a little breadcrumb path with php. print $path; // /folder/subfolder/subfolder/etc // breadcrumb path $crumb = explode("/", $path); print "<div class='breadcrumbs'>"; foreach($crumb as $value) { print "<a href='?p=". $value ."'>$value</a> &gt; "; } ...

A PHP script to let users download a file from my website without revealing the actual file link in my website?

The question says it all.. How do I let the users download a file from my website and not let them see what link that file comes from? I understand that there might be a need for something like a download.php which will serve as the gateway but past that phase, I dunno what to script next... If it bothers you to write the whole code, a f...

PHP: Read arbitrary number of bits from an arbitrary offset position in binary data

I have some binary data which has a corresponding "map" file which identifies each data point in the binary data by providing a bit offset and length. So, I might have the following mappings: $paths = array ( "path1" => array ("offset" => 224, "size" => 2), "path2" => array ("offset" => 226, "size" => 6), ); In actua...

How to alter the schema of a database to introduce new features or change the current features

I'm developing an app using Zend Framwork using Git for version control. What is the best approach for updating the schema and the database when one of us makes an update to the db structure? currently, we have to blow out the tables and recreate them manually to reflect the new updates. ...

Parse weird formatted data to XML?

Okay sample output data is below, it looks something like JSON, but it's not formatted exactly like JSON. So I am wondering, how can I get this data looking like XML, preferably with php? Thanks! [{ action:'getallregions', reply:[{regionid:'1',name:'Blue',description:'Research Route',color:'508CEB',active:'true',parentRegionId:'0',paren...

iODBC error trying to connect to MS SQL Server in PHP with unixODBC/FreeTDS

I am trying to connect to a remote MS SQL Server db from PHP on Mac (eventually on an Ubuntu server( with FreeTDS and unixODBC, but even though I seem to have everything set up properly, I'm getting iODBC errors, and I'm not sure how to get around them. I'm using MacPorts, so my config is: /opt/local/etc/freetds.conf:: [bti_db] host =...