php

Generating php from delphi - has anyone done it?

See http://stackoverflow.com/questions/3243285/how-to-escape-quote-pph-strings-generated-by-delphi I am just interested to hear if anyone has used Delphi (or possibly BCB) as a code generator for PHP ... (or thoughts about code generation from one language to another in general) Hmm, any good books about code generation ? ...

Website to mobile website conversion

Hi guys, I have a simple webpage here. If I want to convert it into mobile website, what should to my html or something such that when I open it with my mobile, I should be able to see the whole page in my screen. I tried adding this to my html code... in head <meta name="viewport" content="width=device-width; initial-scale=1.0; maxi...

PHP - How to make php.net's sample code not hang?

The Simple TCP/IP client example will hang if no data is being received. To see what I mean, copy the client code and run it, but remove one of the \r\n's in the GET request to make it invalid, so it looks like this: $in = "HEAD / HTTP/1.1\r\n"; $in .= "Host: www.example.com\r\n"; $in .= "Connection: Close\r\n"; The server won't res...

uncertain variables in php

Hi, if($a == 4){ echo 'ok'; } Now displays an error because $a variable is not defined. my decision: if(isset($a)){ if($a == 4){ echo 'ok'; } } But maybe there are better solutions? ...

Convert/cast an stdClass object to another class

I'm using a third party storage system that only returns me stdClass objects no matter what I feed in for some obscure reason. So I'm curious to know if there is a way to cast/convert an stdClass object into a full fledged object of a given type. For instance something along the lines of: //$std_class is an stdClass instance $converte...

Referring to files from within single wordpress pages

This question was already asked in the Wordpress support forums (by me) and can be found here: http://wordpress.org/support/topic/423693?replies=1 But since their response time is unbelievably slow, I figured I'd ask it here as well. Hi all, I'm using WordPress 3.0 with a self-designed theme. I have a self-built contact form that I'm ...

Improve my code : Distributing the content of a textarea in two different arrays depending on markers.

Hi, I have a textarea where the user can create a feature list with a title for each block of features. The idea is to store the [title] and the features in two different MySQL tables. [Outdoor] BBQ Tennis court Swimming pool [Internal Equipment] DVD Player Plasma screen Here is what I've done so far; it works bu...

File posting using cURL into a secured folder(https://)

The problem is to upload a txt file into a secured folder(https://www.mydomain.com/myfolder/) using cURL. I have a relevant ftp details to connect that folder. here is my code, but it does not getting connected properly... can any one please advise what mistake i did on this code. which returns error_no:7 while uploading file <? if (i...

Decimal type in php

Does php has Decimal(±1.0 × 10−28 to ±7.9 × 1028) type? ...

Problem with regex for text parsing (similar to textile)

I'm banging my head against the wall trying to figure out a (regexp?) based parser rule for the following problem. I'm developing a text markup parser similar to textile (using PHP), but i don't know how to get the inline formatting rules correct -- and i noticed, that the textile parsers i found are not able to format the following text...

Calling PHP Webservice from C# using supplied WSDL

Hi, Ive been passed a WSDL from a third party. Their web service is PHP on Apache. I can call its methods from within XMLSpy and Validwsdl.com. But cannot get my C#/Visual Studio project to build/validate the WSDL. When I add it to my project - it shows all of the methods and seems fine but wont build. Ive tried add web ref, add servi...

How do I integrate date check function in single mysql query??

this is my current function: $result = $db->sql_query("SELECT * FROM data1,data2,data3,data4 WHERE person='" .$name. "'"); $row = $db->sql_fetchrow($result); $day = $row['regtime']; $days = (strtotime(date("Y-m-d")) - strtotime($row['regtime'])) / (60 * 60 * 24); if($row > 0 && $days < 15){ $row = ['name']; $row = ['age']; //etc bu...

script dying out and contents are being prompted for download due to fsockopen - how do I fix it

Hi guys, I'm working with zend framework and recently had terrible issue swith my code. Actually I'm developing a webfront for emails and users enter their mail server details and are able to check on their email via my system. The issue is that whenever I would try to connect to a mailserver my system just dies out sometimes and instea...

Where to put http get function in CodeIgniter

Hello all I understand that everything dealing with database should be put inside a model class. But what about the data I get from a HTTP GET resource, like say a xml file, csv file or something like that. Should I make a helper for it? a library? or is it good in a model? Regards ...

is there a good PHP CRUD code generator?

Is there any better PHP CRUD code generator? I want to get Data Access Object, Business Object and Value Object. It would be difficult to match my needs, but I am happy at least I can get any relevant one. Thanks in advance. [EDIT] I am working on an MVC based application. I am using my own MVC framework. I need this code generator to ...

Prevent Safari from Caching Top Sites

I have found what I think to be a big security flaw with Safari's Top Sites image cache. For those who don't know, Safari basically takes a snapshot of every page you visit and this is supposed to be somehow useful to the user. My problem with it is that it even takes snapshots of parts of my site that are password protected. So if someo...

md5 hash for urls in unique Index

I was asked this before with slight different with current question. but did not got the answer I was looking into. My question is do I need to store md5($url) in unique index in MySQL?? I have seen this in some code actually I don't remember..this is a large database with more than 5 million urls and the indexing is done by calling url...

Parse XML using a XSD in PHP

I have a XML file and a a bunch of XSD files with schemas. How do I parse the XML file using the correct XSD file and schema in PHP? ...

php/regex: "linkify" blog titles

I'm trying to write a simple PHP function that can take a string like Topic: Some stuff, Maybe some more, it's my stuff? and return topic-some-stuff-maybe-some-more-its-my-stuff As such: lowercase remove all non-alphanumeric non-space characters replace all spaces (or groups of spaces) with hyphens Can I do this with a single reg...

$n = 2; 10-$n = 87...

hi there, well this is what i am doing: $total = (array_sum($odds))+$evens; $total = str_split($total); echo 'total[1]: '.$total[1].'<br />'; echo '10-$total[1]: ' . (10-($total[1])); and the output is: total[1]: 2 10-$total[1]: 87 my guess is it is being treated as a string, but how do i fix it? so, what i want to know is wh doe...