php

CodeIgniter and JS libraries

Hi So I'm a newbie at this sort of thing - I just started developing with CodeIgniter and I'm trying to integrate javascript libraries. However, I have my .htaccess set up so that all requests get /index.php/ tacked in front of it, which makes it difficult to include files. For CSS I just use a php include to get around this problem and...

how I can extract images from html code and then validate if are stored in my web server

I've been working on a post editor, I want to generate thumbnails from all images inserted on the html code, so, before to do that I want to get all basic image attributes example: $mydomain = 'mysite.com'; $htmlcode = <<<EOD <p>sample text</p> <img src='/path/to/my/image.ext' width='120' height='90' /> <hr /> <img src='html://www.mys...

Generate ODT documents with dynamic images in PHP

I maintain a couple of web databases based on PHP and mySQL on a shared hosting package. The databases have a mechanism for the user to upload OpenOffice documents with placeholders: [person.name] [person.address] [person.postcode] I then use this great PHP tool to run through the OpenOffice document and insert values from the databas...

Zend Certification

Hey all, I'm looking to get my Zend certification soon for PHP5. Has anybody that's taken the exam come out of it with good advice? Are there any useless/nonsense/obscure/esoteric topics covered on it? Thanks ...

Switch website encoding from ISO-8859-1 to UTF-8

I am trying to convert my existing PHP webpage to use UTF-8 encoding. To do so, I have done the following things: specified UTF-8 as the charset in the meta content tag at the start of my webpage. change the default_charset to UTF-8 in the php.ini. specified UTF-8 as the iconv encoding in the php.ini file. specified UTF-8 in my .htacc...

MySQL many to many table to table matrix

Hi, I have a many to many table in MySQL - it can look something like: A | B 1 | 1 1 | 2 1 | 3 3 | 4 3 | 5 4 | 1 4 | 2 4 | 5 etc. You'll notice that the numbers are not always contiguous, (A=1,3,4..) - I am looking for the fastest way to turning this into a matrix table, ignoring columns and rows with no data (e.g. A=2). What I have...

Dynamic variable based on database record/recall - Help?

OK, I'll keep this as short as I can.. I am trying to create a truly scalable environment for my users and so allow them to.. 1. define a new option (dshop_options_name) 2. define option values (dshop_options_values) separate tables in the database This is to allow distinct values to be assigned and also in any combination. OK, the scr...

populate a $_REQUEST variable value from database record - how?

I am trying to get the values posted from a form select. The select name is dynamic, meaning that the name value is defined by a database record. In the form processing script, I want to call back that value via a $_REQUEST. I cannot know in advance what the value of the $_request will be (eg, $var=$_REQUEST['foo']; ) but I do know tha...

preventing csrf in php

Requiring authentication in GET and POST parameters, not only cookies; Checking the HTTP Referer header; saw this post on wikipedia and was wondering how I can apply them ok...I am using the Kohana PHP framework and I have the facility to determine the referrer header, but what exactly do I check in the referrer header? the framework...

Create a jQuery variable from a PHP script?

I'm working on a login script, and I want to send the input to a PHP script, check it, and then do something if it matches the one I have in the config.php file. pseudo php code (admin_login.php) <?php require("../config.php"); if($_POST['password'] == $password) { $showLoginPage = true; } else { $showLoginPage = false...

Checking for PHP session without starting one?

Is it possible to check for a session with out starting one? The reason that I ask is, the app I am developing has an integrated admin interface. So when an admin is logged in they browse the same pages as the users to make their edits. Fields and options are shown based on the users privs. This is causing two problems. One is Becau...

Using MDB2 and MySQLi together (Good or bad?)

I want to use the PEAR Mail_queue package which requires the PEAR MDB2 package for database abstraction. I currently use MySQLi for all my database queries and dont really desire using MDB2. Would it be bad practice to use both MDB2 and MySQLi in my PHP applications at the same time? Can anyone give me a good reason to use MDB2 over ...

PHP loop acting as cronjob[ensure only one instance running]

Hello everybody, I have a multi part question for a php script file. I am creating this file that updates the database every second. There is no other modeling method, it has to be done every second. Now i am running CentOS and i am new to it. The first noob question is: How do i run a php file via SSH. I read it is just # php path...

Change session ID and keep data?

When a user logs in on our website, I want to change the session ID but keep whatever data is in the session. I want to do this for two reasons: To prevent a user account to be used at multiple places simultaneously (because if two people are using the same account, the actions of one will undermine the actions of the other). To let th...

Looking for a replacement for NMS FormMail.pl

I have a simple contact form that I knocked up in a few minutes using NMS FormMail.pl. But the customer has requested that I have a second email address entry field, and validation that kicks them back if the two addresses are different. I could add the validation to FormMail.pl, but before I do, I thought I'd ask if there is a better ...

Designing database for ebay-like web application

Firstly this site is based on guests who are interested in selling their items to the site owner, so this isn't auction based like Ebay. Visitors basically would enter in details of an item ( tech gadget ) they'd like to sell, including condition, are given a quote on how much the item is worth, then fill in address info so the owner sh...

Different result of XML parser in different environment, WHY?

<?php $xml = <<< AAA <test>c đưa lên 1 -&gt; 10 k</test> AAA; $p = xml_parser_create(); xml_parse_into_struct($p, $xml, $vals, $index); xml_parser_free($p); print_r($vals); I can get differnt result why? In my PC the result is Array ( [0] => Array ( [tag] => TEST [type] => complete [lev...

Inheritance in MVC - CodeIgniter

I am building a series of forms, and I am trying to inherit the functionality of a parent Form class into all the forms. For example, LeaveForm extends Form (Model) LeaveFormController extends FormController I am handling all the leave form specific stuff in LeaveFormController and LeaveForm. In LeaveFormController construc...

appending arrays into session variable php

Im trying to add additional arrays into my session variable such as... $_SESSION[cart] .= array($_POST[name],$_POST[price],$_POST[quantity]); All i get when i do this 3 times and var_dump is string(15) "ArrayArrayArray" ...

Recommended way to let javascript know about php server-side login/logout?

For convenient notification purposes, not secure information purposes: I have javascript polling for new information while logged in. I want it to stop while logged out. What is the best way to let javascript know about the logged-in/logged out status? Run a javascript function on login, and one on logout (which might get skipped if ...