php

PHP: Split string into chunks of 8, how do I do this?

I have binary basically, say it's 300 in length. How would I split (much like using explode) it into 8 bit chunks? I look at chunk_split() but it only seems to have an 'end' parameter, not an option to put it into an array.. Or can it be socketed into an array? The end 8 digits can be below 8 (in case a miscopy from someone, and it's 4)...

Dynamically creating a member ID card as pdf using PHP?

I need to code a PHP script that would let me generate a pdf file which displays a member ID card (something like a credit card used to identify oneself) at a certain resolution. Let me explain: I do have the basic blueprint of the card in png file format. The script needs to drop in a member's name and birthday along with a serial. So ...

assign mysql values into multidimensional array

Hi, I am trying to display a multidimensional array into html table using php nd mysql. The array structure is like below Array ( [az] => Array ( [0] => Array ( [work] => dsdsds [time] => 2:47---2:55 [total] => 8 ) ...

How to create a view/table in my context in mysql ?

Hello, I want to create a view/table in mysql. I have two tables now: create table teacher( id int(10) not null auto_increment, name varchar(50), primary key(id) ); create table student( id int(10) not null auto_increment, name varchar(50), teacher_id int(10), primary key(id), foreign key(teacher_id) references teacher(id) on del...

PHP - Create simple animated GIF from two JPEG images?

Hi, Does anyone know if it's possible to generate an animated GIF from two different JPEG files, displaying one image for x seconds then the other, and so on..? Any advice appreciated. Thanks. ...

How to filter an array to remove parents with childs equal to zero?

Hi guys, i have an array structured like: $something = array( 0 => array( 'label' => 'Foo', 'items' => array( '123' => 4, '124' => 0, ) ), 1 => array( 'label' => 'Bar', 'items' => array( '125' => 5, '126' => 1, ) ), 2 => a...

Creating 2D-array from array with foreach-loops.

Hi, sorry for the vague title. I'm extracting some data from a table with the setup as specified below, using simple_html_dom. What I want to do is insert the data into a 2D-array (?), where the value of the first -field is the name of a subscription and the rest is data relevant to that subscription. <td><a href="/subname/index.jsp">Su...

What approach of functions shall I use

A very basic question it is but I wanted expert advice that is why posting it here. Here are two functions, what is the difference between the two ? Are both of them equivalently efficient and includes best practices or Which one of them is better to use in programming. function is_numeric($number) { if(!preg_match("/^[0-9]+$/",$...

PHP Convert timestamp to months and days

How can I convert a timestamp difference between 2 dates ( $diff = abs(strtotime($date2) - strtotime($date1)); ) to months and days quantity (ouput: $res = 4.05 -> 4 months and 5 days)? Thanks. ...

localhost != remote server

I've been developing / testing a site locally on a MAMP (e.g. LAMP) environment. I have a form that's processed by jQuery that works fine locally; I don't want it to be submitted, but to send the values to an AJAX function. The issue is that it submits to the 'action' destination of the form parameter when it's run on a remote server wi...

zend framework : set imap mail to read, or move it to a folder

Hi overflowers, After reading a message's state in Zend_Mail_Storage_Imap with $message->getHeaders(). How do I then set that mail as read? setHeaders(Zend_Mail_Storage::FLAG_SEEN); Thanks, Dan ...

Problems with formdata send via Adobe Reader to a php-script

I have created a PDF with Adobes LifeCycle and added some forms and a button to send the formdata to a php-script. On the serverside i grab the postdata and store them into a database. No problem so far, but the Adobe Reader now complains about an error something to do with the content of the text/html type. Here is the error message in...

PHP eval + gzinflate infection - what can the attack vector be?

When I came home today I found all my php files infected on godaddy linux hosting. The following code was inserted at the beginning of all files: /**/ eval(base64_decode("aWYoZnVuY3....") According to the logs the infected code failed to run: eval()'d code line 1: gzinflate() [function.gzinflate]: data error Nevertheless, I want to p...

MySQL query outputs odd rows only

I have the following PHP method that returns a JSON string from a MySQL query: $sys_words_ref_join_query = mysql_query(" SELECT user_words.*, sys_words.* FROM user_words, sys_words WHERE user_words.sys_words_ref = sys_words.sys_words_ref & user_words.user_info_ref = '1' LIMIT 0, 7 "); $json_array = array(); while($words_obj = my...

How to show images uploaded by a specific user in Phocagallery - Joomla?

I am using phocagallery to show images/pictures on my site and i am looking for a way to show a link to the user which leads the visiting user to see the albums created by a specific user. Currently I have found way to show the current user's photos etc. but i need a way to see some specific user's pictures. is it possible? If yes then h...

Use PHP script for "click" on link

Hi, I am solving an issue that I cannot figure out. I need to login and click repeteadly (thousand of times) on the specific link to create some load. I know I should use HTTP/PHP for that but do not know how to solve the login? My next idea was to use some packet sniffer and re-send the requests..but will it work when I would close the ...

Using actionHelper without returning layout in output

I call an action helper in one of my views using the following code echo $this->action('foo', 'bar'); The fooAction in the barController does its thing and outputs a list of pages. However, the list has the layout in the output again, which is mightily irritating. If I disable the layout in the fooAction, this causes layout to be comp...

Prototypal inheritance in PHP (like in JavaScript)

Is it possible to employ some kind of prototypal inheritance in PHP like it is implemented in JavaScript? This question came to my mind just out of curiosity, not that I have to implement such thing and go against classical inheritance. It just feels like a interesting area to explore. Are there prebuild functions to combine classical ...

trim url(query string)

I have a query string like the one given below: http://localhost/project/viewMember.php?sort=Y2xhc3M=&amp;class=Mw==&amp;page=9 Now variable: page in query string can be anywhere within the query string either in beginning or middle or at end (like ?page=9 or &page=9& or &page=9). Now, I need to remove page=9 from my query string and...

utf8_general_ci convertion

my script is using utf8_general_ci and im trying to transfer to another script that also uses utf8_general_ci the problem is my script store everything as is, like "áéíóú" and the new script as "áéà óú", so im having characters problems like "ru��es" how can i convert that? ...