I have a class called "Layout" for the layout of the page, another class called "User" for the user.
Every page I create, I instantiate a new Layout.
When a user logs in, there is a new User instantiated.
How do I get an instance of the layout class to know about the instantiated user? I could also save the entire instance of the Use...
How well does Visual Web Developer 2010 Express support PHP?
...
I have this function in .net code:
public class StringGenerator
{
public static string GenerateString(string hash)
{
return hash.GetHashCode();
}
}
I want to be able to call this from PHP page. Any idea how?
Edit: looking in php documentation, http://www.php.net/manual/en/class.dotnet.php, I see that it possible. ...
We changed servers and installed all necessary software and just cannot seem to pin point what is going on. A simple CURL request does not return anything. Command Line CURL commands work just fine. We are using a wrapper for CURL utilizing streams. Do PHP streams require any out of the ordinary configuration? We are using the latest Lam...
I've finally got this PHP email script working (didn't work on localhost…), but my concern is that it's not safe.
So - is this safe for spamming and any other security pitfalls I'm not aware of?
<?php
$email = '[email protected]';
$subject = 'Notify about stuff';
$notify = $_REQUEST['email'];
if (!preg_match("/\w+([-+.]\w+)*@\w...
For the title field,I want to return node.title,but what I tried is not working:
return array('og' => array('name' => 'og',
'join' => array('left' => array('table' => 'node',
'field' => 'nid'
),
'right' => array('field' => 'nid'
),
),...
I get the following error when trying to start a daemon using Ubuntu 10.04 and the PHP5:
PHP Warning: PHP Startup: Unable to load dynamic library 'usr/lib/php5/20060613/pcntl.so' - /usr/lib/php5/20060613/pcntl.so: cannot open shared object file: No such file or directory in Unknown on line 0
Does System_Daemon try to call pcntl? If s...
I'm building a small chat application to add to an existing framework. There will only be 20-50 users MAX at any one time. I was wondering if I could get away with updating a cache file containing (semi) live chat data for whichever users happen to be chatting just by performing timed queries and regular AJAX refreshes for new data as ...
I am working on a Android app and I have a dilemma. I have a list of Objects. I have to update each of these objects with a database. I have 2 methods:
Method 1:
I can loop through the Objects. For each object I can connect to the server, update it, and then move on to the next Object, and so forth.
Method 2:
I can store th...
function canlink() {
echo '<link rel="canonical" href="http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . '" />';
}
Need one version that removes just & and everything after and another that removes ? and everything after, I've been looking for a clean minimalist solution for the past 2-3 days with nothing close.
Thanks, Bry...
In my PHP code I have this:
$filename = 'data.xml';
$xml = file_get_contents($filename);
$data = simplexml_load_string($xml);
$variable = "";
foreach ($data->file_info as $record)
{
$id1 = $record['id1'];
$id2 = $record['id2'];
}
And it works perfectly fine on the web server, but when trying to view it locally (using xampp) I ...
When should we use session and cookies in PHP? Please specify separately their uses,pros and cons.
...
I get this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order (total, addy, cc) VALUES ('798' , '123 sadf' , '12124123')' at line 1
$total = addslashes(($_SESSION['total']));
$addy = addslashes(($_POST['addy']));
$cc = addslashes(($_POST['...
<?php
if (!isset($_SESSION['loginAdmin']) || ($_SESSION['loginAdmin'] == '')) {
header ("Location: loginam.php");
} else {
include('head2.php');
}
if (!isset($_SESSION['login']) || ($_SESSION['login'] == '')) {
header ("Location: login.php");
} else {
include('head3.php');
}
?>
I'm really stuck at this problem. ...
In my form I am using drop down for showing day, month, year. can you help me to validate the date. I have to validate the entered age is greater than 15. also checking leap year
...
Hello, I have an Apache server running which hosts a php web application. Also, its provides provisions for downloading a file of size around 900MB from it. However, while testing the application I found out that its not possible to pause the downloads and resume them later on.
Could someone help me? Is it an apache property I must chan...
I have lot of textarea fields to add comments and quotes. How can I validate these fields. I checked null validation other than null validation what validation I have to do?
...
Hey guys,
If I have an array structured like this:
$array[index]['first_name']
$array[index]['last_name']
Is there an easy way to implode it into something like first_name last_name,first_name last_name, etc. for all the indices?
Implode didn't seem to do what I wanted for something like this. Currently I'm just looping over the who...
I am new to joomla. I am using joomla 1.5, in that i am having inbuilt folder for openid in libraries. I want to use openid concept in my project. How can i use that and how can i integrate the openid in project ? Anybody guide me the steps of integrating and using please.
...
I have an array such as:
Array
(
[0] => Array
(
[id] => 2
[type] => comment
[text] => hey
[datetime] => 2010-05-15 11:29:45
)
[1] => Array
(
[id] => 3
[type] => status
[text] => oi
[datetime] => 2010-05-26 15:59:53
)
[2] => Array
(
[id] => 4
...