php

adding a function to php.ini

I used the function htmlentities() in my php script, but the server says: "undefined function" After some searching, I understand that the php installation on my webhost does not include that function, and that I can add the function by changing the php.ini file, but I have spent many hours searching, and have not found any information ...

PHP MySQL INSERT return value with one query execution

Is there anything returned from MySQL/PHP on a INSERT query being executed? Here is my function which I have in a CLASS. function mysqlQuery($query) { // Gets the results from the query $results = mysql_query($query, $this->connection); // Loops through the queried results as an multi-dimensional array while($rows = mysql_f...

How to use a PHP includes across multiple directories/sub directories with relative paths

I'm having difficulty with paths in a cms system I'm attempting to build, I've basically got a folder with my header.php and footer.php files inside. These are included in index.php and work fine. But then when I attempt to use the same includes in a file within my admin sub directory, the images and CSS are broken, obviously because th...

Seamless SSO authenticating against Active Directory

I have a webpage that I only want a specific group to log into. I work at a college and we use Active Directory accounts and only a certain group can access this php page (on apache server). I know I can restrict access with some PHP code, but I want to accomplish seamless login. Everyone uses IE7 at work (which are configured to pass...

php random name

HI Whats the best way to create a random name for a folder? Its going to be used for a folder name to store documents. But lots of folders are going to be created and so need it to be unique each time if possible. Length should probably be around 7 characters. ...

PHP session save_handler user (mysql) won't save

Hey guys, here's what I'm attempting: PHP sessions work by default with my configuration, if I just go session_start() and try the standard session increment test it works. if (!isset($_SESSION['count'])) { $_SESSION['count'] = 0; } else { $_SESSION['count']++; } However I want to use a MySQL table for session storage. I've ...

Make Apache wait longer before delivering HTTP 408 request timeout

My configuration: Apache 2.2.4 PHP 5.2.4 (fastCGI) Windows XP pro I have a script that takes more than a minute to run but after exactly 60 seconds (proven by Fiddler) the server always delivers a 408 timeout. My PHP max execution time is set to 120 seconds. After doing some reading I've tried putting a "Timeout 120" directive in my A...

CakePHP authentication breaking after an incorrect login

I have a simple login form, username and password. Basically, When a user is anywhere on the website, he can click a link that will take him to the login page. After login, he is redirected to the page he came from initially. The problem: let's say I was in the "/posts" page, and I clicked to login, so now I am on "/users/login". - if...

Why doesn't my parent process wait for its child to finish executing?

I have the most basic script: $pid = pcntl_fork(); if ($pid == -1) { die('could not fork'); } else if ($pid) { // we are the parent echo "parent done"; pcntl_wait($status); //Protect against Zombie children echo "all done"; } else { // we are the child echo "Child finished"; } When I run this, the ou...

How can I take fullscreen screenshot of website

I need to get fullscreen shot of website by URL, is there any PHP programs for that or services, if not, is there any Java programs for that purpose? ...

Coldfusion equiv of PHP strtotime() ?

I'm relatively new to CF / Flex3 and I've been tasked with making mock applications in order to get my knowledge of the 2 languages up. I'm creating an application where I require data back 1 week (strtotime equiv '-1 week'). So that the result is always 1 weeks worth. Whats the comparable equivalent if any for coldfusion? If none, h...

How do you redirect a page with PHP when a person signs out?

How do you redirect a page back to the home page using PHP when a person signs out. I know there is multiple ways to redirect a page with PHP, but what is the best way? If you can please leave a code sample. Thanks. ...

How can I get the vbulletin logout hash on another page? (PHP)

I want to get the logout hash for vBulletin so that I can link to the logout bit directly from my main site. How can I do this? (in PHP) ...

PHP - Compare exploded word with mysql varchar in PHP

How can I compare exploded word with mysql varchar in PHP? This code produce what i want but it also give this error veranderenwachtwoordjij Fatal error: Call to a member function fetch_assoc() on a non-object...... $word = "Also, to be safe, change your password regularly... you don't have to be obsessive about it: every three hours o...

What is the best method for sorting columns with PhP and MySQL?

Hello, I would like to know which is the best way to sort table columns with PHP and MySQL. Is there a way to do this without having to set a variables like the following? $strASC = $_GET["order"]; if ($strASC == "ASC") { $strASC = "DESC"; } or does exist an SQL query that reverses the ASC or DESC depending on current status? ...

How to keep two development databases in sync with Doctrine?

(Make this CW if needed) We are two developers working on a web application based (PHP5, ZF, Doctrine, MySQL5). We are working each with a local webserver and a local database. The database schema is defined in a YAML file. What's the best way to keep our database schemas in sync? Here's how we do it: Whenever developer "A" makes a ch...

cakePHP and mail component: Connection refused: 61

Greetings! I'm trying to add simple mail functionality to a little web app and I'm stuck. I'm able to send email from the terminal to myself on local machine just fine, but when I try to run the app I get "Connection refused: 61" At first I thought my setting are messed up, I kept playing with them for a while and for now decided to giv...

Is there a way to adjust a web pages height with PHP to adjust with a browser?

Is there a way that you can use PHP to automatically fit a web page into the size of the browsers window? ...

share php session

hello everyone. I recently ran in a problem and I've been trying to resolve it with out any luck. I'm, trying to share the php session across several servers php/apache level on all server using GlusterFS,however, although the session is accessible on all servers the session does not get transfer once I hit a different sever. I get logg...

Using PHP filter functions like filter_var_array() is there a way to check if length of an input string is less than some value

I have been toying with PHP filter library. I liked it but I am unable to perform a simple filter function. I essentially want to invalidate those values in my input array that are strings and which are longer than certain value. Is there a way to do this like, $data = array('input_string_array' => array('aaa', 'abaa', 'abaca')); $args...