php

Why doesn't this code work?

I'm a beginner in PHP. 2 days ago I write few lines of code that was working, but yesterday, it wasn't anymore. The code was: <body> <form method='post' action='test.php'> name <input type='text' id='txtName'/> age <input type='text' id='txtAge'/> <input type='submit'/> <hr/> name <?php echo $...

Accessing GET and POST by reference

I learned how to access by reference in another answer on stackoverflow, but cannot find it again. Anyways, is the following method unsafe or at all unreliable? protected function checkVar($requestType, $varname, $checkIfNumber = false) { switch($requestType) { case 'GET': $sg = &$_GET; break; ...

tcpdf font ligatures (English) ?

How do you generate ligatures in PHP tcpdf? ...

return a specific http status code with php

Is there a way to have a php script return a specific http status code rather than relying on apache to do it? ...

cloud drive vs. cloud files (or should we not bother?)

The web application is in the process of moving from a standalone server to a pair of servers behind a load-balancer, and contains a 50GB directory of user-created data that is growing rapidly. On rackspace, the only way to add disk space dynamically is by also doubling RAM and monthly cost, which isn't necessary. So, to cloud files it i...

PHP tcpdf small QR Code?

Is it possible to change the size of the qr code generated from tcpdf? It seems when I change the size from anything but 50,50 points, the resulting QR code becomes invalid Tried both variations - the QR code generated can't be read by a QR reader $pdf->write2DBarcode($url, 'QRCODE,H', '', '', 25, 25, $style, 'N',FALSE); $pdf->write2D...

i want to create domains for different users

I have domains like www.football.com and www.baseball.com. They are linked with www.game.com, which is the parent, and its admin page, www.game.com/admin. i want to create something like www.football.com/userid1/admin, www.baseball.com/userid2/admin, etc. for different users. All the domains are mapped to same IP and there is only one...

How to model and track requirements towards a goal in PHP

I'm building a webapp using the Zend Framework, and I need to model logic or keep track of some logic that has to do with tracking progress towards a goal. Let me illustrate with a sample goal. USER Needs to Complete All Three of the following: A) Activity One B) Activity Two C) Activity Three USER Needs to Complete One ...

JS alert in PHP as part of AJAX app

I've got a PHP file that is being called to fill in a DIV via ajax. Everything works fine and dandy except I can't for the life of me get a JS alert box to pop up from the PHP. Here is what I'm using to test (this is being tacked on toward the end of the PHP, I've also tried it toward the beginning, in the middle, etc): echo "does thi...

Doctrine : Rollback failed. There is no active transaction.

Rollback failed. There is no active transaction. I am getting the above error when i tried to rollback. I googled the issue and few suggested to disabling the autocommit..... How do we disable autocommit? Is there any other reason for the above error? I am using MYSQL and Zend and my php.ini file loaded the required drivers Thanks i...

This code needs to loop over 3.5 million rows, how can I make it more efficient?

I have a csv file that has 3.5 million codes in it. I should point out that this is only EVER going to be this once. The csv looks like age9tlg, rigfh34, ... Here is my code: ini_set('max_execution_time', 600); ini_set("memory_limit", "512M"); $file_handle = fopen("Weekly.csv", "r"); while (!feof($file_handle)) { $line_of_te...

what date/time considerations when we create event based site?

hi, I would like to know how to handle date and time if we do any site where we ask users to create evetns like evite.com. my confusion is, if I create an event for Aug 5th and then invite 200 persons from different places(outside the event country), how evite sends the reminder because the time is different in some countries i.e. it wi...

Csscaffold, image url problem?

I am using csscaffold 2.0.7 ("http://github.com/sunny/csscaffold") trying to get this code to work: @constants { path: "/images/sprite.png"; } .my-div{ background: #000 url($path) no-repeat 0px -100px; } Trying to make that code work, its outputting: Missing image - \\css\/images/sprite.png Directory: -scaffold -css -images ...

why doesn't my php redirect work?

Im writing a login script. My db.php doesnt echo/print anything so why doesnt header("Location: index.php"); redirect upon successful login? the login info is correct. I know i need to sanitize the input but that is not a problem at the moment. <?php require('db.php'); $username = $_POST['un']; $password = $_POS...

How can I write tests for file upload in PHP ?

I'm using simpleTest to write my PHP tests. I'm writing a file upload plugin and was wondering how I may be testing it. I would like to check that the file is correctly uploaded, in the right folder, that error are correctly returned when needed, etc. How do I emulate a file upload (through the $_FILES variable) ? Are there any issues ...

Password protect a page without db access with php

Is it possible to password protect a page without db access? I may have only few pages. But I should be able to change password and also save sessions etc. And I want a secure way as it's for production site! How is it to store in a config.php after md5: <?php username="admin"; password="1a1dc91c907325c69271ddf0c944bc72"; ?> If ...

Right way to store/trac visits of an item - job board

Hi, im developing a job board site, where i have the following tables: Cv (Curriculum) Jobs Users I want to produce the follow information: How many users visit this Job How many users visit my CV How many cv i visited How many jobs i visited My obviously thinking is to created a table for example: log_jobs (id, job_id,user_id) ...

Add suffix to a file name

$config['file_name'] = preg_replace('/(\.gif|\.jpg|\.png)/', '_thumb$1', $filename); Basically I want filename.jpg to become filename_thumb.jpg I don't understand why but the extension is being repeated twice. (filename.jpg.jpg). Edit This does work, I have other problems in my code. ...

open source address book importer

I plan to implement address book importer in my site so that users can invite their contacts. I am looking for a good open source script that would suffice my need. Yahoo, Gmail, Facebook and Hotmail address book is what i am targeting. Please suggest any software/script. ...

PHP - How to be able to use variables inside __autoload() function

The autoload function I am using is as follows:- function __autoload($moduleName) { //Logic to check file existence- include if exists else redirect to fallback page } Does it not take any other arguments? I want to perform some logic based on some variables inside the autoload function. How do I do it without the use of global ...