php

Don't get value when refreshing the page in jquery

When I click on link the value displayed correctly.But when I refresh the page i don't get this value. I have written below code $j("#add_to_cart_action").click(function(e) { $j.em.cart.addSelectedTitle(); }); $j.em.cart.addSelectedTitle = function() { var addcartitemindx = $j("body").data("selected_title").product_id; v...

How can I store a full url that contains a hashmark within a variable?

I'm trying to store a url such as: http://localhost/pro%5Fprint/index.php#page=home in a variable, but I can't find a function that does that. I found plenty of solutions to store the index.php, but it doesn't include the hashmark and what follows it. Is there a PHP solution for this? I did see that I can get the full url including ha...

Need code for pagination in PHP?

I search a pagination script/class/helper in PHP for an Array of data, not for SQL statements. Someone know a solution? ...

Detecting file modification on a remote SMB share using PHP

I'm writing a PHP process that will run on a Unix machine that will need to monitor a remote SMB server and detect new files that are being uploaded to that box via FTP. It's unlikely I'll be able to It will need to detect: New files being created File upload completing Files being deleted If it was an NFS share, I'd try using FAM ...

How to set cookie in jquery?

I want to set cookie so that i get the value after refreshing the page. I have written below code But i am not able to set the cookie. $j("#add_to_cart_action").click(function(e) { $j.em.cart.addSelectedTitle(); }); $j.em.cart.addSelectedTitle = function() { var addcartitemindx = $j("body").data("selected_title").product_i...

Url Rewriting Help

RewriteEngine on RewriteCond %{REQUEST_URI} !^/index\.php RewriteRule ^(.*)$ index.php?q=$1 [L] This should rewrite any url to index.php?q={url}, and it's working. Anyway, http://www.domain.com/ just show a blank page. How can I rewrite / to index.php? (http://www.domain.co.il/index.php dosen't show a blank page..) BTW: This code's re...

Generating XML from PHP functions (what am i doing wrong?)

Heres a simple php script that generates some XML: <?php // create doctype $dom = new DOMDocument("1.0"); // display document in browser as plain text header("Content-Type: text/plain"); // create root element $root = $dom->createElement("page"); $dom->appendChild($root); // loop through all posts while (have_posts()) : the_post(); ...

Unable to Upload file with filename with different extention in php

Unable to Upload file with filename with different extention in php echo basename( $_FILES['uploadedfile']['name']); $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { // header("Location: EHP_Configuration.html"); } else{ // heade...

passing POST array to php function

Can i pass the entire POST array into a function and handle it within the function? such as PostInfo($_POST); function PostInfo($_POST){ $item1 = $_POST[0]; $item2 = $_POST[1]; $item3 = $_POST[2]; //do something return $result; } or is this the correct way of doing this? ...

How should i perform tree traversal in given structure?

Mission I'm trying to find out the count of children in a set of tables illustrated below. The enviroment is LAMP but help in the right direction via other syntaxes are appreciated. Table structure users ----- user_id parent_id user_meta --------- user_id registration_date user_levels ----------- user_id level This basic struc...

why I have to transfer same php script in binary now?

Hello, I had developed a script, earlier I use to transfer it directly without any transfer mode selection, recently i developed and improved it, now I have to transfer it via binary mode, I am using same ftp client (FileZilla), but i have changed my ide from phpDesigner to netbeans. Can anybody Please explain me why is this happening,...

Sending XML data using HTTP POST with PHP

I need to send this XML <?xml version="1.0" encoding="UTF-8"><gate><country>NO</country><accessNumber>1900</accessNumber><senderNumber>1900</senderNumber><targetNumber>4792267523</targetNumber><price>0</price><sms><content><![CDATA[This is a test æøå ÆØÅ]]></content></sms></gate> to a SMS gateway service. The service listens for HTTP ...

mysql error when inserting post data

I dont know where my error is in this mysql query $sql = "INSERT INTO `events` ( `owner` , `title` , `tagline` , `location` , `street` , `citytown` , `startdate` , `enddate` , `active` ) VALUES( '{$username}' , '{$data[title]}' , '{$data['tagline']}' , '{$data['location']}' , '{$data['street']}' , '{$data['citytown']}' , ...

print HTML using php_printer.dll

I want to print using php_printer.dll. I have no problem printing a simple text but it doesn't print HTML file and it prints the tags like : <-h-t-m-l-> <-b-o-d-y-> test <-/-b-o-d-y-> <-/-h-t-m-l-> I don't have any choice other than using php_printer.dll . ...

Regex PHP, Match all links with specific text.

Hi, I am looking for a regular expression in PHP which would match the anchor with a specific text on it. E.g I would like to get anchors with text mylink like: <a href="blabla" ... >mylink</a> So it should match all anchors but only if they contain specific text So it should match these strings: <a href="blabla" ... >mylink</a> <a ...

Nested Set model in PHP/Javascript to work with MySQL

I am using a MySQL Nested Set approach to store the classification of the various products that are sold on the website. I am looking for a nice javascript library to help out with rendering the tree from the nested set approach. I also need a good javascript drag and drop script to re-arrange and update the MySQL table. Are there any g...

How do I make a category for each unique DB entry? (MySQL/PHP)

Hi, I have a contest running, and to look at the results I've made this short code: date_default_timezone_set('America/New_York'); echo "Results tallied at ". date("g:i:s A")."<br /><br />"; $names = array('contestant1','contestant2','contestant3'...); //10 entries $plots = array(); foreach ($names as $name) { $query = $th...

Regex - Return First and Last Name

I'm looking for the best reliable way to return the first and last name of a person given the full name, so far the best I could think of is the following regular expression: $name = preg_replace('~\b(\p{L}+)\b.+\b(\p{L}+)\b~i', '$1 $2', $name); The expected output should be something like this: William -> William // Regex Fails Will...

Add an Outlook calendar event from a link on a web page.

Hello, Anyone knows how i can add a anchor to a web page that will force an Outlook Calendar file download? I need the file to open with outlook and the calendar info to be added to the user's calendar. How can I create the MS outlook calendar files? Is there a standard/documented way I can create these calendar files using a script/au...

Is FirePHP limited by the Firebug console clearing upon redirect?

I am using FirePHP with Zend Framework. When the user submits a form, I wish to output some data to the Firebug console and FirePHP is perfect for the job. This all seems to work fine, except that when my server code processes the form, it then redirects to another page - using Zend's _redirect() - causing Firebug to clear the console....