php

[Cakephp] Save inside loop

Hello, I created a function that has a infinite loop and a delay at the end to make sure it will only execute one time per second. This function is in a shell class and its goal is to save/update records in three different tables and I invoque it from the console line using the command 'cake className' My problem is: I stop the loop ...

Detect and filter user input depending on charset

Hi, I am trying to filter user input depending on their charset. I am displaying keywords from user inputs to other users but to not want to display e.g. arabic or chinese characters but only english/latin characters. How can I do that with PHP? Is there a easy solution on doing this? Thanks. ...

ImageCreateFromString and getimagesize in PHP

Currently if a user POST/uploads a photo to my PHP script I start out with some code like this getimagesize($_FILES['picture1']['tmp_name']); I then do a LOT more stuff to it but I am trying to also be able to get a photo from a URL and process it with my other existing code if I can. SO I am wanting to know, I f I use something like...

Trouble with Email Attachment in mail()

I'm trying to email an image on my server as an attachment. To accomplish this task, I used the following PHP script which grabs a JPG (called "php.jpg") located in a directory called "screenshots" from my server and sends it as an attachment. <?php $path = "screenshots/php.jpg"; $fp = fopen($path, 'r'); do //we loop until there is no ...

php 5.2.12 Maximum execution time when using include()

Anyone got a problem with php 5.2.12 getting a lot of " Maximum execution time" error when trying to include() files? I can't seem to find the bug in php.net, but it's consistently giving us that error on numerous scripts. Anyone can recommend solutions? The same script runs on a few other servers with php 5.2 without any problems. So...

nodeValue from DomDocument returning weird characters in PHP

So I'm trying to parse HTML pages and looking for paragraphs (<p>) using get_elements_by_tag_name('p'); The problem is that when I use $element->nodeValue, it's returning weird characters. The document is loaded first into $html using curl then loading it into a DomDocument. I'm sure it has to do with charsets. Here's an example of a ...

Saving a transparent image from a URL in PHP

I am trying to build a class that does many photo operations, one method will uplaod images from a user but I am also needing to build a method to grab a photo from a URL and run other methods on it just like if it were being uploaded with a POST form from user. Below is my start of the function for getting image from URL, it works but ...

Url Matching using Gruber's regex in PHP

how do I get the regex mentioned in this article working with preg_match in php? <?php preg_match("\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))/i", $text, $matches); print_r($matches); ?> Using the code above I get the following error: Warning: preg_match() [function.preg-match]: Delimiter must not be alphanume...

CMS for "multilingual" site?

i am developing a site that needs to have American and UK versions with mostly identical content. the differences in language are minor so i'm not looking for translation software. ideals i'm aiming for something that has two text fields per post. one for the US text and one for the UK text. there needs to be a fairly large gallery for b...

Advanced Database Design - Whats the most effective way to execute the following...

I am good with ideas, but due to my limited programming experience I sometimes strain to come up with the most effective solution for a given concept. Currently my mind is trying to fathom the most efficient way to reference a database table specific to a data type. Concept I am building an admin interface that allows a site owner to '...

Strong vs weak typing

The way I understand it, the following is allowed in PHP because it's a weakly-typed language. $var = 'Hello'; $var = 5; I just installed a Windows version of Python 2.6 and I was expecting it NOT to let me change type just like that, but the Python equivalent of the above code works just like in PHP yikes! >>> var = "Hello" >>> type...

How to change php.ini by PHP?

short_open_tag = On Is it possible? EDIT I tried this : <?php if (!ini_get('short_open_tag')) { ini_set('short_open_tag', 'On'); } $a=1; ?> <?=$a;?> which outputs <?=$a;?>,so it's not working. ...

is php file_get_contents() enough for downloading movies ?

is file_get_contents() enough for downloading remote movie files located on a server ? i just think that perhaps storing large movie files to string is harmful ? according to the php docs. OR do i need to use cURL ? I dont know cURL. UPDATE: these are big movie files. around 200MB each. ...

Make a website adaptable for iphone

I am owning some websites, in php, java and html coded. I want them to be viewed comfortably using iphones. ie, the site has to first check whether the site is hit from a pc or mobile (iphone). If its from a mobile, it has to be redirected to another server which loads the mobile view. Some sites i've recently found of doing the same is ...

Can a PHP script be run regularly on a server without requests from a client?

I'll be writing a script to parse text documents into a MySQL database. I'll be converting PDF's to text with a separate utility. These PDF's will be submitted via e-mail attachments. I'm looking to see if I can do this with PHP since that's the server language I'm most familiar with. Second choice would be Perl, but I'll take your r...

How to make PDF viewer in PHP

I want to open PDF file with PHP. Don't want to use Flash. Like google doc viewer. I just want to open PDF file. Can I do with PHP ? ...

how to decode phpciphered files?

Hi All, Any body know how to decode ciphered files. I have phpcipher.bin file and other php with ciphered text. How Can i convert back to php file to analyse php files. Thanks in Advance, Alagar ...

MySQL and PHP works locally, not on GoDaddy

Hi, I'm using GoDaddy's Shared Linux hosting and some PHP I wrote just won't work with my DB on the server. EDIT: I fixed the problem. I accidentally deleted the "database" connection variable from a config file. Wow. That was silly of me. EDIT: By not work, I mean that I can't read the DB. I've messed around enough to know that the...

Can I send emails with Actionscript 3.0, or do I need to use PHP?

i wanted to know that using actionscript, is it possible to send email and create a front end in flashbuilder 4(flex), everywhere i see php being used for mails, is it possible? ...

Do not understand how this array result happens

I'm trying to learn to build a login sequence. In one part, I wanted to determine if the user left any of the 3 required fields blank: foreach ( $_POST as $key => $value ) { if ( $key = "school_code" || $key = "user_name" || $key = "password" ) { if ( $value == "" ) ...