php

tracking download process with javascript

hi my question is, is that possible to track a download process with javascript or any other else. lets say i want to do some stuff when download finished or cancelled. is that possible ? Thanks ...

Converting Ruby AES256 decrypt function to PHP.

I have the following function in Ruby that decrypts a bit of data: def decrypt(key, iv, cipher_hex) cipher = OpenSSL::Cipher::Cipher.new('aes-256-cbc') cipher.decrypt cipher.key = key.gsub(/(..)/){|h| h.hex.chr} cipher.iv = iv.gsub(/(..)/){|h| h.hex.chr} decrypted_data = cipher.update(cipher_hex.gsub(/(..)/){|h| h....

Zend Dojo comboBox not finding dojo.data

I am trying to get a dojo comboBox working in Zend, with the following code: $url = '/db/autocomplete/table/suburbs'; $element = new Zend_Dojo_Form_Element_ComboBox('suburb1'); $element->setStoreId('suburbsStore'); $element->setStoreType('dojo.data.ItemFileReadStore'); $element->setStoreParams(array('url' => $url)); $element->setDijitPa...

How to write Rest in PHP

Hi guys. I'm developing php library. So i want to add Rest to my library. How to write Rest in PHP ? Any idea? Thank you for every advise? ...

Calling a system() command and bringing back the results

I need to put several thousand large files in a folder into a RAR archive several times a day. I used to do this manually via sFTP using a custom command with the RAR software package. I'm wondering if it would be possible to use the RAR command using system() in PHP, and bring back the results every second or so to get a clear indicati...

TCPDF Div Border doesn't work

Hi, I tried to generate pdf using TCPDF with html content. My html code is <div style="border:1px solid #000; width:200px; height: 100px"> Test Border</div> But it just generate text only. I didn't see div and border. Is that not supported or am i wrong ? Or how can i make it work ? Thanks. ...

Test if a directory is a sub directory of another folder

I am trying to create a function that will block access to some of my low level directories. For example, while building my site I don't want to allow uploads to be uploaded any lower than /var/www/html/site/uploads/ should I make a mistake while coding. This will also help to prevent a directory delete typo while removing cache files or...

Limits and wait times like Rapidshare

I have an open environment, no logins, where a number of files can be downloaded. I'm now trying to set up a wait time feature and a bandwidth limit per visitor per period of time type thing (similar to what Rapidshare has if you've ever used them before). Any ideas how I should go about implementing this? I'm on PHP so all its restrict...

how can i make variable declaration optional in codeigniter?

coming from a modular php programming environment i got used to using variables in php without regard of wether they were instantiated or not. i've been using codeigniter for around a month now and noticed that it is strictly implementing on not using a variable if they are undefined / undeclared. i would like to know what's the purpos...

How to convert variables from MYSQL result into PHP variables with same name?

I am running this mysql query: $result = mysql_query("SELECT * FROM userdetails WHERE userid= '$userid'"); $row = mysql_fetch_array($result); The result is a row of 100 variables with different names such as $row['name'], and $row['email'], etc... How can I convert all of these to just $name and $email, etc... in php? It would sav...

In PHP, what is a Tick?

I know that Ticks are not PHP specific and are somewhat related to timing and/or number of operations, but I lack all the understanding that would otherwise allow me to work with them. Can someone please explain to me what ticks are / do in a simple fashion? ...

change value of a line in an array

I need to change the value of a line within an array to a given string, then implode and save the data. Im using the code below. row is the row of the table. target is the specific line in the array which i want to update. nfv is the new string i want to put into the array. <? $rowpre = $_GET['row']; $newfieldvalue = $_GET['nfv']; $row...

What PHP/Web technologies do I need to get up to speed ?

After graduating in CS in the last century I have been running my own business for the better part of a decade. Now in my mid-thirties I am going to move countries and for the first time in a long time I need to look seriously at actually finding a formal position as a programmer. I have developed and maintained several sizable websites...

PHP Exceptions and Security

When in a page triggered by an exception, what vulnerabilities is a php page open to? I am using Kohana and am used to triggering exceptions (404, runtimes, etc) But I recently read a book (19 Sins in Software Security) that says a site in an unstable state(i.e. in an page triggered by exception) is open to critical attacks. I am worr...

How do I implement observer pattern on PHP + Javascript/jQuery?

Just like in SO, where one is answering a question, if somebody has answered said question, a notification will appear (via AJAX?). My only way of somewhat replicating this is by including a timeout on my script that fetches if there is an update every n seconds. Is there a way to do this using observer pattern on PHP + Javascript (w/ jQ...

invalid argument when imploding in php

Im getting invalid argument error when running the following code. Im trying to change the value of a line in the $info array, then implode it, implode its parent array, and then save the whole shebang back to whence it came. $rowpre = $_GET['row']; $newfieldvalue = $_GET['nfv']; $row = --$rowpre; $data = file_get_contents("temp.php"); ...

HMAC - Implementation of PHP algorithm in Objective-C

Hi, I have to implement the HMAC MD5 in my iPhone app. The PHP version of the algorithm (implemented server side for verification) is here and I can't modify it (it's an API) function hmac($key, $data) { $b = 64; // byte length for md5 if (strlen($key) > $b) { $key = pack("H*",md5($key)); } $key = str_pad($key, $b, chr(0x00)); ...

how to convert HierarchicalCollectionView to Array using flex3 ?

i used advance datagrid of dataProvider as HierarchicalData . it's an my array collection strature private var groupList:ArrayCollection = new ArrayCollection([                {Country:'India', children:[                                {Matches:'India Test series 1',isEnable:false},                                {Matches:'India Test se...

How to play the YOUTUBE video automatically when a page loads using PHP

Hi, Is there any possible way to PLAY a you tube video on page load and to get the TOTAL PLAY TIME of that particular video. Any related reply will be helpful... Thanks in advance... Fero ...

PHP: Sort Multidimensional Array with Different Depth per element by Field

Hey, i have have got an array of the complexe sort to store my navigation (which is supposed to be changed by the user afterwards). I do not want to have the script only work with 3 levels of depth so I am looking for a nice and good way to sort this array by the position field. $nav[1]=array( 'name'=>'home', 'position'=>'2', ...