php

Know a .htaccess mod_rewrite work around for loading xml files?

Here is my current htaccess code: (turn engine on and such) RewriteRule ^foo.xml$ bar.php [NC] This code works fanstastic on domain names like foobar.com, etc. It does not work for temporary domains like such: bar.com/~foo/ Is there a work around for this? Any help greatly appreciated! ...

How to get data from xml that is sent to my script via http post?

A vendor is going to be sending me some xml via an httppost to a script I am going to make. The script, when receives the httppost I need to somehow get the data from the xml and put it into my data-base. I do have experience with all 3, PHP MYSQL and XML. I do know how to get values from XML using E4X but I do not know how to get value...

What web video formats can do this?

I'm at a loss here--trying to come up with the best way to embed a video in a web page such that it can start playback at a specific frame number programmatically (not a simple timeline bar like youtube). ...

What is the overall design philosophy of php?

I recently had my first encounter with PHP (5) through a Drupal application for a client. There was certainly nothing difficult about the experience (documentation is good for instance), but I never had a moment where I thought, "that's really clever!", or "wow this is fun to use!" Moreover, I couldn't accurately predict how functions we...

Why not just using ajax for Page Requests to load the page content?

Very much Webpages loading all their content to change little informations. Now i would like to know why shouldn´t the developers use ajax for the main page requests? I will like to develop the main requests on my webpage with ajax but i dont know any cons. Has anybody an idea why anybody shouldn't use ajax so much? ...

Mailer Error: SMTP Error: The following SMTP Error: Data not accepted.

The following code gives the message Mailer Error: SMTP Error: The following SMTP Error: Data not accepted. But when I replace $EmailAdd with a [email protected]. The mail was sent. What's wrong with my code? I'm kind of new in php, especially in dealing with mail functions. $sql1 = "SELECT Email_Address FROM participantable where IDno=$st...

Using DOMXPath to replace a node while maintaining its position ...

Ok, so I had this neat little idea the other night to create a helper class for DOMDOCUMENT that mimics, to some extent, jQuery's ability to manipulate the DOM of an HTML or XML-based string. Instead of css selectors, XPath is used. For example: $Xml->load($source) ->path('//root/items') ->each(function($Context) { e...

How do I properly format this json object in PHP

I need to be able to create a data structure in PHP which creates for instance, an array of car vendors. Each of those arrays, has child arrays which are types of cars for that vendor. So you'd have something like $cars['toyota'] = array("camry", "etc"); I need to be able to create this data structure in PHP so that on the JavaScript ...

Recursively counting files with PHP

Simple question for a newb and my Google-Fu is failing me. Using PHP, how can you count the number of files in a given directory, including any sub-directories (and any sub-directories they might have, etc.)? e.g. if directory structure looks like this: /Dir_A/ /Dir_A/File1.blah /Dir_A/Dir_B/ /Dir_A/Dir_B/File2.blah /Dir_A/Dir_...

Symfony routing problem

I've set a website up. If I try and click on a link such as register I get the following error: 404 | Not Found | sfError404Exception Empty module and/or action after parsing the URL "/trevelyan.alumni/register" (/). The links are generated using <?php print link_to( 'Register', 'register/index' ); ?> And I have a 'regi...

Parsing SQL string

What is a good method for parsing an sql string into it separate components. I'v tried with a regex, however I can't get it to work just right. Say for instance: "SELECT * FROM tbl WHERE user_id > 50" Would create an array with all the components $arr[0] = "SELECT"; $arr[1] = "*"; $arr[2] = "FROM"; ect... Thank you ...

PHP MySQL insert dropping data

Ok this is a new one for me. Basically I have a table articles: id: int auto increment title: varchar(200) description: varchar(1000) ctext: longtext chtml: longtext Now I do an insert into this table with mysql_query: INSERT INTO articles (title, description, ctext, chtml) VALUES ('$title', '$description', '$text', '$html') All v...

Updating MySQL using SESSION variables via a jquery javascript function

I currently have a javascript file 'score.js' which makes use of jQuery.js, which is being called correctly via a link. The code in score.js is: function originalUpdateScore(answer,correct){ if (answer == correct) { $.post('updateScore.php'); } window.location.reload(true); } This function calls 'updateScore.php': <?php inclu...

Strange 5 second pause with PHP command line interface (related to mysql/mysqli extension)

Hello, I'm getting a strange 5 to 7 second pause when executing PHP scripts from the command-line PHP client (PHP 5.2 on Windows). During this pause the PHP script just appears to 'freeze' for a while before returning to the command prompt. It is not using any significant CPU time, it's like it is waiting for some delay. After experi...

Accessing a class that has been instantiated by a method within a separate class

In a nutshell: how do I access the methods of a class that is instantiated by a method of a different class? There is a bit of code I am looking at right now that does the following (altering the code is not an option, btw. It isn't mine... I'm just decipher it): A class has a method that instantiates a different class. It looks someth...

access LAST_INSERT_ID() from php after calling a stored procedure

hi all, i have defined a stored procedure (let's call it proc_create_node(parent INT)) in mysql which does an insertion. when i call it from the mysql cli, doing the following works just fine: CALL proc_create_node(12); SELECT LAST_INSERT_ID(); and i get the last inserted id: +------------------+ | LAST_INSERT_ID() | +-------------...

cookies created in wordpress (latest)

i just installed wordpress (the latest) and im trying to study wordpress to make my creations secure like wordpress does or to its level. I noticed upon logging into wordpress, it created 3 cookies. what I'm trying to figure out is - after logging into wordpress and after it created the cookies for the user. the hash values that are i...

Fetch the list of shared drives using PHP on Windows?

I want to display the list of shared drives connected to my system running Windows. Is there any tutorial for this? I have tried the following code in PHP: echo "<select id = 'drives'><option>Drives</option>"; for ($ii=66;$ii<92;$ii++) { $char = chr($ii); if (opendir($char.":/")) echo "<option>".$char."</option>"; } ec...

How to use php sessions in xslt?

How do I use php sessions in XSLT for example for making a shopping cart for a webshop? A user can browse the site and click "Add to cart" on several items. Each item should then be stored in a session variable. The user can at all time view the items selected by clicking "View cart". ...

How can I call a static method on a variable class?

Hi, I'm trying to make some kind of function that loads and instantiates a class from a given variable. Something like this: <?php function loadClass($class) { $sClassPath = SYSPATH."/classes/{$class}.php"; if (file_exists($sClassPath)) { require_once($sClassPath); $class = $class::getInstance(); } } ?> If I use it like...