php

Using a randomly generated token for flood control.

Basic setup of my site is: user enters a message on the homepage, hits enter and the message is sent though a AJAX request to a file called like.php where it echo's a link that gets sent back to the user. I have made the input disable when the user presses enter, but there's nothing stopping the user from just constantly flooding like.p...

how not to update timestamp field

project is written on php. There is timestamp field in mysql it updates automatically. In one case I don`t need update this field. Can I gibe instruction not to update this field in this queries without getting timestamp value. ...

xdebug in netbeans won't bind to port 9000

I've been trying to configure xdebug to work along with netbeans, my current configuration is [xdebug] zend_extension="C:\binaries\php\ext\php_xdebug-2.1.0RC1-5.3-vc6.dll" xdebug.remote_enable=on xdebug.remote_handler=dbgp xdebug.remote_host=127.0.0.1 (also tried localhost) xdebug.remote_port=9000 xdebug.idekey="netbeans-xdebug" I ...

PHP GET Request, sending headers

I need to perform a get request and send headers along with it. What can I use to do this? The main header I need to set is the browser one. Is there an easy way to do this? ...

PHP - getting content of the POST request

I have problem with getting the content. I don't know the names of the post variables so I can't do this using = $_Post['name'] because I don't know the "name". I want to catch all of the variables send by POST method. How can I get keys of the $_Post[] array and the values related with them? ...

cURL Cookies and Facebook

I have a script that pulls information from a facebook page. Information that isn't available using opengraph but it's something my client has requested for their pages. Anyway, is there any way to use the cookies from the browser in the cURL script? At the moment when you run the script it asks you to log in. But I am already logged i...

how to compare dates in php and sql?

Hi, I want to make a notification system. Shortly.. to compare two dates, the only problem is that i want to compare the months. to see if a month or two have passed from last notification. i want to use one or two months from an entry in a mysql database. the client must select when the notification must come, one or two months. th...

Problem Viewing PDF in Browser

hi everybody, I have a link in my page : <a href="sharedfiles/general.pdf"> View PDF</a> The problem is that when the link is clicked, Instead of viewing the content of the file in the browser, the file is downloaded . Any ideas what's wrong? ps : I have Mozilla FireFox 3.6 & Adobe Reader Installed ...

PHP/PAM to change user password?

Are there any working packages to change a linux user passwords using PHP? I've tried using PECL:PAM but theres an error when it tries to change the password. Edit: PHP code: echo pam_chpass($username, $password, $new_pass, &$error) ? 'good' : $error; PHP (echo) output: Permission denied (in pam_authenticate) From /var/log/aut...

Drupal Autoresponder with Token Module

Hi All, I'm using Drupal autoresponder module - and I want to use tokens so I can include the username who has subscribed within the emails being sent... Does anybody know how this can be achieved? Thanks for any help. Shane ...

Purpose of PHP constructors

Hi, I am working with classes and object class structure, but not at a complex level – just classes and functions, then, in one place, instantiation. As to __construct and __destruct, please tell me very simply: what is the purpose of constructors and destructors? I know the school level theoretical explanation, but i am expecting som...

direct file download protection

Hi, I have a folder for downloads on my server, i want to prevent direct access to that folder so i am makin it pass-protected with htaccess and i will push download with a php script. But i have some questions regarding mkdir and file_exists Do mkdir and file_exists works good for pass-protected folders ? and would i get any error w...

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Can someone please help as i've spent all day trying to fix this. I installed the latest XAMPP and now i can't connect to mysql from terminal.I checked my .profile file and the PATH seems ok. Does anyone know whats happened and what's the solution? PATH=$PATH:/Applications/XAMPP/xamppfiles/bin export PATH THIS IS A PROGRAMMING QUESTION...

Check if db connection is closed - php

Db connectivity is handled by an include. I want to run this command: mysql_close($con); Only if we currently have a connection. Something like isset()? Thanks Hamad ...

Turn key-less array to associative array

The following code outputs would where we expect it to output 12/5/10. The reason is array_search only works on associative arrays and explode returns a key-less array, so $k is false and $k+1 is 1. $s = 'We would like to book a double room form 12/5/10 for three nights.'; $s_arr = explode(' ', $s); $k = array_search('from', $s_arr); $f...

Opinions sought on the best way to organise classes in PHP

I am pretty much set on using the Java package naming convention of com.website.app.whatever but am unsure about the best way of doing this in PHP. Option 1: Create a directory structure com/ mysite/ myapp/ encryption/ PublicKeyGenerator.class.php Cip...

What is the difference between JSON and JSONP?

Possible Duplicate: Please explain JSONP For example in the jQuery documentation I find both JSON and JSONP mentioned. What is the difference exactly? How can I see which is which? Which one should be used for what? And what does the PHP function json_encode generate? ...

document.getElementById('form_name').submit() not working properly

Ok, I will try to give the most details I can. The site is not suposed to work with IE6. It would be nice if it worked with IE8 and Chrome, but that can be done later. The site is in PHP. The form where the submit is in another PHP file that is included in position on the index.php inside of a DIV tag. If I open the form solely, the s...

Has anyone used HipHop for PHP?

I was wondering if anyone here has used HipHop? If so what do you think about the technology? Is it real world? What problems have you run into? Should I compile my production application using HipHop? ...

Assign a custom global pseudo variable in Code Igniter like {elapsed_time}

Hello As you probably all know Code Igniter can assign pseudo variables using the Parser library, but you also know that if we want to assign a Pseudo Variable to use it in a View, we have to do it in every controller that loads those views with the pseudo variables. I would like to know if Code Igniter 1.7.2 has some way that i can as...