php

In a PHP / Apache / Linux context, why exactly is chmod 777 dangerous?

Inspired by the discussion in this question, a maybe stupid question. We have all been taught that leaving directories or files on Linux-based web hosting with the permission level of 777 is a bad thing, and to give always as little permissions as necessary. I am now curious as to where exactly lies the danger of exploitation, specific...

RSS time format to human readable format

I'm using MagpieRSS to parse some Craigslist feeds. The problem is the publish dates for craigslist posts are in this format: 2010-02-25T18:09:38-06:00 How can I convert that to Thursday, February 25, 2010 6:09 PM using php? ...

There is a django option for moodle?

There is a plataform like moodle made in django or some kind of interface django/moodle? ...

Is there an inbuilt way in PHP to parse a string like this: '/path/to/../../up/something.txt'

So say I have a string like so of a path $path = '/path/to/../../up/something.txt'; Is there a way built into PHP to parse it and come up with a URL without the directory ups (../) ? E.g. $path = parsePath('/path/to/../../up/something.txt'); // /up/something.txt ...

Why would this string be returning false in PHP when realpath()'d?

Here is my string $newPath = '/~new/assets/js/../packages/prettyphoto/js/jquery.prettyPhoto.js'; Now check this output var_dump($newPath); // string(64) "/~new/assets/js/../packages/prettyphoto/js/jquery.prettyPhoto.js" var_dump(realpath($newPath)); // bool(false) Does anyone know why this would be returning false on me? ...

Access a Javascript variable from PHP

I need to access a javascript variable with php. Here's a stripped-down version of the code I'm currently trying, which isn't working: <script type="text/javascript" charset="utf-8"> var test = "tester"; </script> <?php echo $_GET['test']; ?> I'm a complete noob at both js and php, so would really appreciate any advice. UPDAT...

Trouble with using a static method in a very simple hello world PHP program.

I'm learning by reading this tutorial: Link Here's the code: <?php require_once 'Zend/Loader.php'; class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { public static $root = ''; public static $frontController = null; public static function run(){ self::setupEnvironment(); self::prepare(); ...

share a folder in 2 domains using .htaccess

Dear all, I got 2 sub-domains c:\wamp\www\websiteA\ - http://websiteA/ c:\wamp\www\websiteB\ - http://websiteB/ inside websiteA got a folder for storing picture c:\wamp\www\websiteA\photos\ in order websiteB want to access websiteA photo in websiteB's html I have to do link like url: http://websiteB/1.html <img src="http://we...

How can I get the server IP address using PHP from the CLI?

The title pretty much sums it up: How can I get the server IP address using PHP from the CLI? Using PHP's CLI, $_SERVER does not contain the server's IP address, so the obvious solution is out of the question. Thanks! ...

XSS PHP Log Filter?

I have a log function on my admin panel that checks user input for being correct and, if not correct, writes it to a log file. This log file is written to the admin when logged in. I was testing my site for vulnerabilities, and I managed to fully exploit my server using an XSS hole. I tried to filter logged input by checking the input t...

How can I open my project in Zend? I accidentally removed it from the left pane.

I accidentally removed the application from the left pane and now I can't get it back no matter what I do. I tried opening the .solution file from within Zend Studio, but it only loads the file, not the entire solution. How can I have it load the entire application? Edit: I still can't what to open. In Visual Studio, you can open a pr...

Printing Results in a Simple Table

I have a MySQL table with a structure similar to this: id1 id2 title url date I would like to print out a simple table in PHP that with the following structure sorted in reverse chronological order for the most recent 10 entries (date above = date submitted) from the MySQL table: title id2 How could I do this? ...

Php variables end up NULL (but the code works)!

I use the following code to change the language in my website: <?php session_start(); header('Cache-control: private'); // IE 6 FIX function get_lang(){ if(!empty($_GET['lang'])) return $_GET['lang']; if(!empty($_SESSION['lang'])) return $_SESSION['lang']; if(!empty($_COOKIE['lang'])) return $_COOKIE['lang']; return 'en...

Authentication/Access Control in PHP

Some time ago I created this LAMP based web. At the time I wrote my own user authentication and access control system. It checks whether the user logged in with a correct password, and whether or not he/she has the correct permission level to access given page. State information is handled via PHP sessions while usernames, salted, hashed...

PHP query join question.

if i have a table that looks like this: sample_id date sample_number 12 1-24-10 5 09 1-25-10 2 12 2-14-10 5 How can I join both (sample_id:12)'s ? sample_id:12 has a total of 10 sample numbers. ...

What's the logic i need to make this work? PHP Video manipulation with third party control functionality.

I am a php newbie so i may be completely off here. But this is what i want to do. Have a user upload a video to my site. This then has a 30 second clip from our database added to it. Which can be downloaded by the user for upload on any third party websites. Essentially the video is a flv or mpeg4, etc. But now with the 30 second cli...

Browsing the files on a webserver with php

Hi Everyone... Is there a way to browse and the get the path to files that are on a web server using php...? Possibly any jquery plugin to accomplish this....? Or else how can i do this using only php...?? Edit : I've found some scripts that run as stand alone on the webserver and let you browse the file structure.. But i need to know ...

display records randomly one after another

hi I want to display 5 records from a database with in a td one after another (about 60sec). How will i do this, with out the need of page refreshing? I don't know any idea about ajax ...

how do i prevent public downloads of files using php?

Hi, i have a script that allows only authorised users to upload files to a certain folder. however i do not know how to prevent people from downloading freely without login. I need the solution in php. I have googled around but nothing straight forward as yet. currently in my document root i have a folder called admin and a subfol...

Can not connect to mysql when using FastCGI for PHP under Apache on Windows Vista

I configured PHP to use Apache mod_fcgid. PHP is working, but after changes in configuration I am not able to connect to mysql via php. How to fix this? Any ideas, which can hint me, are very desired! To check mysql connection I use the following php code: error_reporting(E_ALL); $link = mysql_connect('127.0.0.1', 'root', 'password_he...