php

Mulitple Sites with common files

I have developed over 50 sites that all use the exact same files other than CSS and IMAGES, i currently duplicate the files each time i create a new site and uplaod different css and images. What would be the best practice to simply this into 1 main location for all common files? Here is my current structure for each site: /home/ftpus...

PHP database connection

I need to connect to a remote mysql database in PHP. Specifically I have this as a constant: define("DATABASE_SERVER", "localhost"); ... $db = @mysql_connect(DB_SERVER, DB_USER, DB_PASS); I want to copy the site to my local machine but still connect to the main database. Can I do this? if so, how? All I have is FTP access. ...

php: parsing table structure with SimpleXML

Hi, I'm trying to read in an xml file that for some reason has been modeled in a table structure like so: <tr id="1"><td name="Date">10/01/2009</td><td name="PromoName">Sample Promo Name</td><td name="PromoCode">Sample Promo Code</td><td name="PromoLevel" /></tr> This is just one sample row, the file has multiple <-tr-> blocks and it'...

Extracting Query String From eExteranl

Is it possible (and appropriate) to open a new window to an external URL, have my users process a form on that site (which generates a query string with name/value pairs) and then parse the pairs of that query string back to my parent window so the values can be loaded into variables for subsequent use in a form on my site for further pr...

How do I take this existing array and add submenus?

Existing array code: function get_menu($menu = array(), $ulclass = '', $is_main_menu = false) { global $menu_selected; $output = ''; if (empty($menu)) { return $output; } $output .= '<ul' . (!empty($ulclass) ? (' class="' . $ulclass . '"') : '') . '>'; foreach($menu as $item) { if (!$is_main_menu || !i...

Check if files with absolute and relative path exists

Is there a way to check whether files (with either an absolute or relative path) exists? Im using PHP. I found a couple of method but either they only accept absolute or relative but not both. Thanks. ...

Fatal error cannot instantiate when trying to use http_class with http.php

Am I missing something? I am trying to use the http.php file in my program, but I keep getting this error: "Fatal error: Cannot instantiate non-existent class: http_class in /home/tznius/youtube/btube.php on line 84" When I examine the http.php class itself (btube.php includes it), I don't see any declarations for the http_class and w...

Configuring Lighttpd, PHP5 and MySQL5 for a no-supervision installation...

I'm creating a script that'll work on a Lighttpd, PHP5 and MySql5. The point is, it must be full-offline script installed and configured with all the requirements by one installer. It's a bit modified wiki thing. How to do a such thing? ...

edit profile from frontend - symfony

hello, I have a website in symfony framework I have a table sfGuardUserProfile in schema.yml, and registeration form seems to work fine. Now i want users can edit their profile how can I do that ? thanks! ...

PHP Doctrine - YAML syntax help. Default value for many to many relationship?

Hi, I have the following YAML schema for organising users in Doctrine: Person: tableName: people columns: id: type: integer primary: true autoincrement: true firstname: type: string notnull: true lastname: type: string notnull: true User: inheritance: extends: Person t...

What version of PHP introduced the <?php tag?

I'm creating a test server for a new client that has and older version of PHP that only uses the <? tags but the latest version of PHP is expecting <?php tags. I'm looking for the version I need to install so that I can run the old code without changing any of it. ...

PHP Script not working

<?php include("stdio.h"); function main() { printf("Hello World"); return 0; } ?> Error on line 2? Dunno what I'm doing wrong. ...

Wordpress archive page

I want more functionality out of the wp_get_archives tag. I want my results to look like this: Year Month Post Post Post Year Month Post Post Post To achieve this, am I going to have to use the loop? Is there another way to do this besides the loop? ...

Looking for a PHP MVC framework that just implements architectural goals and design patterns, nothing more

Hello, I have been looking for a good PHP MVC framework that is interested primarily in speed, security, and implementing the MVC design architectural style. Some of the biggest beefs I have with a lot of the mainstream MVC frameworks out there is that they: put view logic in controllers, or do things like: controller: $form = "a for...

Wordpress Data Storage Efficiency

I've been asked to review a wordpress plugin of sorts and try to find ways of making it faster. The premise of this plugin is basically to store a bunch of users and shifts and appointments and whatnot. It involves a five major variables, Start of week, day of week, user, resource, and appointment. Currently, it's using a horrendous me...

pdo database abstraction

Hello, Can someone help me to see what is going wrong with this setup I build the @sql query in the function below like this. The extra quotes are setup in the conditions array. $sql .= " WHERE $field = \"$value\""; The pdo update function loops the conditions array like this. if (!is_null($conditions)) { $cond = ' WHERE'; $ob...

Create a file in a zip archive using stream wrapper

I want to use a zip stream wrapper in PHP to create zip file or add files in a zip archive. Here are my example : <?php echo file_get_contents('zip://file.zip#existing_file.txt'); file_put_contents('zip://file.zip#new_file.txt', 'Trying to put some stuff here...'); echo file_get_contents('zip://file.zip#new_file.txt'); This code gets ...

I just wrote a horrible PHP function, I need some help (elseif chain - switch?)

Hi, I am making a site that determines the value of an array based on what time it is. I wrote this awful (functional) script, and am wondering if I could have made it more concise. I started with a case/switch statement, but had trouble getting multiple conditionals working with it. Here's the dirty deed: if ($now < november 18th) { ...

PHP Curl adds '\' to apostrophe character sending to ASP page

I have a 3rd party server which has a classic ASP page which takes in form data. From my web page I have a PHP script which sends fields to the ASP page using curl. Everything works fine except if a user includes an apostrophe character to the text. In the back end it is received as "\'". What is even odder is that it only does this ...

How to use PHP's DOM extension loadHTML

It was suggested to me that in order to close some "dangling" HTML tags, I should use PHP's DOM extension and loadHTML. I've been trying for a while, searching for tutorials, reading this page, trying various things, but can't seem to figure out how to use it to accomplish what I want. I have this string: <div><p>The quick brown <a hre...