php

Unable to execute a php script through CURL

Hello All, I have a PHP script A which displays data from database. I have another another script B which gets the content of script A .But I need the content after script A is executed . But this is not happending . // Script A enter code here <?php session_start(); if(!isset($_SESSION['username'])) { ...

Symfony: Is it possible to setTemplate for components ?

There’s no setTemplate() for components! I know but maybe there is another way to do it ? (The question seems to be about a php framework: http://www.symfony-project.org/) ...

What HTTP redirect status should I use to link offsite?

While randomly browsing my website via Google, I noticed that it was showing up remote redirects as local files. Now this can be both good and bad, but I'm wondering how can I fix this so it doesn't happen? I'm currently using PHP and header('Location: ... which sends a 302 redirect. Looking over the list of HTTP status codes, I'd take ...

problem with ftp_get failing

Very simple premise. PHP as a shell script, log into an ftp (any ftp, i tried 2), get into a remote directory, list files, download them to local one. it's not working and it's not producing any meaningful errors. it logs in, it gets a list of files, tries the ftp_get and returns false. #!/usr/bin/php -q <?PHP chdir("/www/cron/"); $se...

reading and formatting csv data using explode and arrays in php

The Objective To read the csv file, and separate each line into an array. The first line (field names) displayed once, and then loop through the remaining data. I have this function to open and explode the csv file $myFile = "csv.csv"; $fh = fopen($myFile, 'r'); $theData = fread($fh, filesize($myFile)); fclose($fh); $csv = explode(","...

codeigniter, global variable for beta project path, and access from everywhere.

Hi friends, I use CodeIgniter, I'm happy with that, but I have a question. I build my projects under /www/projectname/beta/... directory, so at my code, at many parts like including some images or css files or etc. I have to make ... src="/projectname/beta/... so when I complete the website, I need to edit so many pages to clear these...

How do I retrieve a random (but unique for a date) primary key value?

I have about 10,000 products in the product table. I want to retrieve one of those items and display it in a section of a web page which stays the same for that particular day. Something like "Product of the day". For example, if today I get product_id 100, then all of the visitors should be viewing this product item for today. Tomorrow...

Is there any problem using the '@' while writing the code

Is there any problem using the '@' while writing the code? and what is the mechanism behind it? ...

Multistep form in PHP - MVC App

Hello, I'm about to program a mutistep form in my MVC App (Self-made MVC framework) in which no data is to be inserted until the last step is finished. I got the following issues/questions I'd really like to find a kind of pattern to solve this problem, is there any? I want it to be easy the perform a go back action, and get the data...

simple rand() question

I need a random 4 digit number right now im using rand(1000,9999) that always gives me a 4 digit number but i eliminates 0000-0999 as possible results. how do you pad a random number? (also this is eventually going to be added to a string do i need to cast the int as a string?) thanks ...

How to create an RSS feed and display it?

On a website I am maintaining for a radio station they have a page that displays news articles. Right now the news is posted in an html page which is then read by a php page which includes all the navigation. I have been asked to make this into and RSS feed. How do I do this? I know how to make the XML file but the person who edits the n...

CURL as a download manager with multiple connections and progress display in PHP

Hi, I wanted to use the CURL extension for PHP to create some sort of download manager and I was thinking if CURL allowed to implement these 2 features I'm thinking about: 1) Multiple connections or multi-part download just like a normal desktop applications download manager. 2) Constantly update on screen (text or graphical, doesn't ...

Visual Studio 2010 Beta 2 and PHP

Seems like Visual Studio 2010 Beta 2 has PHP syntax highlighting. But is there any way to create PHP files or projects from VS itself? If yes, how can I create one? P.S. Don't suggest vs.php (jcx.software) please, as I'm looking for it's alternative. ...

Auto-repeat structures using simpleXML?

I am defining the elements of form in a simple XML structure like so: <subtab id="page_background" label="Page Background" prefix="page"> <input label="Background color" field="bgcolor" type="color"/> <input label="Background image" field="bgimage" type="image"/> <space /> </subtab> etc. I have large blocks containing abs...

redirect after post?

I have a php page for submitting resumes. once they click submit they info all posts to mail.php once the mail is sent i would like the user to go back to a different page on the website (where the job opportunity are located) is is there any sort of command i can use to redirect to a different page after the mail.php is done with its ...

Which one would you choose ; XCache or APC ?

I need a opcode-cache in my project. Also i will use for the datastore (mysql returned row) cache ? Which is the best for you and WHY ? ...

annoying Session overwriting

Hello , I'm making a multi language website and i decided to use sessions to remember the current language , overall it works as its supposed to , but there is one bug that i can't fix . 1) i load the page and it displays properly in Bulgaria 2) i add '&lang=en' to test if its working properly , and it does 3) when i remove the '&lang...

find documents having no value for sql_attr_multi attribute (Sphinx)

in my sphinx source config I have an attribute like so: sql_attr_multi = uint categories from query; SELECT entry_id, cat_id FROM categories_entries When querying the sphinx index, is it possible to get only records that do not have a category attribute? As a kludgy fix I have executed a query on the database to find all potential ca...

How do I measure the strength of a password?

I was looking for an effective algorithm that can give me a righteous idea of how strong a password is. I found that several different websites use several different algorithms as I get different password strength ratings on different websites. ...

File upload issues in PHP

Hi i'm trying to upload an image using a php script. And whats really weird is i get the following error only in Internet Explorer everywhere else script works fine: Warning: move_uploaded_file(pictures/) [function.move-uploaded-file]: failed to open stream: Is a directory in /home/tntauto1/public_html/admin_add1.php on line 59 Warning...