php

Create your own hash in PHP ?

Well, I need to save images with unique filenames and store the file names in the database. I used to do MD5 hash and save the image with the filename of value obtained by hash. However I would like to cut down the unnecessary space usage from 32 characters to 10-12 characters. I dont want to substr() the obtained md5 hash to 12 charac...

Adding tasks to Windows scheduler with PHP

Hi, I'm unable to find any information on adding tasks to Windows Task Scheduler with PHP. I can use exec(). This has to work on IIS. ...

Writing curved text on an arc (PHP)

So I Googled and found out how to draw an arc: http://www.php.net/manual/en/function.imagearc.php The only problem is how do I write text $margin pixels from the arc that is curved. Centre aligned @ $degrees. Here is an example: http://img194.imageshack.us/img194/3667/scan0001fe.jpg Let me know if this doesn't make sense. ...

Wordpress the_author() and wp_get_archives() not working

Hi all, Firstly, I'm not fresh faced with WordPress, I've been actively using it for various light-weight custom CMS since the early 1.x line. I'm using a fresh build of 2.8.6 for a very, very simple blog build. Only one category and only one 'single' template. There's no other functionality, so the site only really requires the index....

Problems with behaviors in Doctrine

Hello Stack Overflow! I have a problem in one of my projects, where I'm using Doctrine as an ORM. For some reason, when rebuilding the models and database structure, Doctrine ignores the behaviors and relations, I define in one of the table definitions. The YAML table definition looks like this: ... User: actAs: Timestampable...

Defining a variable in a js file, from a php file.

I have a javascript file that needs a value from a variable in a php script in which the JS file is being called. <? $sid = session_id(); ?> <html> <head> <script src="javascript.js" type="text/javascript"></script> ... How can i get $sid into the js file for use? ...

find word before second comma with regex

I want to store the word before the second comma in a string. So if the string looks like this: Hello, my name is David, bla bla. I want to set a variable $test = David ...

Is HTMLPurifier really that bullet-proof?

Hello All, I saw Kohana framework allowing users to optionally use HTMLPurifier against any possible XSS attacks. I thought HTMLPurifier was meant to allow standard-compliant output of the HTML. Does it help avoid XSS attacks 100% or probably to great extent? Or you would suggest something else. Thanks ...

How to implement real time sub domain in PHP?

Suppose domain is domain.name, after a new user sign up,need to generate a new domain:user1.domain.name. How to implement it? BTW,is there a limit for the number of sub domains? ...

resume the broken upload

How to manage to write an application (JS + PHP) that would let the user resume the broken upload so as not to reload it? N.B. No frameworks are acceptable. ...

MySQLI binding params using call_user_func_array

Hello, Please see below my code. I am attempting to bind an array of paramenters to my prepared statement. I've been looking around on the web and can see I have to use call_user_func_array but cannot get it to work. The error I get is: "First argument is expected to be a valid callback, 'Array' was given" I may be wrong but I'm assumin...

how to protect server directory using .htaccess

I have designed a website, and within it I have a range of PHP scripts which interact with my system. For example, if a user uploads an image, this is processed by the script image.php and if a user logs in this is processed by the script login.php All these scripts are stored in the folder called: scripts how do I ensure someone...

problem is select in mysql

hi my friends now i have table call files its have time has this stamp 1260606325 now i tring to get the files which added in the last 7 day SELECT * FROM `files` WHERE time > SUBDATE(NOW(),604800) its return zero how i can do that ...

How to stretch image programatically?

There is a vertical bar on my homepage. It is actually an image that looks something like this: The white boxes are the place-holders for the product images that will be added dynamically. I want to know how to stretch the blue vertical bar as new product images are added. This must be done programatically. ...

[php] return json string with html characters?

i want to call a php with jquery ajax to perform some database things and then return 2 lists of links. so i have to pass these two link lists back to jquery so it can display list 1 in the left side of the webpage and list 2 in the right side. i created the lists in separate arrays that i send back to jquery with json_encode but i noti...

XPath to get only the text from within an element (PHP)

Hello Apologies if this has been answered before. I've been trying to construct an XPath expression to retrieve only the text portion from an element such as this (containing text as well as other elements) ... <td id="test"> The text I want. <table> Things I do not want ..... ..... </td> I hav...

Amazon S3 File Uploads

I can upload files from a form using post, but I am trying to find out how to add extra fields to the form i.e File Description, Type and etc. Also can I upload more than one file at once, I know it says you can't using post in the documentation but are there any work arounds? Thanks in Advance ...

Problem with function session_start() (works slowly).

Hi. I have a problem wtih session_start() on primary server. When I load page for the first time, it takes less than 1 second to complete request. If I'll wait for approximately 12-15 seconds and then reload page, time of loading will be the same. But when I'm trying to refresh page after, for example, 3 or 5 seconds after initial loadi...

how i cant select from mysql without duplication

my problem is too complex now i have files table I selected from it the files which added in last seven days. it returns many ids like 1,2,3,4,5 ok it's great. Now the problem: i have tutorial table every tutorial has some files of files table now i selected from files which last added from 7 days and make list ordered by files do...

how get php total time?

hello all, i have created work total time program in PHP - give input time - 1.30, 2.10, 1.40 and get output time - 4.80(8 hrs). but i need output time - 5.20(8.40 hrs). Notes: 1.30+2.10+1.40=4.80(8 hrs), but i need 5.20(8.40 hrs). please help me... ...