php

How to best handle exception to repeating calendar events

I'm working on a project that will require me to implement a calendar. I'm trying to come up with a system that is very flexible: can handle repeating events, exceptions to repeats, etc. I've looked at the schema for applications like iCal, Lotus Notes, and Mozilla to get an idea of how to go about implementing such a system. Currently I...

unset the array

I have two arrays. I'd like to merge them into one, but remove the redundant values. How can I do this? ...

PHP $_SERVER['REMOTE_HOST'] returns ::1

Hi I am trying to get the IP address of the website visitor in PHP. I'm expecting $_SERVER['REMOTE_HOST'] to return something like 127.0.0.1, but it's returning ::1. Kind regards Peter ...

php preg_replace with php code

I have a function that finds a regex thingy, then replaces with php code. I want to have it replace the found regex with php code on the screen, like have it echo out ". except when it echos that in the source, it shows all the <?php tags and echo and everything, and doesnt just output 'wat'. no im not going to just replace the text with...

Zend: How to populate data to checkboxes?

I am working on zend. I have a form with some checkboxes. I want to get data from database and populate this data to this form. If '1' is stored in table field then tick the check box otherwise leave it alone. In textboxes and dropdowns, data is easily populated but how to check a checkbox in action. I am creating checkboxes and textbox...

Script Speed vs Memory Usage

I am working on an image generation script in PHP and have gotten it working two ways. One way is slow but uses a limited amount of memory, the second is much faster, but uses 6x the memory . There is no leakage in either script (as far as I can tell). In a limited benchmark, here is how they performed: -------------------------------...

Google Charts Over HTTPS

I'm trying to load charts as images in a secured site. An example of a Google Chart image over https would be this: http://www.google.com/chart?cht=lc&amp;chs=200x125&amp;chd=s:helloWorld The problem is that while you can load an image like this by directly clicking the link, you can't include it as an image in your page. It just won...

Account confirmation email sent as SPAM

I am using PHPMailer to send a confirmation email for newly registered users in my social network. But I found out most of them have ended up in user's spam list. (Hotmail and Yahoo). How to avoid this? This is my script $mail=new PHPMailer(); $mail->IsSMTP(); $mail->SMTPAuth = mSMTPAuth(); $mail->SMTPSecure = mSMTPSecure(); $mail->...

how to use web api with javascript/php?

geonames.org got a web api you can use to get all the hierarchy for a city. you just enter the id and you will get the data back in xml. http://ws.geonames.org/hierarchy?geonameId=2657896 i wonder how you fetch the url with php and javascript, and which one should i use. cause the id's are in the mysql database. i will get them wit...

get particular column value

i want take the particular column all value in multidimensional array... i need to get the value of or column ("rose","daisy","orchid")... how do get? is there any predefined function? because in my array have 1000 record, so loop will continue to run 1000 times, program will slow, so... ...

Integrate Zend translator into my app

Hello. I wish to use the Translator classes of Zend framework in my app, but I don't want to include the whole framework. I grabbed the: Locale folder Translate folder Exception.php Loader.php Locale.php Registry.php Translate.php and copied into a custom folder named zend.translator. Obviously I had to edit all them to adjust the in...

Can I somehow know which replacement is taking place from within a callback of preg_replace_callback?

I'm using preg_replace_callback to substitute particular tokens within the string. But apart from actual token I need to know as well whether that token was first, second or third in a subject string. Is there any way to access that info? I found an argument $count in preg_replace_callback definition (http://php.net/manual/en/function.p...

php get, random records, and the back button

My site has a library full of games, nations, game scenarios, etc. library.php is given a type=___ & id=___ for example library.php?type=scenario&id=ABCD001 library.php saves the id to a session variable and loads an include appropriate for the type This all works just dandy. Now, I wanted to give my users the option of pulling up a...

Is a PHP-only "cache engine" ever worth it?

I wrote a rather small skeleton for my web apps and thought that I would also add a small cache for it. It is rather simple: If the current page exists as a file in the cache and the file isn't too old, read it out and exit instead of rebuilding the page If the current page isn't cached/outdated recalc the page and save it However, ...

Parse error: syntax error, unexpected ';'

Hallo I have this script: <? require("lib2/config.inc.php"); require("lib2/tpl.class.php"); require("lib2/db.class.php"); require("lib2/um.class.php"); $tpl = new template("templates", "tpl"); $db = new db($db['location'], $db['username'], $db['passwort'], $db['database']); $um = new usermanagme...

Replacing backslash with another symbol in PHP

Hi there, Been struggling with replacing a backslash by another symbol such as '.-.' just to indicate the position of backslashes as I could not send a string such as 'C\xampp\etc.' through url as GET variable so I thought I'd first replace the backslashes in that string by another symbol, then send through url, and then replace them ba...

Select from mysql by day with different timezones (php)

I'm storing leads in a database, and each lead has a datetime field with a PST timezone based date & time. I want my user to be able to display all leads from a certain date (e.g. today, yseterday), and choose the timezone. E.g. if I want to see all leads that were generated yesterday in EST timezone, I need to first convert (or read) ...

SQL Problem, WHERE Statment is wrong

$sql = 'SELECT id, DATE_FORMAT(date,"%d.%m.%Y - %H.%i Uhr") AS dat, user1, user2, p_user1, p_user2, be_user1, be_user2, win FROM kok_1on1_matches WHERE user1="$user" OR user2="$user"'; What is wrong with the WHERE statement? ...

HTTPRequest solution needed

Hallo, I need to send a request to a page (POST) and then, I will read the XML and take the logical action. How can I best send from my PHP request and then read the response. Thnkas. ...

text search with two parameters

The user should input two strings and the script will performe a text search: $sql = "SELECT * FROM table_one WHERE name='%$str1%' AND MATCH (street, city, pin) AGAINST ('$hrtg'IN BOOLEAN MODE)"; somehow the % does not work, but it alwas did actually. please help? ...