php

How do I secure user registration?

What is the most secure way of registering new users? I know SSL is a good pick. But can I have SSL on user registration only? Take Wordpress for example. User registration is at http://en.wordpress.com/signup/. And the user registration form is sent to https://en.wordpress.com/wp-login.php. The same goes for login. How can I make ju...

Views: Including multiple views in one view

I developed an application with different MVCs using the Yii Framework For example I created a crud layer for Student Contact details and Student Courses etc. All worked perfectly since each had its own menu, and when clicked eachs own view rendered. Now my client wants everything on one page, and is quite persistent, we are talking ...

Pattern Match on a Array Key

Hi. Since I'm finding this site helpful I thought I'd sign up :) I need to get the stock values out of this array: Array ( [stock0] => 1 [stockdate0] => [stock1] => 3 [stockdate1] => apple [stock2] => 2 [ stockdate2] => ) I need to pattern match on this array, where the array key = "stock" + 1 wildcard character. I have tried us...

Soap Web Service PHP

Is it possible to send a complexType to a SOAP web service by creating the complexType locally, i.e. create the type by creating a class and then sending the instance of that class back to the service? Admittedly this is only possible if I can get the definition of the type from the service provider. I'm looking to send a complexType b...

mysql connection closes after a certain time? (PHP)

Hey guys, I have a script that takes several minutes to execute. The mysql connection is established at the beginning (mysql_connect), then a loop with some queries follows (mysql_query). That loop lasts very long, and after a few minutes the script throws a warning that the mysql server has gone away (Supplied argument is not a valid ...

Share session data between Rails and PHP

I have a Rails application that uses ActiveRecordStore for sessions. I need a PHP application running on a subdomain to share the session. I have updated the environment to allow session cookies to be accessed across subdomains, but I don't know what the php application will have to do to access the session data. Please could someone he...

PHP Array overwriting values but need to add to array

The array: Array ( [0] => Array ( [0] => Service Simulators [1] => Array ( [0] => 1.php [1] => Title 1 ) ) [1] => Array ( [0] => Service Simulators [1] => Array ( ...

PHP call_user_func vs. just calling function

I'm sure there's a very easy explanation for this. What is the difference between this: function barber($type){ echo "You wanted a $type haircut, no problem\n"; } call_user_func('barber', "mushroom"); call_user_func('barber', "shave"); ... and this (and what are the benefits?): function barber($type){ echo "You wanted a $ty...

Drupal: Complex filtering/sorting using Views Fast Search module

I'm working on a Drupal 5.x book-selling site and using the Views Fast Search module. In the search results, the client wants the user to be able to choose (from a select box) from a variety of displays, e.g.: sort by bestselling book, sort by word count, sort by most recently added, etc. Some of these are straightforward but others ...

How can I scan/fuzz my code for vulnerabilites?

I'm looking for an automated way to fuzz my app or scan it for vulnerabilities. Please assume that my hacking knowledge is 0. Also the source is on my localhost so I need a way to fuzz it locally without relying on an internet connection. Can some security experts give me some hints or recommendations? I'm not sure what options are best....

__call() function in CakePHP?

hi, is __call() function availabe in CakePHP? I used this fucntion in Zend Framework. class UsersController extends AppController { function home(){ /*some action*/ } function __call($m, $p){ print_r($m); print_r($p); } } getting erro like this Missing Method in UsersController <?php class UsersController extends AppController { ...

Count parents backwords in one SQL Query?

I have a MySQL database (created by Wordpress) and this is similar to what it looks like: ID parentID otherStuff 54 55 this is a test 55 56 another test 56 0 last test What I need to do is to check how deep down a page is. I know that when it reaches parentID 0 it's finished. I could wri...

amazon short url regex... why can't i get this to work

here is a regex i got from: a blog i can't link to because i am new... just google amazon short url and click on the blog post by noah coad as you can see from this page... it is supposed to extract the unique product id from any amazon url so you can shorten it... or use it to pull info from amazon apis. here is the sample code i am t...

Xpath Query on HTML page - syntax?

Hi I have this URL:- http://ask.recipelabs.com/users and I wish to find the highest page number in the div id 'pager' (in this case it is 7) I have tried this but it returns zero: function getusers($url) { $doc = new DOMDocument; $doc->loadhtml($url); $xpath = new DOMXPath($doc); $nodelist = $xpath->query('//span[@class="page-numbe...

Transferring data from PHP to Java

I have an XML file which I need to parse using PHP and send the parsed data to Java, what are some best practices to accomplish it ? ...

PHP - Find if any of the keywords in an array exist in a string

Hello, and first of all, thank you for taking the time to read my question. Basically, I have an array of keywords, and a piece of text. I am wondering what would be the best way to find out if any of those keywords are present in the text, bearing in mind performance issues. I was thinking of just looping over the array and doing a str...

php profiling: what results are normal?

As testing server, my computer (Windows 7, Amd Athlon X2, 1 GB RAM) is used. My application is based on Zend Framework. It uses MySQL and Zend_Translation, and Memcached as cache. I'm getting execution time of my PHP application with simple microtime(): Execution time 0.086215972900391 (when db and translation data is cached) I want t...

PHP - Split a string

Hi all, Another n00b question. $ab = "A00000001" echo $a; // gives result "A" echo $b; // gives result "1" $ab = "B01250" echo $a; // gives result "B" echo $b; // gives result "1250" What's the easiet single way to convert "ab" to "a" and "b" in both examples above? Thanks! ...

PHP and Windows 7 error reporting

i have installed php 5.3.0 on windows 7 & IIS and i configure it for CGI i fond a great article at http://www.hauser-wenz.de/s9y/index.php?/archives/280-Installing-PHP-on-Windows-7.html its really easy and it works (thanks who have uploaded this) php run fine, but problem is when there is any error in script instead of getting err...

How do you consistently retrieve the path information from the query in php? (/index.php/foo/bar)

Basically if the user requests: index.php/foo/bar I need "/foo/bar" and for index.php I need "" or "/" I couldn't find any information on google because I don't know what this is called (path info got me the pathinfo() function) I found PHP_SELF returns differently if there is path info than if there is no info ...