php

Clear session variable after use

Is it possible to use a session variable, then unset it directly after? Example: //==== //Process Form if ($_POST['Submit']) { $update = $userSettings->update($_POST); //If there are form errors if (!$update) { //Load the errors into an array $errors = $update[1]; } else { //Set the session ...

how can i create the menu that will open only the article in joomla?

I have created the articles and menu items that links to that articles. This all works. But now what I want is, when I click on the menu, it should open up only article (without any template feature, no header , no footer and not even the menu).I am opening the article in a new window. From googling what I found is if I add &tmpl=compo...

Getting Logged Out During Navigation

Hello, I am using a PHP / MySQL login system. With a new browser session, I tend to get logged out as I navigate the site. Any tips on how I can go about fixing this? Thanks in advance, John W. ...

apache, php config

I'm running a php application which responds to the client in about 1 minute (keeps loading all this time) . However the response is displayed all at once so I would like to know if there is any config in the apache server/php to display the response at the time is processed . For example I have echo "test"; $rez = file_get_contents(...

security issue: php login/logout script + back button

I am using a login script that stores a session value $_SESSION['logged_in'] = 'yes' when user enters correct user/password. On logout, this session value is set to blanks. However user can hit back buttin a few times and get logged back in. I have also tried $_SESSION = array(); and session_destroy(); but with same results. ...

file downloader with php to webpage

Hi! I develop an webpage and I would like to create an download section. I have an php code to download files, but I have tried it for many times, but it doesn't work. I see continuesly the error message, but the picture.jpg file is in the same directory than the download.php and the index.php. I don't know what the problem is. The con...

Handling the '.' character passed to a MySQL query via url

I've hit a bit of a snag with one of my projects. Like a lot of nerds, I decided to create my own video game review site. Reviews are stored in the database, and can be retrieved via the title of the game with a url like: http://www.example.com/reviews/{gameName}/{optional pageOfReview} Unfortunately, when testing edge cases, I came ...

What is the easiest way to use Google AJAX Language API to detect language with PHP?

There is an easy way to use the Google AJAX Language API to detect language with PHP without use any library or a giant framework? ...

php backslash find and replace

I am trying to do a simple find and replace within a string with: $share_name = str_replace(" ", "\ ", $share_name ); Unfortunately for some reason it replaces all the spaces with "\\ " instead of "\ ". Does anybody know whats going on and how to solve this problem? ...

Problem using PHP imap functions

I'm trying to build an email message parser for our site. What I'm eventually going to do is iterate through the messages that have attachments and save the attachment if the message comes from a particular email address. This is just the initial test, however, I am running into problems, see comments below. <?php echo "Loading..."...

Call to a member function getDOM() on a non-object

I'm trying to create a PHP function that adds an event to a google Calendar. It appears to be building the object correctly but it throws a "Call to a member function getDOM() on a non-object in FeedEntryParent.php" error when trying to add the event. Here is the abbreviated class with only the constructor and the function that adds th...

Secure login with Twitter oAuth - best practice

Hi, I am new to oAuth and looking to build a web application using Twitter (oAuth) to authenticate. There will be no other login method other than via Twitters oAuth. I am looking for advise on best practice to secure the site based on tokens. Here is my plan: User is taken from my site to authenticate via Twitters site Generate Ac...

user can log back in in IE after logging out by hitting back button

I am using a PHP login script that challenges user for username & password. Once authenticated program stores a session value. On logout, session value is set to blanks. Here is the problem: In IE 8 (not Firefox), user can hit back button a few times until the screen which shows "Web Page has expired" message. This is likely the logi...

Notice: Undefined variable

With error_reporting(E_ALL); removed, my script works fine, however when I uncomment it, the following notice appears: Notice: Undefined variable: messages in /home/www/test/register/html/form_1.html.php on line 11 On line 11, there is a function, which basically iterates over an array argument: function displayMessages($array) {...

"caching" an array of database values in php (2 options, which is better?)

(I use the word var in the following because I'm not sure what it is I think it's a global variable for the class) I want to cache values that are gotten from a table in a database, to save repeated queries. What I've done is create a singleton class which has a function to check a var within the class if a key exist, if it does then ju...

Enabling a '.equals' equivalent for PHP5 Classes

Greetings, I've got two instances of a PHP5 Class (say ClassA), and I want to compare to see whether they are equal. In C#, I can write a .equals(ClassA other) method for ClassA, which will be overloaded onto the == operator. Is there an equivalent way in PHP5 to overload a method in a class and have that be used for == comparison, ...

Is it better to sprinkle PHP blocks in a document or use PHP DOM with anchors?

What's the best way to create an HTML document using PHP? I find that using <?php ?> blocks becomes quite messy when the page has a lot of dynamically generated content. I was thinking about using a PHP DOM manipulation library to insert the dynamic content into "anchors" into the document. This would result in a cleaner document layout ...

loading value into a select?

when loading my form (from variables) i can easily set the value of most text form items with the value tag like this: <input type="text" name="fname" id="fname" value="<?php print "$fname";?>" /> how can i do the same with select input form elements? i guess i have to use a script? thanks a lot ...

Converting a time string to UNIX timestamp

Hi How can I convert a time string like this: 30/7/2010 to a UNIX timestamp? I tried strtotime() but I get a empty string :( ...

How do I give Symfony templates a CSS class based on their navigation path

I am trying to render templates in Symfony with a CSS class to denote which part of the site they belong to. For example: I am in /games I'd like the page to look something like: <div id="wrapper" class="games"> <!-- content --> </div> Or if we are displaying /home/profile the page would look like this: <div id="wrapper" class="home...