php

Does the function "apc_store" reset the TTL values when replacing a cache key that already exist?

I current utilize the APC "apc_store" function as a means to replace items in the cache that already exists, but I'm not sure if the TTL gets reset or not. I'd like to have it so it does NOT reset the TTL values. ...

Share on Facebook shows incorrect image link

I am using Share on Facebook button with www.facebook.com/sharer.php?etc URI. However, I have some problems. Here's what I want to do. My site is kind of like a blog in which each blog has a lot of photos So when people click on Share on Facebook button, I want the users to be able to choose which photo to use as Facebook thumbnail. I'...

Are detailed exception/error messages a security risk?

I currently check every GET and POST variable with isset() and throw exceptions when isset() returns false. Example 1: if(!isset($_GET['some_var'])) throw new Exception('GET variable [some_var] is not set.'); $someVar = $_GET['some_var']; Example 2: if(!isset($_GET['some_num'])) throw new Exception('GET variable [some_num] ...

creating a user management using php mysql

I am trying to find a good example that can help me to understand user registration and then management system. User management should show the items from the db and give the option to delete/modify and also create a new. I would like to use php and mysql . can any one please point me to the right direction to learn and try this.i searc...

PHP pagination using glob to retrieve images

I'm trying to retrieve images from a folder using glob() and i want it to be paginated so it only displays 3 images per page. From digging around on the internet and here on S.O. i've got the code below. The problem is that it only pulls three images from the directory and when i click on the next page it shows the same 3 images. What ...

Change file upload size in linux server

Hi I have to upload a pdf file with 34MB. My site is in Linux with php. But my site support only 8MB. (I know this from phpinfo). How I increase the size? I heared that we can change it in php.ini through. htaccess. But where I get php.ini? How I change the size?. Does any one give me a solution ? ...

Is automatic initialization of class variables in PHP possible?

Hey, everyone. I couldn't find anything Googling this problem, and I've found really good answers to some questions on SO before, so I'm taking this excuse to join the community. I'm creating a hierarchy of classes for a PHP project I'm working on, and I'd like to have some variables in the classes initialized within the constructor fun...

serving different views in code igniter

Hi, I'm pretty new to code igniter. Is there best practice for serving different view for different context. For example, I'd like to serve specific pages for mobile user agents with the same controllers. ...

How do I test to see if I am sending a POST request correctly via Javascript?

Here's the particular situation: I'm using a bookmarklet to call a .js that sends a POST request to a PHP file on my server. Here's the POST request in the .js file: var snd = ("qu=" + encodeURIComponent(t) + "&dl=" + encodeURIComponent(dl) + "&dt=" + encodeURIComponent(dt)); xr = new XMLHttpRequest(); xr.open("POST", "http://quote...

PHP Regex Help for parsing String

I have a string such as the following: Are you looking for a quality real estate company? <s>Josh's real estate firm specializes in helping people find homes from [city][State].</s> <s>Josh's real estate company is a boutique real estate firm serving clients locally.</s> In [city][state] I am sure you know how difficult ...

How do I install Pdftk on my server?

I am using a Linux Server and am trying to install Pdftk, but I am problems trying to figure out what exactly to do. I found the following documentation on how to install it, but they refer mostly to installing it on the local Windows machine. They are: http://www.andrewheiss.com/blog/2009/07/29/installing-pdftk-php/ http://www.access...

JQuery Ajax post data not arriving

Hi folks, my Ajax post data is not arriving - any clues please. The data is a serilaized form that "alerts" correctly with all the data using this $(document).ready(function() { var serial = $('#frm_basket').serialize(); alert(serial); $.ajax({ url: "basket-calc.php", type: "post", data: serial, success: function(){ ("#baske...

2D array in PHP

how can I store $result value in a 2d array. here my code- $sql="SELECT a.userId, b.name, b.dob FROM tbltree a INNER JOIN tblprofile b ON a.userId = b.userId WHERE a.superId ='$uid'"; $result=mysql_query($sql,$link)or die(mysql_error()); 2d array having three columns-userId | name | dob ...

Handle error for duplicate entries - PHP MySQL

I have a PHP form which enters data into my MySQL database. My primary key is one of the user-entered values. When the user enters a value that already exists in the table, the MySQL error "Duplicate entry 'entered value' for key 1" is returned. Instead of that error, I would like to alert the user that they need to enter a different val...

How can I build a support ticket system with PHP?

Hi, I have a custom and simple php/mysql based user system. I'm trying to build a way for members to send product support to our staff (put it in a database, & viewed in admin area) and for them to manage these messages (lack of a better term). My question is, does anyone know of a good existing script, or a better approach for a suppor...

resusable function in codeigniter

Almost in all function in most of my controller i have to see to same things. i.e 1.Check if logged in. 2.Check the privilege. I know how to do it. But what is the best way, so that i don't have to re-write the same code everywhere? Is it to make a helper or something? I'm a bit new to codeigniter, all i know is basic php! ...

how to clear the query string in PHP.

How to Clear the Query string. my query string is "index.php?name=sugumar&id=49" using meta tag I redirect the same page. that time the query string values are not cleared. for that I have used. Request.QueryString[1] = string.Empty; but it shows the error. syntax error, unexpected '[' in /home/sugumar Then I used ...

Python/Caml/Scala/YourSuggestion to PHP translator?

Hi! I'm looking for a translator of the source code written in some decent language to PHP. Ideally, the target PHP code should be human readable, cuz I'm not the only person working on the project. But the matter is, I would like to facilitate my personal developement process by bringing a high level language still allowing for easy m...

File upload works on windows, but not on linux

I created a controller which handles file posts, moves uploaded files to a folder beside the index.php file (not in the application folder, because I want to reach the files directly through http). The upload works perfectly on Windows based servers but not on Linux. PHP version is still the same on every server, and my local machine. ...

How to get Apache request thread handle number with PHP?

How to get Apache request thread handle number of current executing PHP script in that script? Platform: Windows, PHP<5.3 ...