php

Multiple Controllers from a single view

Hello everyone, I recently started with CakePHP and so far I'm loving it, specially the scafolding and bake. I'm building a webapp that will manage applications to companies. (i.e., where have I applied to, with whom have I spoke, the status of the application(s), how long ago has it been since I did sent/recieved a communication rega...

Detect the minimum permissions PHP needs to write to a directory: 0777, 0770 or 0700?

Imagine some script & its folders was uploaded with FTP. Usually, the folder permissions are wrong and the script should suggest which permissions to set. Certainly, it's not good to set 0777 for everything I'm going to write to. But there're 3 possible webserver configurations: PHP user = user FTP. Thus, writing needs 0700 The user is...

How to give a user's question a URL based on it's ID in MySQL, so one may access it in the future?

For some reason, I just can't seem to get my head around this concept. Any advice/hints will be appreciated. As of now, I have this code: if(isset($_GET['ID'])) {//Check if ID exists in $_GET $ID = mysql_real_escape_string($_GET['ID']); //prevent sql injection $resc = mysql_query("SELECT Message, Title, Type FROM Discussion WHERE ID...

Cookie httponly accessible when I make ajax php queries?

Hi, I know this has been asked before but I needed some clarification and confirmation. I've been told when creating cookies, to use httponly to prevent XSS. So my clarification is if I use httponly, will my php scripts accessed via ajax request still be able to determine my active php session (default: phpssessid) and retrieve my $_SE...

Running Zend Framework on PHP 5.1.6 - patch or fix for ksort()?

Hi folks I've built a ZF app using 1.10 for deployment on RHEL server in a corporate client, which has PHP 5.1.6. It won't run. I googled and now realise it's the version of PHP. I didn't realise ZF had a minimum requirement for PHP 5.2.4, and calls to HeadLink seem to be causing fatal error "Call to undefined method Zend_View_Helper_P...

Maximum SQL Queries per page

This question probably has no definite answer, so if it's considered subjective and, let's say bad, please feel free to close it. Basically I am developing a pretty big web application (PHP), and it uses CakePHP. Right now it's under development and some things in the Database are really complex therefore lots of queries need to be made...

PHP: print success or error message on submit?

hey guys, i wonder how i can solve that: i have a lot of forms on my website. whenever i submit a button i would like to print a message on the following page. when a form is submitted the page simply refreshes. what's the easiest way to do that or how is it normally done? thanks for the help ...

Making User Information Available on Every Page

I'm an amateur, admittedly so, but I'm having fun trying to learn a little more about programming, and php in general, using CodeIgniter. I have a test site up and running and feel like I have a decent grasp of MVC. Without any formal background though, I know my architecture is screwy and sloppy so I poll from time to time for best pr...

check if username/email is already exist using javascript

hi there, i have a simple question. how can i check if the username or email they entered is already exist.. i have this code, if(document.RegForm.user.value =="") { alert("User Name Please?"); valid=false; } that's my code for username, i don't know what code i will add to check if user name ...

php force download extension

Hi, I'm trying to force a download so this is my code: $file = 'test.m4r'; $mime = 'audio/aac'; header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); // required for certain browsers header('Content-Description: File Trans...

When did PDO SQLite come into being?

What is the first version of PHP that started supporting the PDO_SQLite driver? I know it was PHP 5 that brought PDO into the core so I'm assuming that PDO_SQLite must have been in version 5.0 also... I want to know what requirements I'll need for a script using PDO_SQLite. ...

php:count data from db then show at other page

dear all..i have this data inside DB: line model serial fa01 kd-g335ud 105x0001 fa01 kd-g335ud 105x0002 fa01 kd-g335ud 105x0003 //up to 20pcs or regardless of the number of goods in the db fa02 kd-r311ed 105x0001 fa02 kd-r311ed 105x0002 //up to 20pcs or regardless of the number of...

Which MySQL database engine is better for storing sessions and session data: MyISAM or InnoDB?

Pretty straightforward question. I use InnoDB for everything else, for a couple of reasons. Is it a performance hit over MyISAM for a 'high-traffic' table? ...

php setting text

I'm working on a site in php. Originally I had a lot of html pages but they were all very similar in that they had a heading, an image, and some text. I was able to consolidate my pages into one php page and pass in the heading and image name as GET variables. I wouldn't want to pass a lot of text this way though. What's the best way...

Retrieve the last 10 records from mysql database table, problem.

I have a weird problem. When I run this script I get 10 records from the database but they are all exactly the same. I have no idea what I am doing wrong or how to fix it. Please help me. I have tables AMCMS_highscores , AMCMS_users , AMCMS_games I want to look inside the AMCMS_highscores table, get the last 10 records but only where th...

How do I submit a value by url in php

Hi. I tried this in my php site <a href=?command=value>hell yeah</a> And this to get the value : if(isset($_POST['command'])){ $command=strip_tags($_GET['command']); Does not seem to work.. Ps. The url have one this value also: ?lang=en_US ...

Anyway to create a php sandbox for a user to develop in?

A user on my site and I are going to be developing a new web app. Id like to create a folder that we can work in without the fear that he could read outside that folder potentially reading config files etc. Is there a way to create a sandboxed area that would prevent the user from including outside that folder - while still keeping the ...

How do I get values from url and append them to existing values in url (php)

Hi. I have a link in my page that look like this: a href=?command=value but when I click the link and the page reloads it first load another include php file. That redirect the user based on the cookie. like this: header('Location: ?lang='.$redirect); So when the page loads the ?command=value is gone. I need to append &command=value in...

PHP file not read in Eclipse

I get the following error: Warning: chdir() [function.chdir]: No such file or directory (errno 2) in /home/r/workspace/_compiled/APIBase.php on line 288 I can not see the dir it is checking because all the code is encrypted. I do not know another way around it as I have reinstalled and re downloaded twice. Plus I have tried on both XP...

Do I really need to do mysql_close()

Do I really need to do mysql_close()? Why or why not? Is there a trigger that closes the link after mysql_connect even if I don't do mysql_close? ...