I am about to create a collection of classes in php which are interrelated. Now I would like to include files using their absolute path, ie
If I were in
'/com/mysite/licences/Generator.class.php'
I would like to include files like this:
include '/com/mysite/lib/Utils.class.php'
I don't want to include like this, I think it is co...
Hi
here is my code
function check($dt) {
$date = date("Y-m-d");
$start = new DateTime($date);
$end = new DateTime($dt);
$diff = $start->diff( $end );
return $diff->format( '%d days' );
}
print check('2009-12-14');
that prints 29 days
where am i wrong ?
...
Hi,
It's possible to know if a MySQL server is overloaded (with PHP), and if it's overloaded show a static page (something like Twitter's fail whale)? How can I do it?
Thanks!
...
I'm developing a small website where I'm going to allow user to create accounts but I'm quite clueless when it comes to safety around authorizations.
I have built my project in PHP with codeigniter and found a library (Tank Auth) that could handle authorization for me. It stores password in a safe way but I'm still worried about the par...
Hi Folks,
i have got a php-script foo.php
#!/usr/bin/php -c /etc/php5/cli/php.ini -q
<?php
echo 'hello'; // & do some stuff
?>
I call this script not wrapped by a sh-script but using it directly in a cron job.
To get rid of it's output i normally would just create a sh-file which calls
/usr/bin/php -c /etc/php5/cli/php.ini -q foo....
I need the very last valid entry in a database table which would be the row with the greatest primary key. So using mysqli, my query is "SELECT MAX(id) FROM table LIMIT 1". This query returns the correct number(using print_r()) but I cannot figure out how to access it. Here is the main code. Note that the $this->link refers to class with...
I have a php query the returns the following JSON format from a table.
[{"memberid":"18",
"useridFK":"30",
"loginName":"Johnson",
"name":"Frank",
"age":"23",
"place":"School",
},
It needs the following format:
[{"memberid":"18" {
"useridFK":"30",
"loginName":"Johnson",
"na...
Basically I'm using phpbb as a forum of the main site and for images there are captions and in the Control Panel of the forum I added a custom profile field asking if the user if he/she wants amusing or descriptive captions.
The below is something i came up with, but it is horrible, i know, and I'm stuck.
The default captions should be...
So, I have this application that needs to connect to facebook.
It uses php for all of its data access, in older examples of the facebook API, i see people get the UID, and sessionkey from the iframe page, then send them to php and run a function called
$facebook->setUser($UID, $sessionKey).
This is how the majority of the tutoria...
Is it possible to change someone's profile picture via the Facebook API?
...
FTP/PHP question here. On one of my pages I load .txt files from a directory. Pretty simple. I also display the modified date of the text file using this:
date('m/d/Y', filemtime($file));
This works fine on my WAMP server but when I upload the files via FTP, the modified date is changed to when they were uploaded. I'm currently hostin...
i have one php code for button creation
for($i=1;$i<=$n;$i++)
{
$row=mysql_fetch_array($result);
if($row['btn_color']==1)
$btbg="side-button5.png";
if($row['btn_color']==2)
$btbg="side-button6.png";
if($row['btn_color']==3)
$btbg="side-button7.png";
if($row['btn_color']==4)
?>
...
I have a library of classes, all interrelated.
Some files are inside the document root and some are outside using the <Directory> and Alias features in httpd.conf
Assuming I have 3 files:
webroot.php (Inside the document root)
alias_directory.php (Inside a folder outside the doc root)
alias_directory2.php (Inside a **different** folde...
I have the following MySQL InnoDB tables...
TABLE foldersA (
ID
title
)
TABLE foldersB (
ID
title
)
TABLE records (
ID
folderID
folderType
title
)
folderID in table "records" can point to ID in either "foldersA" or "foldersB" depending on the value of folderType. (0 or 1).
I am wondering:
Is there a way to create a CASCAD...
I'm bit confused. I've been building my sites with my own session system, but i'm not sure how secure the php's own session system is. My session system usually just has user id and quite harsh hash, which does not include user name or password for generation. I save the hash in the user database and as a cookie to confirm the user sessi...
Hey guys,
my problem is the following: I am writing a login library.
This library has a function _validation() and this uses the validation library to validate the data.
With using normal validation methods it works just fine, but using a callback function just does not work. It is not called.
I call it like this.
$this->CI->form_vali...
Alright, I may just need a terminology update, but I have been playing in Magento and Joomla, and they do references like
$mage = new Mage;
$mage->block('blockname');
where class Mage through some process I am failing to figure out is calling:
class blockname extends something{
}
Don't quote me on that code, however I am looking t...
Is there a way I can programmatically determine the status of a download in Chrome or Mozilla Firefox? I would like to know if the download was aborted or completed successfully.
For writing the code I'd be using either Perl, PHP or Python.
Please help.
Thank You.
...
how to configure netbeans so when i start open my previous work, it will put cursor into line number i have left them before. is it possible ?
...
This code exports data into a csv file, which is opened within Excel.
When a string has a comma within it, it messes up the order of the data.
I need help modifying my code below to resolve any strings that contain a comma within it, to not to create a new column until after the string.
I am assuming it will pass each string within do...