I'm playing around with the SPL autoload functionality and seem to be missing something important as I am currently unable to get it to work. Here is the snippet I am currently using:
// ROOT_DIRECTORY translates to /home/someuser/public_html/subdomains/test
define('ROOT_DIRECTORY', realpath(dirname(__FILE__)));
define('INCLUDE_DIRECTOR...
I just don't see the problem. Need some new eyes to review it. Two files included test.php and test2.php to var_dump. Help!! Cut, Paste and Run - Thanks
test.php:
<?php
ini_set('error_reporting', E_ALL );
ini_set('display_errors', "1");
?>
<style type="text/css">
div.tabcontent{
visibility: hidden;
position:absolute;
left:20px...
I am currently working on a PHP project which includes extensive database usage. The basics are: I have a PDOFactory class which follows the Factory pattern and an abstract SQL class with static methods (just a container for those methods) which in turn talks to PDOFactory
As I said, the project involves extensive database usage, so the...
I have a Social Security number showing up like this:
1234567890
I want to show it like this:
###-##-7890
So, basically, masking the first five digits and entering hyphens.
How can I do that? Thanks.
...
I have a PHP script that goes thru all urls in the database, checks which http code they return and then update the row. It's a simple do/while loop. In each iteration it fetches url and uses curl_getinfo() to get headers.
Script worked great but after a while I noticed that PHP was using 99% CPU and speed of one check was really, reall...
In the middle of a period of big refactorings at work, I wish to introduce stdClass * as a way to return data from functions and I'm trying to find non-subjectives arguments to support my decision.
Are there any situations when would it be best to use one instead of the other ??
What benefits would I get to use stdClass instead of arra...
Can someone tell me if are the answers for this questions are correct
Q: Type-hinting and the instanceof keyword can be used to check what types of things about variables?
Answers (choose 3)
a) If a particular child class extends from it
b) If they are an instance of a particular interface
c) If they are an abstract class
d) If they h...
Hello, I have a DOM object with loaded HTML markup. I'm trying to replace all embed tags that look like this:
<embed allowfullscreen="true" height="200" src="path/to/video/1.flv" width="320"></embed>
With a tag like this:
<a
href="path/to/video/1.flv"
style="display:block;width:320px;height:200px;"
id="player">
I'm havin...
I am not able to find a code to filter this in PHP..
I do have multiple urls for example :
www.google.com
www.twiter.com
www.facebook.com
www.youtube.com
www.techcrunch.com/webroot-brightcloud/
www.mashable.com/hello-how-are-you/
www.yahoo.com
www.msn.com
what I want is I need to filter domains with sub directories or pages. here in ...
If a phpinfo() dump is shown to an end user, what is the worst that a malicious user could do with that information? What fields are most unsecure? That is, if your phpinfo() was publicly displayed, after taking it down, where should you watch/focus for malicious exploits?
I'm wiki'ing this up, so that we can compile answers.
...
How can i get source code for ziparchive class itself.
...
how can i show new friend request in home page using php
...
Hi ,
I downloaded the mapi folder from zarafa site ,
Am working on the Z-PUSH open source ,
To RUN Z-Push Mapi extension is required ,
So i downloaded from zarafa site,
Tell me now, where i paste the mapi folder ,
But i configure.php , they are mention path like
/usr/share/php/mapi
But i dont have any path like this ,
My pres...
Can anyone send me the code to send SMS(short Message Service) via php.
Thanks in Advance.
Regards,
Chandru
...
UPDATED: I've simplified the code (tried to)
I'm trying to download a series of images as set in an array, but something is clearly not right:
function savePhoto($remoteImage,$fname) {
$ch = curl_init();
curl_setopt ($ch, CURLOPT_NOBODY, true);
curl_setopt ($ch, CURLOPT_URL, $remoteImage);
curl_setopt ($ch, CURLOPT_RETU...
if an user login in his/her home page then he needs to see his friennds, i hane one table name
frienddetails containing userid and friendid,and another table name profile containg userid,name.now how can i show user's friend in the home page? the friend details need to show in user home page,but that is in the table named profile.
...
String comparison in PHP seems little difficult. I don't know if any other ways to do it.
For example say:
$t1 = "CEO";
$t2 = "Chairman";
$t3 = "Founder";
$title = "CEO, Chairman of the Board";
if (!strcmp($t1, $title)) {
echo $title."<br>"; echo $Fname."<br>"; echo $Lname."<br>";
} else if (!strcmp($t2, $title)) {
echo $titl...
how can I regenerate random decimal from -0.0010 to 0.0010 with php rand()? or any other?
...
Dear all, I have asked a question about random generating -ve +ve decimal value here:
http://stackoverflow.com/questions/3206563/how-to-generate-random-ve-ve-decimal-with-php
But now i have another more challenging problem. May I know how can I generate random integer with -ve +value with a different set? like from -552 to 2200 as an e...
In my PHP application, I used UserName & Pwd and check the user table in the database to check the validity of users. After the login is successful, I stored the credentials in the Server Session as below:
$_SESSION['username'] = $username;
$_SESSION['pwd'] = $pwd;
And I checked the session to ensure that the user has already logged...