php

Very Advanced Javascript WYSIWYG editor

I need a solution where a user could enter the URL of a web page in my system. The page would load, and then the user could click a certain section that he wants to change. So basically what I need is, a way to display a web page inside my app (could possibly be done with frames but I'd prefer not to have a horizontal scroll bar), and th...

Possible to get name of current class from an uninstantiated object in PHP?

I know you can use get_class($this) normally but I need to get the name of the class in a static function where the object hasn't been instantiated. See the following code: class ExampleClass { static function getClassName() { echo get_class($this); // doesn't work unless the object is instantiated. } } $test1 = ne...

[MYSQL & PHP] Searching two tables

I currently have following two tables: **files_list** -listid -name -synonym -description **files_tags** -tag_name -listid If someone uses the keyword "dragon ball", at the moment, I use following query to search my_list for possible matches: **SELECT * FROM `files_list` WHERE ( name LIKE '%dragon%' OR synonym LIKE '%dragon%' OR des...

Error loading PHP modules

I'm running PHP 5.2.8 on Apache 2.2.11 on Windows XP SP 3. In php.ini, extension_dir = "C:\Program Files\PHP\ext" extension=php_mysql.dll In error.log: PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\Program Files\\PHP\\ext\\php_mysql.dll' - The specified module could not be found.\r\n in Unknown on line 0 php_mysql....

What's Is the Best File Format for Configuration Files

I am creating a framework in PHP and need to have a few configuration files. Some of these files will unavoidably have a large number of entries. What format would be the best for these config files? Here is my quantification of best: Easily parsed by PHP. It would be nice if I didn't have to write any parsing code but this is not a ...

What to choose to store just one integer? Sqlite? or Text file?

I've build a small web-service in PHP. I want to control the number of calls to a specific API method. I thought at first of using a text file, because it's just an integer. But after taking a good look at SQLite it seemed much more convenient. So the code is just: get the "counter" from SQLite and increment it when that method is calle...

Why won't my PHP return a MySQL stored procedure?

Well I have this MySQL stored procedure that I wrote and if I run the following in phpMyAdmin things return properly: SELECT game_name,urlfriendly(game_name) AS game_name2 FROM games However if I try to run the following code I get the error "Warning: Invalid argument supplied for foreach() in /filepath.php on line #" foreach ($this-...

Can a php class property be equal to another class property?

I want to do this: class MyClass { var $array1 = array(3,4); var $array2 = self::$array1; } and $array2 doesn't work. Do you have a solution/trick to make a class property equal to another class property? Thanks. ...

How do you enable customers use their openid on your website, just like stackoverflow?

I want customers to use their openId on my site. I googled for this but didn't find any good tutorial. I use PHP and MySQL. There is one at Plaxo. But it says we should download something from JanRain.com. I saw the openId module of Drupal. It doesn't want anything to be downloaded. Can anyone tell me what to do exactly? ...

Calling a jQuery function with JavaScript

Dear all I am using JQuery and javascript, I need to Call the JQuery function inside my Javascript. My jQuery: function display(id){ $.ajax({ type:'POST', url: 'ajax.php', data:'id='+id , success: function(data){ $("#response").html(data);...

PHP templating with str_replace?

I think the basic principle of a PHP templating system is string replacing. Right? So can I just use a string to hold my html template code like $str_template = "<html><head><title>{the_title}</title><body>{the_content}</body></html>" and in the following code simply do a str_replace to push the data into my template variable like ...

Can we hack a site that just stores the username as a session variable?

I've developed my website that checks if the user is registered and creates a session variable with the username. It's all that is stored as a session variable. If I want to protect my pages (so that only registered users may see them), I check if the session variable is set. Is this secure? Or can you give a more secure method? ...

Calling flex application from php files

HI all,i need help please..Does anyone have suceeded to call flex application from php-html files?Suppose i got html-php based web,i make a ogin form using html tags.When the user have suceeded login,the login form which was created by using flex will be shown...Please help..Thanks a lot guys... ...

PHP/MySQL - building a nav menu hierarchy

So the final menu will look something like this: Item B Item B-1 Item B-1-2 Item B-1-1 Item A SubItem A-1 SubItem A-2 Item C Based on the following DB records: id menu_title parent_menu_id menu_level weight 1 Item A 0 1 ...

PHP Arrays - Remove duplicates ( Time complexity )

Okay this is not a question of "how to get all uniques" or "How to remove duplicates from my array in php". This is a question about the time complexity. I figured that the array_unique is somewhat O(n^2 - n) and here's my implementation: function array_unique2($array) { $to_return = array(); $current_index = 0; for ( $i =...

Something like overloading in PHP?

I'd like to accomplish something like this: Call a method, say "turn", and then have "turn" applied differently to different data types, e.g., calling "turn" with a "screwdriver" object/param uses the "turnScrewdriver" method, calling "turn" with a "steeringWheel" object/param uses the "turnSteeringWheel" method, etc. -- different things...

Trouble with encoding special chars for URL through text input

So I'm building a simple php application using CodeIgniter that is similar to Let Me Google That For You where you write a sentence into a text input box, click submit, and you are taken to a URL that displays the result. I wanted the URL to be human-editable and relatively simple so I've gotten around the CodeIgniter URL routing a bit. ...

php get directory size

Hello, function foldersize($path) { $total_size = 0; $files = scandir($path); foreach($files as $t) { if (is_dir(rtrim($path, '/') . '/' . $t)) { if ($t<>"." && $t<>"..") { $size = foldersize(rtrim($path, '/') . '/' . $t); $total_size += $size; } ...

Is this code secure?

<?php session_start(); include("connect.php"); $timeout = 60 * 30; $fingerprint = md5($_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT']); if(isset($_POST['userName'])) { $user = mysql_real_escape_string($_POST['userName']); $password = mysql_real_escape_string($_POST['password']); $matchingUser = mysql_query("SELECT * ...

What is the Linux friendly MVC Web based framework with highest amount of developers?

MVC is a great concept, but choosing among all the variety and flavors out there is not a simple task. Very soon we are going to start a new web development project and we want to do it in a solid, enterprise class, long lasting language. We are choosing linux friendly language. Even we know that MONO will allow us to run .NET in linu...