php

Custom Escape Sequence In PHP

I want to convert arrays into storable string formats using a combination of their keys and values bunched together into a serial string delimited by special characters? But I am also worried that since it is impossible to predict input from a user form, that the input may also contain the characters I have chosen as the delimiters. C...

Using referrer to run script

I was wondering if it is possible to execute a script depending on the referrer site. for example if a user accesses my site from Facebook then i want the script to be activated, but if the user accessed the site through google search then the script will not be ran. Is this possible? ...

handler = function?

every time i encounter this word i wonder what it really means. eg an event handler, is that a function? $('a').click(function(){ ... }); is the click an event. and the handler the anonymous function? ...

Light Blogging system sans database

Hi, This is a general programming question. What is the best way to make a light blogging system that can handle images, bbcode-ish styling and text without a database back end? Light means not more than 50 to 100 posts in extreme cases. What language(s) should be used? Is there any preferred data format for the information? How does s...

Dynamic content in 2 columns (rather than one!)

Hello, I have one table which display data as from Dynamic Content in 1 column. I would like the content to move to a second column when the number of cell is >3. (ie. if there are 3 cells to display, it would be display in 1 col, and 4 cells or more it would be displayed in 2 columns. Note that the dynamic content will never go over 6 ...

Make strtotime() generate times only in the future.

I'm trying to make a PHP script to find the next occurence of a date (say 5-1). However, if I put that into strtotime() on 5-2 it comes up with the date from this year. I simply want to make it always return the next date possible. How can I make this work? I'm using codeigniter if that helps. EDIT: Here's some code I came up with, if s...

Changing the the timezone on the fly

I have a small app where the user is allowed to change their timezone. I have set the default timezone in the ini file but will need to change this on the fly so that I can pass the user defined time into a database query to get the proper results. What might be the best way to handle this? Should I be using date_default_timezone_set()? ...

Is it really having an impact to use ' instead of " in PHP

A web site, 5 human years in code (5 developers, approx one year), 10 of thousands of hits every day. Is it really going to have an impact if we change all " to ' where possible? ...

What is best for a profile, a number or a name?

Most sites that have some sort of user profile will either do something like this: profile.php?u=123445 or else: profile.php?u=jason.Davis So I am curious, would it be slower to use a name to lookup a profile with php/mysql vs. using a number to look up a profile record? ...

PHP notification when i receive new e-mail

how to be notified when i receive any email to a specific email address on my web server for example if i have an email on my server "[email protected]" when i have any email i want to fire a script is that possible with PHP ? Thanks ...

php not returning value of false

I cannot get a false value to return here. A true value returns fine. What am I missing? if ((count($this->_brokenRulesCollection)) == 0) { return true; } else { return false; } ...

Kohana 3 Random Query

Hello, Im new to kohana 3 here, and my understanding of it is very limited. The problem is instead of displaying the first row, what code should I use when I'll try to get a random row from a certain table? BTW: I'm using the ORM module. Thanks ...

What's the problem with mysqli in php5?

I used to code in php4 but now I switched to php5 and the following code throws the below exception. Why is that? CODE: $mysqli = new mysqli($CONFIG_DB_HOST,$CONFIG_DB_USERNAME,$CONFIG_DB_PASSWORD,$CONFIG_DB_NAME); $result = $mysqli->query("select * from temp_table where url = '" . $mysqli->real_escape_string($in_url) . "'"); $row = $...

Jquery array validation + php

Hi, I have a checkbox group in my html form.The check box group contains array. My question is how validate the checkbox array using jquery and get the array value in php The code given below <input type="checkbox" name="go[]" value="1" /><label>Married</label><br> <input type="checkbox" name="go[]" value="2" /><label>Widowed</label>...

Merging two objects

Quotes object: Array ( [0] => Array ( [sitecaptions] => Array ( [id] => 2 [caption] => Great camera deals! [linkurl] => http://www.99hotdeals.com/cat/Cameras and Camcorders ) ) ) The Posts Object: Array ( [0] ...

A simple PHP query

I am a noob to PHP just wondering why are we writing the php script in the body tag of HTML. I am just taking a word on one page and directing it to another page using the post method. below is the code. page1.html <form action="disp.php" method="post"> Enter a word: < input type="text" name="word" /> disp.php this goes inside th...

Html parsing using Simple Html dom parser

I am using simple html dom parser to parse some html. I have an html like this <span class="UIStory_Message"> Yeah, elixir of life!<br/> <a href="asdfasdf"> <span>asdfsdfasdfsdf</span> <wbr/> <span class="word_break"/> 61193133389&ref=nf </a> </span> My code is $storyMessageNodes = $story->fin...

Resize Image With Coordinate in CI

Hi ..., I’m trying implementing crop image with coordinate. but the it doesn’t success if for the coordinate. my code is : function image_thumb($image_path, $height, $width, $x=0, $y=0) { // Get the CodeIgniter super object $CI =& get_instance(); // Path to image thumbnail $image_thumb = dirname($image_path) . '/' . $he...

PHP/MySQL/Apache/JS with Visual Studio 2010?

I'm working on a project that uses a PHP, MySQL, Apache, and runs on a Linux server. Is there any plugin so that I can use Visual Studio as my IDE? Preferably, it would be something free, unlike VS.PHP which apparently costs $100/year. And, I'm running the VS 2010 beta. ...

Jquery Caching issue?

I have a php function that called admin_head() which basically includes the css and jquery files. function admin_head() { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"> <hea...