php

Is creating a separate table for each form a smart way to create forms?

I am doing an application like Form builder in Cakephp. I've created the module for Designing the forms. Is it a good way to create a separate table for each forms in the case of form building? ...

How to read a list of files from a folder using PHP?

I want to read a list the names of files in a folder in a web page using php. is there any simple script to acheive it? ...

ZF: performing redirect inside model

I've chosen to move Form processing from Controller to MyForm class, in order to follow ThinController/FatModel rule. But some of my code in Zend_Form class needs to perform a redirect. In Zend_Controller_Action my redirect was: $this->_redirect('/'); What would it become in Zend_Form? ...

What is wrong with my link generated from PHP?

In my code I am just hyperlinking to an anchor tag for a PHP function when I click My code is below, another.php is called by AJAX, index.php from JQuery. another.php <?php echo " <a href='my.php?action=show&amp;id=".$fid."' onclick=\"return display('".$fid."');\"> "; echo "" .$fname."</a> "; ?> The hyperlink does no...

PHP : Creating image from html table

Can I get some sample code in PHP for converting an html table to image form(.gif,.jpg or any format)? I am using XAMPP on Windows. Yes, the table is coming from the database. ...

Is a mysql user defined function suitable for signing Amazon S3 url?

Hi, I need to retrieve a result from a mysql database using a user defined function that recreates the following PHP code - $signature = urlencode(base64_encode((hash_hmac("sha1", utf8_encode($string_to_sign), awsSecretKey, TRUE)))); Are UDF's up to the job? What are the security implications for storing the AWS secret key in the U...

php accelerator review

1) Can you recommend me a PHP accelerator for PHP V5.2.6? 2) Do you know about any recent test comparation/review of those modules(Alternative PHP Cache, eAccelerator, XCache, Zend Optimizer, Zend Platform, ionCube PHP Accelerator, Turck MMCache, Nusphere PhpExpress)? ...

Querying data for a Facebook-like news feed

I have a social networking site where users update their moods, profiles and add photos. I'm currently logging all updates in a table called "update_log" with the following structure: update_id int (auto), userid int, update_type int (1=profile, 2=photo, 3=mood) pictureid int mood_a int mood_b int mood_c int update_time int Profile...

sprintf outcome problem

Here is my code: <?php $variable1 = 00001; $variable2 = (sprintf('%04d', $variable1 + 1)); echo $variable2; ?> How come the outcome of this code is "0002" and not "00002"? in other words it is missing a 0. ...

How can I have a PHP script run a shell script as root?

Running Fedora 9/10, Apache 2, PHP 5... Can I run a shell script as root, from a PHP script using exec()? Do I just give Apache root priveleges, and then add "sudo" in front of them command? Specifically, I'm trying to start and stop a background script. Currently I have a shell script that just runs the app, start.sh: #!/bin/bash ...

PHP include files with periods in file name

Is there a problem with some versions of PHP and file names which look like this: report.class.php I tried to use one and it failed once and worked once, but I can't replicate the failure. So I'm not sure exactly what the cause is, prefer using the period-separated filenames, but would strongly prefer not to be using "fragile" file na...

PHP and OpenID = 500 error

Having a really strange problem. Scenario: PHP5.2.9, IIS7, PHP running as FastCGI. I have a site at test.concentratedtech.com. Click login, enter OpenID credentials, hit "Verify," and immediate 500 error. Click Back, resubmit the page, works fine. An IIS failed request trace reveals two messages, below. These messages seems to general...

Can HTML be embedded inside PHP "if" statement?

I would like to embed HTML inside a PHP if statement, if it's even possible, because I'm thinking the HTML would appear before the PHP if statement is executed. I'm trying to access a table in a database. I created a pulldown menu in HTML that lists all the tables in the database and once I select the table from the pulldown, I hit the...

Avoiding form resubmit in php when pressing f5

I have the following code on my site (using php and smarty) to try and avoid a form resubmitting when I hit f5: if ($this->bln_added == false) { if (isset($_POST['submit'])){ $this->obj_site->obj_smarty->assign('title',$_POST['tas_heading']); $this->obj_site->obj_smarty...

fetching an Integer from DB using Zend Framework returns the value as a string

When I run an sql query using the ZF wrappers, all the numeric values return as strings. What do I need to change so the values will return in the same data type as they are in the DB? ...

php function that returns a mysql query

I have a really simple function: function experience_query($id) { $sql = @mysql_query( " SELECT * FROM table WHERE id = $id "); return("$sql"); } When I call this function: $q = categories_query("1001"); while( $list = mysql_fetch_assoc($q) ) { extract($list); echo $name; } I am getting an error" "mysql_fetch_assoc(): supplied arg...

Variable into Header Location

How can i include a variable and make it part the string. header("Location: http://www." . "$_SESSION['domainname']"); The above code doesn't work. ...

Can PHP be used without $ for variables?

Is it possible to name variables in a Java-like manner in PHP, such as by removing the need for a $ sign each time? If so, how can I enable the setting which does this? ...

SSL socket php code needs to be converted to Java

I have a Pem file that I use with this php code to connect to a c++ SSL server, but now I need this php code written in Java $ctx = stream_context_create(); stream_context_set_option($ctx, 'ssl', 'local_cert', 'cert.pem'); stream_context_set_option($ctx, 'ssl', 'passphrase', $pass); $fp = stream_socket_client('ssl://serverURL', $err,...

Simple_XML cross-domain file access disabled

I need to retrieve an XML file from another domain I own from PHP. I'm using simple_XML to do it but, apparently, cross-domain is disabled: Warning: simplexml_load_file() [function.simplexml-load-file]: URL file-access is disabled in the server configuration I have no access to server's config (shared hosting). Any clue on ...