I want to create internal path redirections like in Wordpress e.g.
if i have a post (having permalink = 'hello-world') but still if I type 'http://localhost/hello/', I get redirected to 'http://localhost/hello-world'
So what code do i use to automatically go to that page with that correct URI, i.e. change the URI that gets displayed in...
Excuse what is probably a really basic question but how do I achieve this.
$cache = New Mem;
$cache->event($event)->delete;
Which is called via the function below. Without the ->delete, it works perfectly fine, but I just need to find a way to call the delete thus inside the function.
class Mem
{
function event($event)
{
...
OK, so here's the snippet:
// start rememberMe
$cookie_name = 'db_auth';
$cookie_time = (3600 * 24 * 30); // 30 days
// check to see if user checked box
if ($remember == 1) {
setcookie ($cookie_name, 'username='.$username., time() + $cookie_time);
}
For some reason it breaks and I can't see why. I...
My server time is in GMT, and I do the following whenever someone comes online.
// Set a default timezone
$defaultTimeZone = 'America/Toronto';
// load the user, if they are online...
$onlineUser = new user();
if (isset($_SESSION['user_id']))
{
if ($onlineUser->loadUser($_SESSION['user_id']))
{
$defaultTimeZone = $onlineUser->timeZ...
I have Flex application with UT8-encoding. It is sending back to the Server (PHP), and the data gets written in to Mysql (UT8 charset, utf8_general_ci). I have no problems at all writing/reading Umlaute from/to the database.
I only realized, by looking at the data with PHPmyadmin that the Umlaute get somehow converted to:
ö => ö
ü => ...
I want to know what this looks like. I don't have any ideas about ZendFramework, and that makes me sad. :(
If any one knows of a site which is built in ZendFramework, or has any other experience with it, please do let me know your thoughts.
...
Does anyone know a PHP RegEx to allow only relative paths, not absolute?
For example, I have an AJAX function that submits this value to my PHP script "some-directory/another-directory/some-file.php".
My PHP script then includes that file.... include($some-php-document);
I don't want a hacker to be able to use my AJAX function to subm...
Hello All,
I have a general OOP question.
If I have the following classes in C#
class Parent
{
public string val = "Parent";
public void getValue()
{
Console.WriteLine(this.val);
}
}
class Child:Parent
{
public string val = "Child";
}
Child child = new Child();
child.getValue();
The code outputs 'Pare...
All,
Atlast had our admin install the PEAR SOAP module on our apache server. Now when i try the following code - it is giving me an error "HTTP Bad Request". Can anyone help?
<html>
<body>
<?php
/* Include PEAR::SOAP's SOAP_Client class: */
require_once('SOAP/Client.php');
$zip = $_REQUEST['zip'];
?>
<form action="wszip.php" method="p...
I have an array of objects, and want the objects to be able to reference their 'neighbors' (the next and previous objects in the array). Is there an existing pattern to do that?
Perhaps the array should be wrapped in an object (since the object can be iterated just as well as the array). That's fine too, I'm just looking for an existing...
Hello all,
I have checked my PHP ini file and display errors is set and also error reporting is E_ALL. I have restarted my apache web server. I have even put these lines at the top of my script and it doesn't even catch simple parse errors. For example, I declare variables with a "$" and I don't close statements ";". But all my scripts ...
I'm using SimpleXML and xpath to read elements from an external UTF-8 XHTML document. I then iteratively echo the output of SimpleXML's asXML() function executed upon each element returned from an xpath selector. But the XML carriage return entity is annoyingly inserted after every line of my code. There aren't any extra characters in th...
Hello all,
Is it possible to find PHP tmp folder at run time?
I am uploading files and I am making use of:
$_FILES['upfile']['tmp_name']
However, one of the APIs I am making use of requires that I have to give the full file path of the uploaded file relative to my script! A bit annoying but it has to be done.
Any ideas on how I can...
One of Googles Let's make the internet faster talks included something about using echo with multiple arguments in PHP instead of using print or string concatenation.
echo 'The ball is ', $color;
Rather than either of these
echo "The ball is $color";
echo 'The ball is ' . $color;
What if output buffering is in play ?
What would be...
Hello I'm building my own PHP MVC framework. Not with the intention of using it. But I'm trying to learn PHP5 OO and the MVC design pattern.
I've read a lot of tutorials and got the basics working but now I'm stuck since things are getting more complicated.
My framework uses the following URL structure: /controller/action. Optionally f...
Hello all,
I have just uploaded an image to imageshack using their API and I am trying to save that image path that I get back from imageshack.
$mgr->setUploadUrl('http://www.imageshack.us/index.php');
$fileImagePath = $row['cr_path'];
echo $fileImagePath.'<br><br>';
$res = $mgr->upload($row['cr_path'], 'image/jpeg', 'avaojo');
$n...
I have a content type called fund.
The contents of this is in node-fund.tpl.php which is inside of page.tpl.php
I have a requirement to recreate the content of fund but without page.tpl.php
So to be clear, i need to have 2 pages
1) fund inside page template
2) the fund data but completely reformatted. The plans is to create pages th...
What happen when you try to add a variable into APC and the APC cache is full? Does it automatically remove least used variable from the cache?
Thanks.
...
I have some very large processing being done in a php application.
I'd like to use one of those scripts/programs which analyze the execution and show you which line of code, or which function, took how much time processing, etc.
Any recommendations?
I'm using the codeigniter php framework so anything that works with it out of the box...
I see so many PHP comments in the format of:
/**
* (c) Copyright Someone 2009
* legal crap
* blorp
*/
Is this just by convention, or is there a reason? I thought it was just a way that some people did it, but I am now wondering after I discovered that my syntax highlighter does this:
This only happens when I've started to use th...