php

Recursive directory searcer PHP

How can i write an recursice directory searcher that takes a geven string and return the whole path plus the filename in php? ...

using JQuery with mySQL confusion

HI, I have code like this. what I am doing is populating the first select with the MySQL data and based on the selection the first , using jQuery, I am populating the second one. Now, my question is, can I use the same combos_get.php to populate the another select based on user selection from the second select? Is yes, then please loo...

Problem embedding a cgi within PHP using system

Hi I am using php system to embed a cgi-script like this <?php echo system('./cgi-bin/rebol-include.cgi'); ?> Problem is my cgi-script writes print "content-type: text/html^/" so that PHP will show up "content-type: text/html" above the html page. This is an unwanted artefact, what's the optimal way to remove it knowing a whole...

Limit Ajax mouseover

I would like to know what's the best way to limit ajax call / time. I'm running the following js function when the user mouseover a table row. function load() { $.ajax({ type: "GET", url: "process/ajax.php", data: "action=action, success: function(msg) { if(msg!='') ...

PHP file naming conventions (.class, .inc)

I see .class and .inc included in file names a lot of the time. My current understanding is that this is just a best practice to make the purpose/contents of the file clear. Is there any instance in PHP where a .class or .inc file name has a special purpose and truly means something? ...

Custom captcha design

Hi there, I currently ran into the issue that I do not have the money to buy/rent any professional captchaing service. So I tried to look around for OS captcha generators, and captcha designs. I also had a brief brainstorm about my own and simple captcha design. Do you have any preferences, or can give me a good advice handling captch...

PHP Determining the current url

I need to modify my function to return also the current folder I am in. Here is my current function: function getLinkFromHost($url){ $port = $_SERVER['REMOTE_PORT']; $server = $_SERVER['HTTP_HOST']; if($port == 443){ $type = "https"; } else { $type = "http"; } return $type . "://" . $ser...

Recursive mod_rewrite for search engine friendly urls

I've been reading through a previous solution to a recursive mod_rewrite problem that is similar to what I'm trying to do, the difference is I'm sending all queries through an index.php file and so don't need to specify the script within the query. Essentially I want to recursively convert any number of parameters within a search engin...

Changing from Web Development Career to C/C++

I have been doing web development for the past 3 years, mainly in PHP and MySQL. Lately I have been changing into the C/C++ area. The reason is that I want to try out something new and expand my skillset before deciding which area I want to focus on. I would like to get advice from you guys about this. Is this a good idea? Is it a bad i...

Why is PHP not including my file when it clearly exists?

Here is the exact problem. I have an autoload function set up with a piece of code that looks like this: if(file_exists($class_file)) { include($class_file); return true; } However, when $class_file is set to a certain value, I get an include error: Error String: include(includes/php/utilities/calendar_event_html.utility.php) [fu...

PHP fopen/fwrite problem on IIS7

I am running PHP5 on IIS7 on Windows Server 2008 R2. Check out the below code which writes a string received via a POST request parameter into an XML file. <?php $temp = ""; if($_SERVER['REQUEST_METHOD']=="POST"){ if($_POST["operation"]=="saveLevels"){ $fileHandle = fopen("c:\\inetpub\\wwwroot\\test\\xml\\levels.xml", 'w'); ...

Codeigniter URI and jquery/javascript

Hello, I have a method in codeigniter that looks like this, public function category() { //$this->output->enable_profiler(TRUE); //echo "Hello function called by ajax"; $table = $this->uri->segment(3); $content_id = $this->uri->segment(4); $data['content'] = $this->site_model->get_content($table, $content_id); $this->load...

How to add a div class to Wordpress Auto Nav?

I have the following code to display all pages into a nav bar in Wordpress <ul> <?php wp_list_pages('title_li='); ?> </ul> Trying to figure out how to add a div class to each li? ...

PHP Script to Backup MySQL Database

Hello. I'm trying to write a PHP script to backup a MySQL database: if ( $db_resource = mysql_connect($db_server, $db_username, $db_password, $db_newlink) ) { if ( mysql_select_db( $db_name, $db_resource ) ) { $backupFile = $db_name."_".date( "Y-m-d-H-i-s" ).".gz"; $command = "mysqldump --opt -h ".$d...

Decoding Window 7 Sticky Notes File

I love the windows 7 sticky note app and need to write a quick script to copy my notes to my iphone (easier than bringing a laptop to meetings). How can I extract my notes from the stick notes file (C:\Users\USER\AppData\Roaming\Microsoft\Sticky Notes\StickNotes.snt). The file stores undo entries, or other meta data, for each note, so I ...

How to handle index undefined errors in CakePHP?

Hi, I got an old PHP system integrated with a new CakePHP one. The problem is when displaying data I occasionally get index undefined errors meaning the models aren't related to where they're supposed to be maybe because there's no validation. There are gaps resulting into models loosing their relationship with a model I'm expecting henc...

how i can open a file in zip file without extract it by the PHP

i just want making a system that can open a file in a zip archive like i have archive.zip in this file.text i want make a class to makr this page zip.php?archiver=archive.zip&file=file.text i want this page show me the file.text contents any ideas? ...

A function to get the smaller number

Hi, I have 2 variables each containing a number (integer). I would like to sort them to have the lowest number first and the second largest. For example: $sortedVar = getSmaller(45, 62); // Will return 45 $sortedVar = getSmaller(87, 23); // Will return 23 Do you see what I want to do? Can you help me please? Thanks :) ...

MySQL MAX shows wrong result for associated data

I am creating a query to pull results from a MySQL database using PHP, the results of the query are output to an Excel document. Here is the query: $sql = "SELECT node, port, MAX(utiltx), MAX(utilrx), time, hour(time), day(time), month(time) FROM intfstats WHERE node IN('$separated') AND year(time)=$year AND month(time)=$month AND por...

Zend Framework: image upload

Hi, I want to upload an image with Zend Framework version 1.9.6. The uploading itself works fine, but I want a couple of other things as well ... and I'm completely stuck. Error messages for failing to upload an image won't show up. If a user doesn't enter all the required fields but has uploaded an image then I want to display the up...