php

Does the PHP autoloader function also work with static method calls?

I slightly remember that autoload worked with the new statement. Now how about when I have several utility classes and I want to autoload these? And I only use static methods? Like: MathGuru::calculateFoo($bar); Would autoload load MathGuru here? Or must I include it manually? ...

Can I include a class inside an method?

Just for the case the autoload thing won't work, I wonder if it's fine with PHP to include a class inside a method? Example: public method doSomething() { include ('MyClass.php'); $foo = MyClass::doAnotherThing(); } ...

I want to create a pop up box on a site i am working on, i like the pop up box facebook and linked in has, how do i create it?

I want to create a POP up box on a site i am working on, i like the pop up box facebook and linked in have, how do i create it? is there a code or something? Can anyone help me? ...

What do I need to have feed for my CMS?

I have my own CMS(PHP/MySQL) and I want to add 3 or 4 different feeds. I am not really sure what(kinds of codes) I need to add to my CMS. Could anyone guide me the right direction please? Thanks in advance. --Edit-- Is there any application which convert my website to xml? --Edit-- Is there any codes which I can use ? Any resources...

organizing technical and user-facing error messages in php

I'm having a little trouble organizing my error messages for two interacting classes. One object has states that are 'error-ish', where something went wrong, or happened unexpectedly, but the situation is still salvageable. I don't want to use exceptions, 1. because they only have a single string for the message, and 2. because I want to...

PHP question on while query

Hi, Could someone help me figure out how to do this. I have a game where a player can use potions to enhance their abilities. This is on a timer which works fine. However Im now looking to add to this query when the player uses 2 different type of potions. I can get it to work but not 100% how I wish. Player uses potion 1 and their s...

jQuery post options

Hey, I just can't work it out. I need to send a POST request to PHP backend. It should be the following: Array ( [username] => 'username' [password] => 'password' [action] => 'login' ) I have a form as a frontend and i use .serialize() to get the user and password. But how can i add the action key/value? For now i just add the str...

Php syntax error, little help...

I have this string: $imagename ="$ad_id_stripped"."_1".".jpg"; $display_table.="<a href='../ad.php?ad_id=$row[ad_id]' target='_parent'> <img style='border:none;' src='../ad_images/$category/thumbs/$imagename?time()' class='shadow'></a>"; echo $display_table; As you maybe can see I am trying to add the time() function in there... Howe...

Converting these types of unicode to UTF8 in PHP

Hi, I am trying to convert this in to readable UTF8 text in PHP Tel Aviv-Yafo (Hebrew: \u05ea\u05b5\u05bc\u05dc\u05be\u05d0\u05b8\u05d1\u05b4\u05d9\u05d1-\u05d9\u05b8\u05e4\u05d5\u05b9; Arabic: \u062a\u0644 \u0623\u0628\u064a\u0628\u200e, Tall \u02bcAb\u012bb), usually called Tel Aviv Any ideas on how to do so? Tried several methods...

Can I use an exception with a database query?

Is it possible to use an exception at the end of a mysql query instead of die()? I'd like to throw an exception and log it instead of killing the script. Would it be done like: mysql_query(...) or throw new exception()?? ...

Pass session information from php to python securely? (in agile)

I have a sign up process that is in a legacy framework and we are trying to switch to a new framework...in fact a different language. So let's say that there are 3 steps in the sign up process and each of those 3 steps has it's own file(step1.php, step2.php, step3.php). Now if I want to change page2.php to a python file I will still need...

OpenID Directed Identity/Identifier Selection in PHP

I'm trying to implement an OpenID server in PHP that supports identifier selection (some call this directed identity, which is actually a more specific case of identifier selection). That is, a user can enter a generic URI as their OpenID identifier, log in, and choose what identifier to return to the OpenID consumer. For example, if a...

Should I use Database Sessions or Native PHP File Sessions?

I've just moved over from my own MVC framework to a community supported one (CodeIgniter). I'm just converting my sessions over to the CodeIgniter functions and am noticing that they, by default, store the session data in an encrypted cookie. The alternative they offer are database sessions but not server-side file sessions like the na...

Strategy for unique user-voting such as Stackoverflow's?

I noticed that for voting SO implements an XHR method which POSTs to a posts controller and sends the post ID and vote type through the URL, in addition a fkey parameter is sent, eg: http://stackoverflow.com/posts/1/vote/2 I'm going to be implementing a similar technique, I'm wondering what logic I could use to prevent duplicate votin...

Using XDebug to trace a PHP web service page

I'm using Eclipse and XDebug to develop a PHP application that relies on web services. I have test pages that consume my services in 2 ways: AJAX (using jQuery) and cURL. I add breakpoints to my service page and launch the debugger. When I call the the service from AJAX, execution stops nicely at the breakpoint, and I get my variables, ...

sort array in DESC order

how can i get this order array( 4 => 'four', 3 => 'three', 2 => 'two', 1 => 'one', ) from this array( 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', ) ...

PHP eval returns null but a return is called

Hi all, I have a, I think fairly easy, question, but I can't figure out what I'm doing wrong. I have a function which i call with PHP's function eval. I'm expecting an, selfbuilt, ArrayList to get as a result. But instead when I use gettype I see the result is NULL. Even though I'm using return in the eval-ed function. As far as I'm a...

Does heavy traffic cause CSS malfunctions?

Hello all, I just launched my site yesterday and everything was working as is. I have a blogs community page, and a questions community page that each have a top blogger/top commenters section, as well as a top askers/top answers section. They all share the same CSS and have an image that holds user pics that use CSS to align properly I...

News Feed Database Design Efficiency

Greetings All, I've seen similar questions asked before with no conclusive or tested answers. I'm designing a News Feed system using PHP/MySQL similar to facebooks. Seeing as this table could grow to be quite large -- any inefficiency could result in a significant bottleneck. Example Notifications: (Items in bold are linked objects) ...

What is the best way to create a PHP login page?

I'm fairly new to PHP and am looking for some best practices on how to implement authentication in PHP. I'm an evangelist for Adobe and one of the things that annoys me is when people use Flex/Flash for the login screen. So I want to do a blog post/example on using an HTML/PHP login page and then passing the session information to Flex...