We use the following function to auto detect if we are on a machine internally or on a live server and then choose the appropriate configs for various components:
function devIsLocal(){
$res=false;
$http_host=$_SERVER['HTTP_HOST'];
if($http_host=='localhost')$res=true;
if($http_host=='127.0.0.1')$res=true;
if(subs...
Hi Guys,
I am in a bit of a rut with a cURL issue. The post works greate, the data is POSTED just fine and received ok, but the url of the posted page never appears in the browser after the cURL session is executed, for example look at the following code:
$ch = curl_init("http://localhost/eterniti/cart-step-1.php");
curl_setop...
For a very simple profiling I use microtime() like this:
$now = microtime();
for (...) {
// do something
echo microtime() - $now;
$now = microtime();
}
Now, the output of the echo line seems completely random, that is, I expected fluctuations, but I don't expected negative numbers showing up.
However, a typical result con...
Hi there,
I'm trying to consolidate two WordPress installations into one WP MU install.
Basically, I have example.com/blog and example.com/microsite/blog
I'd like the microsite's blog and the /blog to both be hosted by WordPress MU. Does sunrise help me accomplish this? If not, how would I do this?
Thanks!
...
Suggest me, is it a good idea to make changes in default Joomla code structure?
I need to keep an insert query after every insert/update/delete operation in Joomla administrator code. so that i can track the change i have made.
Is it good idea to make the changes every where in the default code in Joomla default structure?
...
so i want to follow the mvc conventions but haven't really got the hang of it.
i've got problem understanding the explicit difference between a model and a library class and how they relate to each other.
eg. i want to create classes to add/edit contacts and also adding them to a group.
i thought it should be divided into 2 classes: C...
I have a script (Joomla) that creates files and directories on the server. The problem is that it creates them under owner 99 99 (nobody) and after I can't delete or modify them by FTP without the help of the server admin.
I think that is move_uploaded_file function of php.
Is there any solution of this problem by the WHM or by the ser...
i use date function to get day, month and year.
$year = date(y);
$month = date(m);
$day = date(d);
but my hosting is in another place where i am, so i need to add 11 hours.
could you tell me how can i do that?
thanks
...
Hello,
What is the fastes way to add string prefixes to array keys?
was
$array = array(
'1' => 'val1',
'2' => 'val2',
);
needed
$array = array(
'prefix1' => 'val1',
'prefix2' => 'val2',
);
According to http://www.phpbench.com/ (see Modify Loop) I should use "for" statement, but probably there is more elegant way?
Thank you...
Hi, I have some HTML errors in my output source code, coming from one of the .tpls. I'm wondering if there is a tool that is able to give me a list of .tpls that are used on the current page. I can't seem to find this error and the site isn't very well documented. I'm not the best PHP programmer, I'd be looking for an online resource or ...
I'm writing the code for a controller method and I need to use it to send an email. I'm trying to use heredoc syntax to fill in the email body, however, the closing tag doesn't seem to be recognized.
$this->email = new Email();
$this->email->from = 'Automated Email';
$this->email->to = '[email protected]';
$this->email->subject = 'A new ...
I have a full CMS and I want to integrate it with phpbb.
Basically I want when user registers -> registers with phpbb and same with login.
Is there any good tutorial or something that can help me?
...
how do you trigger a MVC application.
im only used to use procedural coding. since everything are classes, how do i trigger the first method, where should this method be put, and what should the class holding this starter method be called?
thanks
...
I'm trying to learn PHP and I wish to know if there are some function equivalence constructs:
In JS I can do:
var t = function() {};
t();
myObj.DoStuff = function() {} // here I add a method at run-time
myObj.DoStuff();
myObj["DoStuff"]();
var j = myObj.DoStuff;
j();
and so other things with function evaluation.
In Js objects are...
Hi
I've been testing nuSoap with codeIgniter (PHP Framework) but seems nuSoap isn't prepared to work with latest php 5.3, even if I download a patched nusoap version for php 5.3
I have the following code:
require_once(APPPATH.'libraries/NuSOAP/lib/nusoap'.EXT); //includes nusoap
$n_params = array('CityName' => 'San Juan', 'CountryName'...
Hello All,
First, thanks for all the help I've received so far from StackOverflow. I've learned much.
Once again, I'm posing a rudimentary question that I've searched on, but cannot find the exact answer to. Here or on PHP.net.
It's sort of like what this guy asked, but not exactly: http://stackoverflow.com/questions/288603/mysql-t...
I have an encrypted string that was encrypted with Perl Crypt::CBC (Rijndael,cbc). The original plaintext was encrypted with encrypt_hex() method of Crypt::CBC.
$encrypted_string = '52616e646f6d49567b2c89810ceddbe8d182c23ba5f6562a418e318b803a370ea25a6a8cbfe82bc6362f790821dce8441a790a7d25d3d9ea29f86e6685d0796d';
I have the 32 character...
i wanna using curl in php script and run it in command line mode.
here is the script
<?php
//enable_dl("php_curl.dll");
$ch = curl_init();
$options=array(
CURLOPT_URL=>"http://test.com/wp-content/themes/bluefocus/images/desc_img.jpg",
CURLOPT_BINARYTRANSFER=>true,
CURLOPT_VERBOSE=>true
);
curl_setopt_array($ch,$options);
...
I am working on my diploma thesis project. I have access to 32Node Dell poweredge HPC cluster system with Linux(Debian i think) installed on it. My first goal is to create web (PHP) app where logged users could see free and busy nodes, turn them on and off. I am planning to do something like this - write some cron daemon that would run e...
So, if you try to do a nested class like this:
//nestedtest.php
class nestedTest{
function test(){
class E extends Exception{}
throw new E;
}
}
You will get an error Fatal error: Class declarations may not be nested in [...]
but if you have a class in a separate file like so:
//nestedtest2.php
class neste...