php

MySQL Query Selecting records from a database where a value equals one of two different things

I have to get records from my MySQL DB where: sentto = "$username" OR sentto = "everyone" How would I put this in a MySQL query? I tried a few things, but they don't seem to be working: mysql_query("SELECT * FROM pmessages WHERE status='unread' AND sentto='$username' || sentto='everyo...

Javascript won't run on php page

I have a php page and i have some javascript code to have a running total of some fields. i pretty well copied from a working test that i had and modified the code some to fit. well it doesn't work and i can't seem to work. is there something blatently obvious i'm missing or is there some other reason why it's not running? <?php /...

Best PHP Framework Training Resource?

Hi, I'm interesting on learnig and dominate any kind of the most popular PHP framework, like CodeIgniter, ZendFramework, CakePHP, Symphony. I 'll choose my own Framework based on the support training behind. And it will be better if it has training lessons delivered in video format. Does anyone know which is the best PHP Framework to s...

Web Application - Secure In A Password Protected Directory?

Is a php/mysql web application secure in a password protected folder on a (reputable) hosted server? Thanks for any insight you can provide! ...

What is a PHP Framework?

Ive never heard of this before, and I have been coding in PHP for quite some time. I actually feel kind of stupid asking this question but, what is a PHP Framework? How can it help me? and how do I use one? ...

How to set the DOCUMENT_ROOT and site root in my local PHP dev setup?

I'm doing a job for a guy with a site online. It's an alien site to me, and I'm slowly working through the strange code. I have MAMP locally and my http://localhost/ has many client folders coming off from that. Inside this code there is a lot of $_SERVER['document_root'] commands and references like which are just getting lost on my lo...

PHP How do I retain all GET vars in links?

I have some PHP code that generates dynamic tables of data on the fly. By clicking various links you "refine" the tables of data. What I'd like is each of these links to retain the current GET information and add to it. IE: $allPreviousVars = ???; // Could be 20+ vars echo "<a href='".$allPreviousVars."&newVar=2'>Link</a>"; I can thin...

Better PHP,MySql,HTML and JavaScript IDE

Hello guys, I am currently using the below IDE's. They serve their purposes but am wondering if there are better ones out there that i can switch to. phpDesigner v6.2.5 (For PHP) Navicat 8.0.29 (For MySql) Dreamweaver CS3 (For HTML & CSS) Spket IDE (For JavaScript) Thats my collection of production tools. Wondering if there is anyone ...

Best PHP 5 Templating Techniques?

I am looking to build my own templating layer in php as part of my OOP Framework, but Im looking so some example of how to do this properly. I'd like to avoid parsing each html file to find comments that tell the templating engine what to do but rather use a faster/cleaner/modern technique. I just need some examples, because i've looked ...

Optimizing a PHP page: MySQL bottleneck

I have a page that is taking 37 seconds to load. While it is loading it pegs MySQL's CPU usage through the roof. I did not write the code for this page and it is rather convoluted so the reason for the bottleneck is not readily apparent to me. I profiled it (using kcachegrind) and find that the bulk of the time on the page is spent doin...

I don't want to learn PHP. Should I avoid learning it?

I've been programming in Ruby on Rails for a year now. I looked at some of the PHP code of WordPress and its e-Commerce plugin. This is not going to sound professional, but it looked disgusting. Having only done development in an MVC framework, I can't imagine how is it possible to work without those patterns. There also seems to be no a...

PHP including in functions

I'm working on changing over a large, somewhat poorly written (but not terribly so), PHP website to use a class which stores functions which do things like write the standard page header with arguments to change things like the text of the header. The old version used a copied and pasted HTML header in each file with something like: <di...

Exec() in PHP on Windows without opening up cmd.exe Security weakness ?

Hi, I have the requirement for a web script to execute an exe file and then return the results on the exe to the web request. I can either echo back the result of the exe or modify the exe to save it's results to a file, and then read the file to echo back the web request. The problem is that using php under IIS all exec() shell_execu...

best practice to create an Admin section in a ZF based application

In every large application there is an ADMIN section. In such cases, when not using ZF, I usually put all the admin stuff in a separate directory with extra security measures (like adding .htaccess based authentication and/or a second login etc). This also makes it pretty obvious in the file tree what file is what. How can I achieve the...

How to get started with the MVC pattern

Hello, It's there some good MVC framework to get started with? I want to migrate my projects to a MVC framework but i'm very confused and I don't know what framework is the best for learn... My projects always consists of backend and a frontend, programmed by me. Do you recommend me some book to understand MVC more deeply? What framew...

Find all records in database that are within a certain distance of a set of lat and long points

I've seen all the examples and here's what I got so far. my table is simple: schools (table name) - School_ID - lat - long - county - extrainfo here's my code: <?php $con = mysql_connect("xxx","xxx","xxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } else {} mysql_select_db("xxx", $con); $lat...

C# SHA-1 vs. PHP SHA-1...Different Results?

Hey, I am trying to calculate a SHA-1 Hash from a string, but when I calculate the string using php's sha1 function I get something different than when I try it in C#. I need C# to calculate the same string as PHP (since the string from php is calculated by a 3rd party that I cannot modify). How can I get C# to generate the same hash as ...

Virtual PHP Form

I have a PHP file that spits out a form. I want to call this PHP file server-side, (currently using "include"), fill it in, and submit it. This is better so I don't have to meddle around with the actual form PHP, just deal with the presentation layer so the data gets understood by its own PHP file. Is this possible? The form "method" i...

PHP: Centralized Page Session Authenticator

I am currently wondering how a centralized page authenticator could be achieved. Can anyone suggest a neat algorithm for me? What I intend to achieve is to make my backend administrator pages session protected without writing a piece of session checking code to each of my pages that I want protected. I currently do something like this: ...

How to embed a text link in an image ?

How do I embed text in an image? The embedded text should be hyperlinked to an URL. The use case is like having an image with a link that says 'Click here' which opens a new page. ...