php

Accept <br> for new line but filter html tags in php

I want my input or textarea value only accept <br> for having new lines $comment = trim($comment); $comment = stripslashes($comment) ; Although I do want to accept <br> for new lines but I dont want to accept html tags any suggestion ? ...

php mysql script gone wrong. please help

Hi guys im hoping someone can help, im working on a site and created this experimental script whitch populates a category menu dynamically based on the database entry it worked for a day and then suddenly stopped. i changed my includes for requires and it gave me this error message Fatal error: Maximum execution time of 30 seconds exc...

Is this a correct utm.gif query?

I was wondering if i build this google analytics query the right way. I am not sure about the 'utmcc'-Part. 0 => string 'http://www.google-analytics.com/__utm.gif?utmwv=4.5.7' (length=53) 1 => string 'utmn=738025229' (length=14) 2 => string 'utmhn=www.mydomain.de' (length=15) 3 => string 'utmcs=ISO-8859-1' (length=16) 4 => str...

How to loop inside loops?

I have 2 table. Table1 "Order" orderid - customer_id 1001 - 1234 Table2 "Items" no - orderid - items_code 1 - 1001 - 100 2 - 1001 - 200 3 - 1001 - 300 how to get results as below (in php): Order # Items Customer ID _________________________________________ 1001 100, 200, 300 1234 ______________________...

jQuery/Drupal Append string to all HREF on site (Any page)

So I have a site with a dozen pages on it using Drupal as a CMS. Wanted to know how to set/append all href links on any page with a dynamic attribute? so here is an example URL: http://www.site.com/?q=node/4 and I wanted to append to the URL like so: http://www.site.com/?q=node/4&amp;attr=1234 Now I have a nav bar on the site and ...

Magento : Moving "Recently Viewed" to product page creates weird caching error

So we have put the "recently viewed" block into our product view. Everything seems to look fine at first but I'm now seeing weird errors that have to do with null layouts. If i turn caching off it works fine, but with full page caching enabled it fails when calling $this->getColumnCount(); in the template. What I have done to enable r...

What is difference between creating a file with fopen and generating file with headers

One Way am creating an xls with fopen("test.xls") . Using fwrite i write xls and readfile give me the file. Second Way I generating xls with putting header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1 header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1 header ("Pragma: no-c...

How to count string length of a domain list and group them by length?

I have a list of domain names, for example: domain1.com domain2.com domainxxx2.com dom.com from that list I want to get: length 7 [2] length 10 [1] length 3 [1] I know how to split the tld and count each domain length, but dont know how to group and count those with the same length. I would like to do it on PHP. ...

Integrating Google Desktop Search into a website using PHP, hosted in a Linux environment.

Is there a way to make a search call to GDS in PHP and have it return XML containing the search results? The Google Desktop API documentation page specifically states: "This document describes methods for issuing Desktop search queries using HTTP and XML. This XML-based API is supported by both the Windows and Mac OS X versions of ...

What is better approach of doing this PHP + MYSQL in one page?

My approach: <? switch($id) { case 1: ?> a lots of html stuff goes here... <? break; case 2: ?> a lots of html stuff goes here2... <? break; } ?> Is there any way to do this thing prettier? I mean more readable or something? I would really appreaciate that. (haven't learned smarty ...

Drupal date formatting

In lieu of using php's date() function directly, I'd like to trigger a date format that I've created at admin/settings/date-time/formats. At first glance I thought I could do this: format_date(strtotime($date), 'customformat'); But it looks like format_date() has a few formats hard-coded and doesn't communicate with the date/time for...

Java .NET vs PHP Rails

What are the benefits of using a compiled solution like .NET of Java over an interpreted solution like PHP or Ruby for building a Web Application/Web Site. It seems like Java or .NET apps would require a lot more overhead compared to a PHP/Rails solution. ...

Help with Exchance 2010 EWS (API) and/or PHP's NuSOAP library?

Just to be clear before continuing: using PHP's built-in SOAP class is unfortunately not an option here (production server's PHP is not built with it, and won't be). I'm trying to use EWS to allow me to authenticate users for a completely external server application. LDAP authentication has been disallowed. I have verified my EWS wsdl...

How to run Hello World app on MySpace?

I try to wrote MySpace app. My OAuth Consumer Key: is http://www.myspace.com/551804372 and OAuth Consumer Secret is 4d6898d03b24491abc57e98f67508c7e828f9821d84d433b8b541f1865a89fa6 Is used your tutorial: http://wiki.developer.myspace.com/index.php?title=Example_Application:_Hello_World to create APP. I set app to "External ...

PHPlist - when sending to a list, placeholder is ignored.

Hello. I have a problem: I have modified sendemaillib.php code in order to check for a custom placeholder in the message. The code checks for [AVAILABLESPACE] like this if (eregi("\[AVAILABLESPACE\]",$htmlmessage)) { and if found it queries one table to get the current number of available space so that I can write in my emails "Regis...

passing uploaded files to another part of the script for onward processing

Hello guys, I have searched the forum but the closest question which is about the control stream did not help or i did not understand so i want to ask a different question. I have an html form which uploads multiples files to a directory. The upload manager that handles the upload resides in the same script with a different code which I...

How do you convert the following encryption code from Perl (or from PHP) to VB.NET?

I have some encryption code that has been written in Perl (also a code snippet in PHP) - but I just can't get a version written in VB.NET to work with the third party. Example in Perl package Sitemaker::API::Crypt; use warnings; use strict; use base qw( Exporter ); use Crypt::CBC; use MIME::Base64; our @E...

PHP Array remove items if missing key

I have the following array format: Array ( [0] => stdClass Object ( [tid] => 3 [children] => Array () ) [1] => stdClass Object ( [tid] => 15 ) [2] => stdClass Object ( [tid] => 12 [children] => Array () ) [3] => st...

IoC Container + Unit Testing

Is it ok to use a container to create the objects that are going to be tested? Or should I build them manually? ...

Accessing data from a json structure

I am loading in a JSON feed from Facebook (snippet below). { "data": [ { "id": "115972604762", "from": { "name": "Title Here", "category": "Musicians", "id": "20274769762" }, "name": "It was an amazing gig!!", "picture": "http://photos-h.ak.fbcdn.n...