php

Jquery problem with plugin

Hello, I have PHP page where users can upload photos (using Ajax & PHP script). Those uploaded photos (thumbs) are shown after upload in DIV below upload field and fancybox plugin (I'm using it for popup window for photos) is working ok then. Then, after hitting send button I want to clone that DIV at that same page at message board, b...

Trying to validate captcha with javascript before sending to php form validation

Hi I'm a relative newbie. Have a mail contact form set up with a captcha image generator. When the captcha is verified, on submitting the form, a php page is actioned which further validates the input data (checking against spam). Challenge: would like to retain form data in case of error in enterred capthca code and needing to return ...

dynamically generating images in PHP sometimes isn't working

I have a page that needs to load several dynamically generated images. Everything works fine 90% of the time, but sometimes some of the images are not generated (I just get the missing image icon instead). Since most of the times it works, and the missing images are not always the same, I think that maybe it has something to do with the ...

How to embed images in a single HTML / PHP file?

Hi, I am creating a lightweight, single-file database administration tool and I would like to bundle some small icons with it. What is the best way to embed images in a HTML/PHP file? I know a method using PHP where I would call the same file with a GET parameter that would output hardcoded binary data with the correct header, but that...

Does Zend framework's modular approach have good logic behind it?

Zend framework is pretty fast growing, we all agree and we all had been surprised while trying out the modular structure of Zend Framework, if to be concrete the bootstraping of the modules - all the bootstrap files of the modules are executed in the beginning no matter if we are using/accessing that module or not. As far as I remember t...

How do I get the local system time in PHP?

Hello, I'm writing a PHP system and I need to get the system time. Not the GMT time or the time specific to a timezone, but the same system time that is used by the CRON system. I have a CRON job that runs every day at midnight and I want to show on a webpage how long will it take before it runs again. For example: Right now it is 6pm ...

setting scope of array_map php

hey all, i use array_map from time to time to write recursive methods. for example function stripSlashesRecursive( $value ){ $value = is_array($value) ? array_map( 'stripSlashesRecursive', $value) : stripslashes( $value ); return $value; } Question: say i wanna put this function in a static class, how would i use...

Tracking file complete download

Hello, I have a file hosting site and users earn a reward for downloads. So I wanted to know is there a way I can track whether the visitor downloaded whole file so that there are no fake partial downloads just for rewards. Thank You. ...

what are aliases in ldap

What are aliases in ldap (referenced for example here php.net/ldap) Are they pointers to other objects in the system not directly under the object where the alias is found? ...

Am I breaking any "php good practice" in the following php array which deals with 3 (human) languages?

This is the most optimal way of dealing with a multilingual website I can think of, right now (not sure) which doesn't involve gettext, zend_translate or any php plugin or framework. I think its pretty straight forward: I have 3 languages and I write their "content" in different files (in form of arrays), and later, I call that content ...

Sphinx error: unknown local index "INDEX_NAME" in search request

Hello Im using Sphinx 0.9.9-release (r2117) and sphinxapi.php (http://code.google.com/p/sphinxsearch/source/browse/tags/REL_0_9_9_RC2/api/sphinxapi.php). When I testing searching in command shell: "search -i INDEX_NAME test" everything is perfect, but when I connect to Sphinx by sphinxapi.php this error occur. sphinx.conf is configure...

Check if the time is past 9pm using PHP

What I am trying to do is I have a selected date formatted as below: $selectedDate = 2010/02/24 I want to check it is both todays date and it is past 9pm on the server and set a value if it is. I can get a time by using the following: $checkTime = date("H:i"); I want to create something like: if ($checkTime > 21:00 && $selectedD...

How secure (hardened) is this script (part 2)

In my previous question on this topic, what would the implications be if I removed the dynamic variable and instead replaced it with a static one like you see below... $source = 'http://mycentralserver.com/protected/myupdater.zip'; I've included the code below for convenience... <?php // TEST.PHP $source = 'http://mycentralserve...

Defining class constant in PHP

I would like to define a class constant using a concatenation of an existing constant and a string. I can't predefine it because only scalars are allowed for predefining constants, so I currently have it as part of my constructor with a defined() function checking if it is already defined. This solution works but my constant is now unnec...

php ini_set expose_php

I am trying to get expose_php to off with ini_set, except it seems to not be working. I tried the value 0, and Off, but neither work. ini_set('expose_php',0); help? ...

POSTing XML via HTML Forms

Hi! I am developing a Web and want that the user could create some stuff POSTing xml data. For that propose there is a < textarea > where the user can write (copy/paste) xml and submit it. The problem is that I am loosing data, characters such as '<','>' and i think others too get lost. Maybe it is a framework problem, not sure, I am u...

PHP How to check if you can afford it?

Hello. I have this: $scCost = $row["gpsc"]; mysql_query(" UPDATE member_profile SET points = points-$scCost WHERE user_id = '".mysql_real_escape_string($userid)."' ") or die(mysql_error()); That takes do the user´s points - scCost. How do i check if the user can afford it or not? So, if the user...

PHP: Allowing Public and private access to files?

I am building a site that is permissions based. The user can add or remove read permissions to the public for pages as well as files. What is the best way to serve files that are protected, using php? I have seen things like www.mysite.com/download?file=filename.jpg or something like that, but I prefer clean paths. Also, if my files ...

CodeIgniter Pagination Problem

Hello all, I am using codeigniter and its pagination class. It works perfectly and it looks something like this: « First < 1 2 3 4 5 > Last » Here is my code: $this->load->library('pagination'); $config['base_url'] = base_url().'controlpanel/'; $config['first_link'] = 'First'; $config['total_rows'] = $count; $config['per_page']...

Analyze every function I call

Hy guys. I want to analyze the result of each function that I call. If this result is a exception or is false then the script ends. I can do this manually, but it is a big waste of time to call a control function for each new function. Something like this: http://codeviewer.org/view/code:c5c Can I configure PHP to set this error ...