I have been trying this for hours
<?php
if ($_SERVER['SERVER_NAME']=='http://www.testground.idghosting.com/idi' && $_SERVER['REQUEST_URI'] == 'our-production/') {
echo '<div id="services">
<h1>Our services</h1>
<a href="<?php bloginfo(\'url\'); ?>" id="serv_productions" title="Our Productions"><span>Our Productions</span></a...
my code basically should crop the image to 219px by 127px and save the image to the database but im getting errors and cant figure it out.
<?php
if(isset($_POST['btnupload']) && $_FILES['imglogo']['size'] > 0) {
$tmpname = $_FILES['imglogo']['tmp_name'];
$imgsize = $security->secure($_FILES['imglogo']['size']);
$imgtype = $security->s...
I have a PHP script that I am using to generate some rather complicated javascript for a web application. It is necessary that this script be generated by PHP for scalability reasons.
Here is my problem:
if I name the file myscript.js, then I have to use htaccess to tell the webserver to pipe this through PHP (not preferrable)
if I na...
Is there any good way to do this, or should I just bite the bullet and either a) buy an IDE for PHP on Windows, or b) find out how to do this on Linux and run Cygwin?
...
I am currently scraping some data from the internet and converting into xml documents.
document being scraped is utf-8 according to its meta tags
The problem is some of the data contains foreign characters, I cannot find a way of reliably converting them into XML / utf-8 friendly entities, the following errors are what I have managed...
I'm trying to whip up a skeleton View system in PHP, but I can't figure out how to get embedded views to receive their parent's variables. For example:
View Class
class View
{
private $_vars=array();
private $_file;
public function __construct($file)
{
$this->_file='views/'.$file.'.php';
}
public funct...
are there any sites where we have to solve puzzles using php scripts? Similar to PythonChallenge?
I am aware of most of the programming challenge sites, idea is to find a site which helps to discover the strength and speciality of PHP Scripting the way PythonChallenge does by it's wiki's for each level.
...
I'm using the PHP NumberFormatter class to print currency values.
Eg:
$cFormatter = new NumberFormatter('en_US', NumberFormatter::CURRENCY);
$cFormatter->formatCurrency(123, 'USD');
$cFormatter->formatCurrency(123, 'BRL');
$cFormatter->formatCurrency(123, 'GBP');
That works fine, and returns "$123.00", "R$123.00", "£123.00" r...
FINAL EDIT: I've summarized and simplified this crazy question into a new question, so we can close this Q or whatever is necessary to mark it resolved. Thanks again!
NEW:
Can you tell me your opinion of this, and possibly see if you can recreate it:
Currently, the $post->post_content variable contains:
"before <img src="/path/to/val...
I've got over some tutorials on how to gzip a css file in which you create a public php file to include css files with compression. The problem is I cannot get it to cache my css files. I'm using firebug for reference and I've actually tried using the same code to compress some javascript and it caches it fine.
Here is the code:
if(ex...
I am coding a web application in PHP and it has some performance intensive parts that I'd like to rewrite in a compiled language. I know that I could probably get this done more easily just by writing a C++ extension for PHP, but I'm a bit too spoiled by managed languages like C#, so I'd like to avoid C++ if possible.
If I wanted a PHP ...
How would I go about finding the unix timestamp of midnight of the previous Wednesday? My only approach would be to get the day index and day number of today, and subtract the difference, but I can think of several scenarios where this would fail, for example, early in a month before a Wednesday has happened.
I guess, more concisely, ho...
I want to join 2 tables together but i cant get it to work.
These are the tables:
threads: id, title
posts: thread_id, message
$sql = mysql_query("SELECT threads.id, threads.title
FROM threads
JOIN posts ON posts.thread_id = threads.id
WHERE threads.id = ".intval($_GET['id']))...
I have a database which is tied to a server of pictures. In the case that a pic isn't uploaded I want to place an "unavailable" photo in its place. Each pic is in numerical order based on the primary key from the database $row['Item_ID']. My script below searches for the file but can't find any pics, so it uses the "unavailable" for e...
I have some database information stored in config.inc.php and i'm trying to use it to access the database in a class I have, but for some reason, the variables are null. heres the code:
<?php
require_once 'dbinterface.php';
require_once 'config.inc.php';
class user {
...
function user($id) {
$this->db = new db($DB['host...
Could you please tell me, what is the use of JSON (in Javascript and PHP).
when we need a JSON method.
I read from the following link but, i didn't get any information regarding the JSON implementation on any project.
http://www.json.org/js.html
...
I have the following XML from a .NET web service:
<?xml version="1.0" encoding="utf-8"?>
<DataSet>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice max...
Is there a "better" way (built-in function, better algorithm) to normalize the case of all the keys in a PHP array? Looping though and creating a new array works
$new = array();
foreach( $old as $key=>$value) {
$key = strToLower($key);
if(!array_key_exists($key,$new) {
$new[$key] = $value;
}
else {
throw new Exception('Duplicat...
How would I go about detecting whitespace within a string? For example, I have a name string like:
"Jane Doe"
Keep in mind that I don't want to trim or replace it, just detect if whitespace exists between the first and second string.
...
OK, I give up. I have been trying to figure this out for weeks now. I think I will leave it to the crowd-sourcing machine.
Can Somebody Please Make A PHP 5 Equivalent Of Anyone Of The 2 Classes Below?
(I mean with that both encrypted
Silverlight Cryptography Class 1:
Public Class AES128Helper
Public Password As String = Nothing
...