I want to make my php page only accessible from another page redirect and prevent my user from accessing it directly. I mean, let’s say I have a page called “main.php” and another PHP file that I want to prevent direct access to, called “noaccess.php”. I want to make noaccess.php…
Tag: php
Get value of input box, without a form?
Does anyone know how I can get the value of an input box, without having a form? I want a submit button, but instead of submitting a form, I want it to change data in a MySQL database. Something like this maybe? Could I use that code on a “onclick” event? The input box’s name and id is ̶…
PHP fetch all Twitter Followers and compare them to friends
I am looking for scalable way to do the following: User login Fetch all Friends from Twitter Fetch all Followers from Twitter Display all Friends which aren’t Followers The Problem: How can this be done in a scalable way? An user can have up to 2 million friends or followers. Currently I’m storing…
GD! Converting a png image to jpeg and making the alpha by default white and not black
I tried something like this but it just makes the background of the image white, not necessarily the alpha of the image. I wanted to just upload everything as jpg’s so if i could somehow “flatten” a png image with some transparently to default it to just be white so i can use it as a jpg ins…
Newbie – eclipse workflow (PHP development)
this is a bit of a newbie question but hoping I can get some guidance. I’ve been playing around with Eclipse for a couple months yet I’m still not completely comfortable with my setup and it seems like every time I install it to a new system I end up with different results. What I’m hoping t…
php fputcsv and enclosing fields
I was just about to ask the same questions as the question aksed here…. Forcing fputcsv to Use Enclosure For *all* Fields The question was When I use fputcsv to write out a line to an open …
How to select rows where column value IS NOT NULL using CodeIgniter’s ActiveRecord?
I’m using CodeIgniter’s Active Record class to query the MySQL database. I need to select the rows in a table where a field is not set to NULL: That only returns this query: The archived field is a DATE field. Is there a better way to solve this? I know I can just write the query myself, but I wan…
mysql get last auto increment value
Hi I have a field in mySql table called jobnumber which auto increments with each new entry. What I want to do is when a user views my form, get the value of the next ‘jobnumber’ . But I want to do …
Round minute down to nearest quarter hour
I need to round times down to the nearest quarter hour in PHP. The times are being pulled from a MySQL database from a datetime column and formatted like 2010-03-18 10:50:00. Example: 10:50 needs …
PHP Sort Array By SubArray Value
I have the following array structure: What is the best way to order the array in an incremental way, based on the optionNumber? So the results look like: Answer Use usort. In PHP ≥5.3, you should use an anonymous function instead: Note that both code above assume $a[‘optionNumber’] is an integer. …