php

Approach to sending alerts with CakePHP

This is a rather obscure question so please bare with me. It's more about approach than syntax. I have a MySQL table filled with 'notifications' (id,user_id,date,etc). I have to send an alert (via email, facebook, twitter, whatever... not the issue) when each of those entries pings as 'true'. Here's the thing, how should I go about ping...

How to call wordpress functions in custom php script

I have a Php script I want to use for creating a new blog in WPMU. I am having trouble calling wordpress functions like "wpmu_create_user" and "wpmu_create_blog". My hope is to get this script running as a cron job from command line and pick up new blog creation requests from an external db, create a new blog using the wordpress functi...

Wildcard Query in Zend Lucene

$index = Zend_Search_Lucene::open("/data/my_index1"); $doc = new Zend_Search_Lucene_Document(); $doc->addField(Zend_Search_Lucene_Field::Text('type','auto')); $index->addDocument($doc); $term = new Zend_Search_Lucene_Index_Term('auto*'); $query = new Zend_Search_Lucene_Search_Query_Wildcard($term); $hits = $index->find($query); f...

How can I resume an upload to ftp from php

I have a php-script that uploads files to an ftp server from a location with a very low bandwith, low reliability connection. I am currently using the ftp functions of php. Sometimes the connection drops in the middle of a transfer. Is there a way to later resume the upload? How can this be done? Edit: People misunderstood that this is...

Why does this query have . ?

I want to know why the following query have . and "" in ".$_POST['date']." etc. $query = "INSERT INTO eventcal ('eventDate','eventTitle','eventContent','user', 'user_id') VALUES('".$_POST['date']."','".addslashes($_POST['eventTitle'])."', '".addslashes($_POST['eventContent'])."')"; If I change to the following, will it make any d...

How to sort rows in a table and fetch row positions?

Consider the following table structure: id name rank position ------------------------------- 1 Steve 5 0 2 David 3 0 3 Helen 9 0 4 Mark 15 0 I need a fast algorithm to rate these rows by rank column and store the "position" of each row in position field in realtime. ...

Time difference between 2 dates ignoring weekend time

Given 2 dates, how can i calculate the number of hours/minutes between them, excluding weekend time (since Friday 17:30 till Monday 09:00) The script queries a MySql database but i assume this sort of calculations would be easier in php. I'm thinking of a iterative function to determine the weekday and keep looping until last date would...

PHP: Is it ok to replace \r\n with \n?

I have a form with a textarea and a JS character counter. Yet the backend script claims that the strlen of the message is longer than the JS character counter claimed. The reason for this, I have discovered, is that the backend sees every newline character as \r\n which is two characters. Can I simply have it do a str_replace("\r\n","\n...

Getting method params

Lets say I have a class like: class SomeClass{ function someAction($param1,$param2){} } Is there any way to get analyzing data like array('param1','param2') without actual execution of method? Preferably without php extensions or prior code analysis (fopen...) ...

Updating a rss-feed continuously

I'm creating a bot in PHP that continuously updates an RSS-feed and gathers information. Every loop takes around 0.1 sec but sometimes it takes up to 9 sec to finish the cycle. Why does this happen and is there a way around the problem? I need the bot to be as fast as possible as I'm trying to beat another bot that has the same purpose ...

SimpleXML how to prepend a child in a node?

When I call addChild('actor', 'John Doe'); this child is added in the last. Is there a way to make this new child a first child? ...

Error 403 on form submit

Hi, I've got a problem with a form in the administration area of my website. I use it for changing the displayed HTML text, it is written in PHP and connects to a MySQL database. echo "<form action=\"index.php?kat=infos&aktion=upd&kategorie=$kategorie\" method=\"POST\" enctype=\"application/x-www-form-urlencoded\">\n"; echo "<table bor...

Problem with tcpdf Pagebreak

Hi, I have a little problem with a pagebreak. The Multicell is displayed over the footer of the first page and then it breaks: How can I set the bottom margin of the page so that the break happened earlier above? Here is the example PDF: Example and here the sourcecode: <?php require_once('../tcpdf/config/lang/eng.php'); require_on...

edit XML with simpleXML

Hi , How can I edit the value's in a xml file using simpleXML ? I know how to create just not how to edit the value in a exciting file ? ...

how to show running mysql queries in php

i have a overflow memory usage problem and i need badly to scan all my scripts . so my question is how to show a list of running mysql queries in php ...

how to get simpleXML to create an ID

Hi , I have an exctiing xml file which has id's 1 - 20 when I create a new xml file I need it to add the ID to the file how can I do this ? I know how you would do it with SQL but not with xml please help ...

How to load a sub-application from a main application in Flex

Hi all I've created a client with login acces in Flex. After the succesful login i have to show a table based on a mySQL server. The database is composed by some tables, and I have created 6 flex mxml components with each own scripts for each of those tables. How can i load sub-applications, for example with a PopUpButton or a TabBar in ...

Detecting Paypal Subscription Cancellation

Hi, I have written a simple paypal subscription system, where a user can enter their information, click the button, and start a subscription. Im wondering how I can find out when the user cancels the subscription though? I have seen $txn_type subscr_cancel but I have no idea how to use that, since paypal doesn't call my handler again. ...

How to place mouse cursor to certain input box

Hi, How can I place the cursor automaticly to certain input box. This would help to not use the mouse all the time when open the page. (php and html) Thank you! ...

website containing forum and chat should be devloped in Java or Python or PHP?

I want to develop a website that contains a forum and live chat and some chatrooms. Now, should I develop it using Java or Python? I have experience in Java and PHP, but are JSP webpages slower compared to others? My web application will also contain some live chat and chat rooms. Now, there will be a load on the server, and I don't wan...