php

PHP parse_ini_file TC_CONSTANT warning

I've got a weird issue, weird as in nothing comes up on Google. I'm trying to parse an ini file full of HTTP status codes, StatusCodes.ini. I've tested in three different environments, locally (WAMP) on a shared host (Hostmonster.com) and now on a dedicated machine running CentOS w/ CPanel/WHM. The first two environments seem to work fin...

Adding validation to a class in PHP.

Hello people, I have several classes (for a Form generator class thing I'm making...I know sad.. :( ),anyway, the hierarchy is as follows: class HTML_Form accepts abstract class FormElement objects (using type hinting). FormElement class has several children classes such as Textbox, Password, Radio .etc How would I add validation ...

Preventing my PHP Web Crawler from Stalling

I'm using the PHPCrawl class and added some DOMDocument and DOMXpath code to take specific data off web pages however the script stalls out before it gets even close to crawling the whole website. I have set_time_limit set to 100000000 so that shouldn't be an issue. Any ideas? Thank you, Nick <?php // It may take a while to crawl a...

Mail validation with PHP filter_var() or with regular expression.

I have learned today, that it is possible to validate e-mail two ways. One way is by regular expression and the other is by filter_var() function. If anyone could tell me how strong the validation with filter_var is and if there are any recommendations or suggestions on thoughts about switching from regular expression to it, then it wou...

404 Not Found Error when trying to access localhost on local LAMP server

I'm running Ubuntu. My Apache2 default file looks like this: <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/ <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowS...

Retrieve Image From HTML in PHP

Hey, so I have some html ok, and inside it there's a couple of images. What I want to do is retrieve the location of the first image from the html. (get the first images url) How can I do this in PHP? Thanks ...

PHP: filter same column two times in query

$result = mysql_query("SELECT * FROM users_msgs WHERE uID = '$USER' AND date<'$lastmsg' AND date BETWEEN $Yday AND $today ORDER by date DESC LIMIT 10"); Im getting 0 rows while there should be 1.. But my other query, $result = mysql_query("SELECT * FROM users_msgs WHERE uID = '$USER' AND date > $today AND date<'$lastmsg' ORDER by ...

It possible to integrate Orkut like using Oauth like Facebook and Twitter

I am Haresh, I am new user of stack Overflow. I am posting my first question here As per information i have, Aouth provides very stander plateform for authentication for accessing thirdpary social networking website like Facebook, Twitter and LinkedIn. Is it possible to Orkut integration with Website for third party user in PHP. If yes...

Regular Expression - extract digits

I have strings of text that may have the following formats: Was £39.95 Now Only £29.00 OR Was 0.95p Now 10p What is the easiest way to extract two numbers from each string, so I can subtract them later. ...

Generate Alphanumeric ID from Numeric ID in MySQL/PHP

Hi, I have a basic MySQL database where each row is assigned a unique incrementing ID number, however I would also like each row to have a unique 6 character, alpha numeric ID which also increments. Example: Row 1: ID = 1, Name = AAAAAA Row 2: ID = 2, Name = AAAAAB Row 3: ID = 3, Name = AAAAAC The database is added to via PHP so this...

Best way of keeping locale-dependent string resources in PHP?

Let's say you are building a multilingual web application in which all interface text should be moved to language-dependent resources and loaded when needed. The string resource may be huge: say you have several thousands of strings translated. In windowed environments (Windows, OS X, X11) you usually have a mechanism provided by the OS ...

Determine if a string appears in the first 100 or last 100 text node characters of an html content object

Given a string of text "my search phrase", inside an html content block, how would you determine if the string appears within the first 100 or last 100 non tag-based characters of the document? (Don't count html tags, only text nodes) Example, this would return true... <p>This html text block contains <b>My Search Phrase</b>, because i...

Server setup for basic forum-style app on iPhone?

I'm not really a server-side person – I generally do iPhone apps, though I've hacked together a few Wordpress sites. I'm curious as to what web technologies people would use for the back-end of an iPhone app whose front end presents as a basic forum. In other words, people can create new threads, and respond to them - with plain text on...

how to fix my onclick problem in a tab content

i have tried what the first person ask me to do it work but there was a problem the submit button did not send to the $_POST['submit'] whether it because of the false in my button(<input type="submit" name="submit" value="Submit" onClick="show_content('div_2'); return false;"/>)i fall i mention that in tab2 content i have a php code that...

How to load and repeat-x an image with php gd?

Suppose i have an image with width 1px and height 40px. I want to load it with lets say imagecreatefrompng and want to x-repeat it, just like css repeat-x. Is this possible with PHP GD? ...

PHP: show two times

I have a table called users_msgs with these columns: id | uID | nData and it has these rows: 1 | 2 | 20 2 | 2 | 20 3 | 2 | 20 4 | 2 | 20 5 | 2 | 25 6 | 2 | 25 7 | 2 | 25 8 | 2 | 25 uID is userid. So user 2 has written in a nDataid 20 four times, the same he did in nDataid 25. I want to make so you only get one popup per same nData...

Zend Studio and localhost - Forbidden error

Okay so basically, I switched my DocumentRoot in Apache2 default to look like this: DocumentRoot /home/scott/MySite/ That works. I have a file called index.php in that root. I created a Zend Studio project, pointing to /home/scott/MySite/, and was able to create my project use this line as it's source, modify the .php file and see th...

How do I capture the result of an echo() into a variable in PHP?

I'm using a PHP library that echoes a result rather than returns it. Is there an easy way to capture the output from echo/print and store it in a variable? (Other text has already been output, and output buffering is not being used.) ...

Facebook Graph API vs. user's privacy settings

Using Facebook's Graph API, I'm a little confused about the interaction between the requested application permissions and the user's privacy settings. I'm developing a web app that allows people to login via Facebook Connect, and then attempts to retrieve their interests and friends list. I've set the Facebook application permissions...

What is wrong with this regex?

I have the following string: <?php $string = '<meta name="Keywords" lang="fr" content="ecole commerce, apres bac, ecole management, ecole de management, écoles de commerce, école de management, classement ecole de commerce, ecole commerce paris, ecole superieure de commerce, concours ecole commerce, hec, esc, prepa, forum ecole comm...