php

do sessions work when cookies are disabled?

if the user has disabled cookies in the browser, do sessions work? cause i know there is a session cookie in the client when i create sessions. ...

How to change orders of array in PHP?

$a = array(0=>'a',1=>'b',2=>'c', 3=>'d'); I want to change the order to be 3,2,0,1: $a = array(3=>'d',2=>'c',0=>'a', 1=>'b'); ...

Regex to parse links containing specific words

Taking this thread a step further, can someone tell me what the difference is between these two regular expressions? They both seem to accomplish the same thing: pulling a link out of html. Expression 1: '/(https?://)?(www.)?([a-zA-Z0-9_%]*)\b.[a-z]{2,4}(.[a-z]{2})?((/[a-zA-Z0-9_%])+)?(.[a-z])?/' Expression 2: '/<a.*?href\s*=\s*["\'...

PHP preg_replace - Regular expression not including a phrase

$test = "<div><b><i>#uniquetag#</b></i></div> <div>Keep this</div>"; $test = preg_replace("/<div(.*)#uniquetag#(.*)<\/div>/i", "#uniquetag#", $test); I want the result to be $test = "#uniquetag# <div>Keep this</div>"; But it returns $test = "#uniquetag#"; I think I know why. (.*) is greedy and it extend the search till the end...

Input text and special characters and MySQL

I have a simple textbox in a form and I want to safely store special characters in the database after POST or GET and I use the code below. $text=mysql_real_escape_string(htmlspecialchars_decode(stripslashes(trim($_GET["text"])),ENT_QUOTES)); When I read the text from the database and put it in the text value I use the code above. ...

Implementing chat system with in Web browser

We want to have web based application to track the issues, knowledge management and chat system. Once the user logged in, user can chat with the service engineers. We will be using Ajax for Chat within the browser. But the server-side we are not sure how to implement chat? The chat history must be saved for lateral viewing. When someone...

paypal subscription, payment information update

I am trying to design a web application(using php and mysql) in which I will ask my clients to pay via paypal subscription, which detects money from the clients paypal account automatically and transfers it to my paypal account. Now when a client logs into my web application after 3 months of time, is there a way my web application to k...

PHP & APC: One object in cache with multiple keys?

I'm implementing object caching in a PHP application using APC. The issue is, that sometimes I will select something from the database based on different criteria. For instance, when a user logs into the web site, all I have is his username and password, so I'm going to select from the database based on the username. In other situatio...

Why I can view my php source code online?

I have this weird problem. I purchased a very well-known 3rd-party php-based forum software. Uploaded to my server, run it for few weeks. This morning, when I visit my site, it display ALL the php code, including all the comments etc, like what you will see if you open it with notepad. VERY scary, my database config which is in php file ...

How I can use i18n Doctrine Behavior??

I'm trying to make this behavior works, but i don't know where it's crashing. How do you use this behavior? ...

Should http be used for https login subsequent pages?

I've seen many threads on SO and they suggest that password can't be securely transferred without SSL. So suppose I've https login page but Should I switch back to http after user has been authenticated over https (assuming no sensitive information is sent over after login)? Because it might load page a bit faster? Would it create ext...

create a chat application in php

im tryig to create a chat system using php and javascript .i wonder how the chat in gmail works, will will remain in the same position even if we are going through dirrerent pages.it will be greatful if anyone clan explain me how it works. And at the same time please give some ideas to create a chat s/m, like creation f the popup window...

PDO::MYSQL_ATTR_USE_BUFFERED_QUERY and multiple delete statements in prepared statement

I am trying to use a prepared statement that deletes from two (temporary) tables: public function clearTempTables() { static $delStmt = null; if (null == $delStmt) { $delStmt = $this->pdo->prepare("DELETE FROM product_string_ids; DELETE FROM product_dimension_valu...

Asp.Net, PHP, JSP What other popular languages for HTML pages generation are there?

Asp.net, php, jsp What other popular (used alot in production) languages for HTML pages generation are there? ...

Building search to the website

I have a website which has about 200 to 300 static public pages. I am required to bring about some kind of search functionality on the website which will search all of its public pages. I don't want to use external tools like Google site search, etc. Is there a tool or open source code that will index the content and then display the sea...

How to get started with PHP themes?

I have a web application developed using PHP. I want my users to select themes for their pages throughout the application. Where should I start before using PHP themes? What should I know about Themes in a PHP application? Edit: My question about themes is only about changing the color of the layout, not the images. Suppose My ADM...

PHP: run class method when another class method is run?

PHP: run function when a specific class method is run what I want is to run some additional functions when a class method is run without altering the already existing class. how? ...

Get content from a url using php

Hi, I want to get the dynamic contents from a particular url: I have used the code echo $content=file_get_contents('http://www.punoftheday.com/cgi-bin/arandompun.pl'); I am getting following results: document.write('"Bakers have a great knead to make bread." ') document.write('© 1996-2007 Pun of the Day.com ') How can i get the...

Should I create new objects every page load or pass them page to page in PHP?

With PHP and MySQL I am working on a user login type site. Here is my plan so far. User logs in with email/password I then set a few things into session (UserID, photoURL, userName, latitude, longitude, gender) These are the basic items that will be saved into session and possibly APC/Memcache when a user is "logged in". I have my...

PartialLoop with Zend_Paginator Object Issue

Is it possible to use the findParentRow() method from within a Zend_Paginator Object? I'm trying some code that works fine on an object returned by fetchAll from a DB resultset and works fine. With the Zend_Paginator object it doesnt work though. In my controller i have: public function downloadedAction() { $images = new Model_Appl...