php

How do Python and PHP compare for ecommerce?

If I were to start an ecommerce store, which language would you suggest I start with? Python or PHP? And would it be wise to use Python for an ecommerce site in favor of PHP? PHP has lots of shopping carts, both open source and commercial. Is Python the future of Web Development ? Edit: I would like to clear out that i am not ask...

MVC: Can a view loop through query results?

I'm new to MVC. You have been warned... I have User model that can return a MySQL result resource to a controller. The controller passes the MySQL resource over to the view to display. Is it acceptable to print the query results in the view, using a database result fetching function? <?php while($row = some_fetching_function($database_...

Are there any real benefits to using a RDBMS vs. flat files on a simple Web doc system (or basic CMS)?

The Project I've been asked to work on an interesting project -- what amounts to a basic Web CMS -- that uses HTML/CSS/jQuery with PHP. However, one requirement is that there won't be a database to house the data (they want flat files for the documents/pages -- preferable in JSON format). In a very basic sense, it'll be used to genera...

Logging in to Wordpress through CodeIgniter DX Authentication

Hello All, I'm about to start a very large project of rebuilding my companies intranet. The plan is to have most of the intranet live in a CI application. I chose to use CI because i'm very familiar with all the CI methods. Some sections of the intranet are going to be wordpress blogs. For example the Human Resources Dept. and the M...

User input include

This is pretty darn safe right? Something I've missed? $page = sprintf("%s/%s.php", "pages", $_GET['page']); if (file_exists($page)) { include $page; } else { echo "The page '$page' does not exist =("; } (yes you can use it) ...

What is the built-in PHP function for "compressing" or "defragmenting" an array?

I know it'd be trivial to code myself, but in the interest of not having more code to maintain if it's built in to PHP already, is there a built-in function for "compressing" a PHP array? In other words, let's say I create an array thus: $array = array(); $array[2000] = 5; $array[3000] = 7; $array[3500] = 9; What I want is an array w...

Replacing javascript functions using PHP

I want to use PHP to replace javascript functions in HTML documents. For example: original: function my_function(hey) { do stuff } new: function new_function(hi) { do different stuff } I was thinking of using regular expressions with the ereg_replace function, but I'm not sure if this is the best approach. The code in each...

$_POST variable

I'm encountering a problem. I'm using Wordpress, but this ain't a Wordpress question. I'm using two forms, on one form I have all the input fields and one hidden input field which I use for checking which form the user has submitted. I have saved its value as 'save'. There is another form which is just for resetting all the options and ...

Problem with some simple code

<?php // get all files from pages/ with .php extension $pages = glob('pages/*.php'); foreach ($pages as $page) { // remove path $page_clean = str_replace('pages/', '', $page); // put it in an array $allowed_pages = array($page_clean); // determine that the lank will be index.php?page=% $page = $_GET['page'] . '.php'; // load page i...

Creating drupal pages (nodes) automatically from other (xml) content

Hiya, I currently have a datasource from a client in the form of XML, this XML has content for all the pages that the website we're making will contain. Now after parsing and preparing all this content, does anyone know how we can then (using) PHP automate the creation of a drupal node (including all related fields for that node i.e. C...

Why won't postgresql store my entire (PHP) float value?

I try to store the PHP floating point value 63.59072952118762 into a double precision column in postgres. Postgres stores the value as 63.59073. Does anyone know why? 8 byte should be more than enough for that value. I've tried with the data type numeric, which works when specifying the precision, but that shouldn't really be necessary. ...

How to improve the following code in PHP

Hello Here is a simple form I am using to send XML data in admin_xml.php <form name="review" action="admin_xml.php" method="post"> <textarea name="xml" cols="40" rows="10"></textarea> <input class="submit" type="submit" value="Submit Request"> </form> Here is the XML which I enter in order to retrieve the data from MySQL Databa...

Should e-mail validation using DNS/MX record be used?

I noticed that most scripts for e-mail validation do not use DNS information to ensure the given domain actually exists. What are the reasons why one might not use DNS checks? Does it actually reduce the number of fake e-mails or make a form more usable? Example snippet: $host = explode('@', $email); if(checkdnsrr($host[1].'.', ...

Using Flickr API + CURL to get image URL & Caption

How can I make a simple CURL request to that Flickr API that does the following: Get the X number of most recent photos URLs + captions from collection Y? Where "X" is the number of photo URLs and "Y" is the collection name. This code is part of an existing application and I'm not allowed to use scripts like PHPFlickr for help. ...

How to get E Text Editor to upload local copy of project files to server?

Hi, I'm new to E Text Editor. I have a project saved locally on my computer, that replicates a folder saved on my server. When I use my php IDE (PhpEd) and save a change to the locally saved file, it automatically updates the respective file on my server. Can I customize E Text Editor to do this also? It would save lots of time! Than...

Out of dynamic memory in yy_create_buffer()

Has anyone seen this error when working with a PHP application "out of dynamic memory in yy_create_buffer()"? The error message that appears in the php error log is: Fatal error: out of dynamic memory in yy_create_buffer() in Unknown on line 0 I have not been able to identify a reproducible case. Increasing memory_limit has no affect o...

PHP image GD library not outputting visuals until loop is complete

I am trying to have this function output data and the rescaled image after every loop but it doesn't display anything until it is finished looping through the complete array. I am assuming that this has something to do with the PHP image functions but is there a workaround? function resize_images($images_l){ echo "Resizing Images<br>";...

Formating multiple mySQL date fields at the same time

I have a table with 12 timestamp columns and 3 other fields. I can't change the field type on the timestamp columns. I need to display all 15 fields to the user as m/d/y. Is there a way to format them all at the same time without having to apply DATE_FORMAT to each one? I'd rather not have to do SELECT DATE_FORMAT(field, '%c/%e/%y...

Sendmail path error?

I just switched to using Msmpt, but I am unable to send using the mail() function. I can send via SSH command line perfectly but var_dump shows that mail returns a false value. sendmail_path = /usr/bin/msmtp -t -i Is the path, but manually browsing, I am unable to locate "msmtp". Any ideas how to find where it is located so I am able ...

why @ before functions

What does adding @ before a function do? I've seen this in some scripts example: $connect = @mysql_connect('localhost', 'root', 'password'); instead of $connect = mysql_connect('localhost', 'root', 'password'); ...