php

Removing objects form serialize data

I am trying to integrate two PHP scripts (app1, app2) and I am trying to get session data from app1 in app2. The problem is when I am trying to unserialize the session data from app1 I am getting a small ton of errors because PHP is trying to find the __wakeup() function for each of the objects. I can't use the unserialize_callback_fu...

command is not running from php script using shell_exec() or system() or exec() functions

I am working on Windows server and able to run command from command prompt c:> %convertxls% {some args....} But when I run same command from php script *shell_exec(%convertxls% ..... 2>&1);* it gives me error as %convertxls% is not recognized as an internal or external command, operable program or batch file. I think when I ...

AJAX form vs PHP-only, I'm concerned about graceful degradation

I've got a PHP-driven site that has a recordkeeping form. The user chooses a battle in the first dropdown, then the winning side in the second. Currently the winning side options are only Side 1 , Side 2 corresponding to which was listed first in the battle setup. The submission has an "are you sure?" step to make sure they have a chance...

Cycling through urls in a string and appending a value to it PHP regex

I have the following string for example: Welcome to my <a href="http://example.com"&gt;site&lt;/a&gt;. Feel free to <a href="http://localhost.com"&gt;contact me</a>. What technique may I use to evaluate this string to add '/id/123' at the end of both of the urls resulting in: Welcome to my <a href="http://example.com/id/123"&gt;site...

PHP output buffering? What's the best practise?

Further to my previous question, what's the best approach when I want to buffer PHP output until I have performed all processing? I want to buffer to leave myself the option to to redirect to an error page, which I can't do after any output. So, what's the best practise? Use a variable $output and keep appending to it, then output it a...

Limit Java Applet to only one instance.

Hi all, I have been using Stackoverflow for a while to find solutions to my programming questions, but for the current question I haven't found a useful solution. So I joined up. What would be a good solution to limit a Java applet to only one instance. I'm using php to serve the applet to the end user, so that would be an option. But...

Is it Possible to use PHP to select a file to pass into an R script as an argument to be operated on?

At the moment I am using a BATCH file that comprises of the following line of code: c:\R\bin\Rcmd.exe BATCH "<filepath>/shares.R" It opens and runs the following R code: library(ggplot2) library (XML) test.df <- xmlToDataFrame(file.choose()) test.df sapply(test.df, class) test.df$timeStamp <- strptime(as.character(test.df$timeStamp...

Validate with Zend_Validate_Date on a time string.

Hey all I'm trying to validate a 'time' field using Zend Framework. The docs seem to be pointing out that the following: $tstarttime = $form->createElement('text','t_start_time'); $tstarttime->setRequired(true) ->setLabel('Start Time') ->addValidator(new Zend_Validate_Date('H:i')); I've tried this but no luck. Any ideas or a...

Mysql Select Second Row

Hi, i have a mysql question. I have a news section on my website, and i want to display the two latest items. If i do: SELECT * FROM nieuws ORDER BY id DESC LIMIT 1 it select's the latest item, and now i want to select the second to last item. Do you guys know how ? Thanks in forward /// EDIT Now it doens't work, here's my co...

define and defined for disallow direct access

I have two page: rooms.php and reservation.php User can only access to reservation.php via rooms.php I have used define('NOT',1); and if (!defined('NOT')) exit('no direct!'); But when user goes from rooms.php to reservation.php there is error message? Why define function not working? Thanks in advance ...

PHP:include file

Hi, I have a DB file content my DB info. the file db.php located on my mother's folder [here apps folder]. Now, how can I include the db.php file anywhere on the project using base_url()? Here is my base url function: function base_url() { return "http://localhost/apps"; } I tried like this way but it does not work. $link=base_u...

Error with cURL - "Could not resolve host: www.bbb.org(; No data record of requested type"

I am trying to access data of http://www.bbb.org/us/Find-Business-Reviews/ with cURL. Now I used HTTPFox to see what data does this site send and accordingly made an array to "POST" to the page. But I am having problem in accessing Page 2,3,4,5... Here is the array - $array = Array(); $array['__EVENTTARGET'] = 'ctl12$gc1$s$gridResult...

Is it worth to switch from PHP/MySQL to .NET at this stage?

I have 7 years of experience working on PHP/MySQL. From few days I am in a dilemma because not able to see many opportunities in the MNC’s or in banking domain for PHP. The question comes in the mind is “is it worth to switch from PHP/MySQL to .NET at this stage” And if I switch without any plan how much money I am going to make. Beca...

Wordpress plugin to notify all users when there is a new comment.

Hi, I was wondering if anyone knew of a plugin that notified all users when an new comment was made. At the moment it only notifies the author of the post. Cheers. ...

WordPress the_date skipping at intervals inside a loop.

I have made a custom loop in WordPress and for some reason, the date is being skipped on random intervals, even though the other post content is getting pulled in successfully every time. Any ideas, because it is completely baffling me! For example, a list of posts and when the date is missing: Date Date No date Date Date No date ...

Submitting a form via GET to a rewritten URL.

I've got a website where URLs are rewritten in this format: http://www.example.co.uk/module/page/query/ http://www.example.co.uk/index.php?m=module&amp;p=page&amp;q=query Which gives rise to pages such as: http://www.example.co.uk/schools/view/495/ http://www.example.co.uk/schools/search/park+lane/ Is there any way to make it so th...

MySQL Transaction From PHP

QUERY 1: $link = mysql_connect('localhost', 'root', ''); mysql_select_db('rems', $link); mysql_query('SET AUTOCOMMIT=0; START TRANSACTION', $link); mysql_query('DELETE FROM admins WHERE admin_id=4', $link); mysql_query('ROLLBACK; SET AUTOCOMMIT=1', $link); QUERY 2: $link = mysql_connect('localhost', 'root', ''); mysql_select_db('rems...

Updating SQL Database through PHP & xCode

Hi, I am trying to update a MS SQL Server database from my iPhone application. Here is what I have in the XCode: NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://www.xxxxx.com/UploadTextView.php"]]; [request setHTTPMethod:@"POST"]; NSString *postString = self.textView.text; [r...

Accessing XML content via PHP using SimpleXML

I am working with the XML file string below and I've tried a number of methods to try and get access to certain parts of the XML contents. Please see the code after the XML file below for my attempt: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org...

Second MySQL query doesn't work

Check this code: $select = mysql_query("SELECT * FROM nieuws ORDER BY id DESC LIMIT 1"); while($row = mysql_fetch_assoc($select)) { $datum = $row['time']; $titel = $row['title']; $bericht = $row['message']; ?> <div class="entry"> <spa...