php

MySQL progressively decaying...?

I have a Zend/PHP script that reads rows from a table in one MySQL DB, transforms the data, and adds rows to a second table in another MySQL DB. As I've bee debugging the script, it has been getting less and less far along before tossing an error. Right now, after adding 60 rows, it quits. In the beginning it was adding 300+ rows. The s...

checking if a number is divisible by 6 PHP

Hi, I want to check if a number is divisible by 6 and if not i need to increase it until it becomes divisible. how can i do that ? Thanks ...

xml parsing: tags should be in numerical array?

<?php /* Sample: $results = XMLParser::load('<xml ....'); $results = XMLParser::load(VSCHEMAS.'/Users.edit.xml'); */ /** * Abstract XMLParser class. A non-instantiable class that uses SimpleXML to parse XML, based on a path or body passed into the load method * * @abstract */ abstract class X...

When a PHP function is called and something is RETURNED, does it stop running the code below it?

I am just studying other user's PHP code right now to understand and learn better. In the code below, it is part of a user class. When I code using if/else blocks I format them like this... if(!$this->isLoggedIn()){ //do stuff } But in the code below it is more like this if (! $this->isLoggedIn()) return false; Also in t...

Select next row in php

Hello, I have a set of records in a mysql database and am trying to make select next and previous buttons on a webpage. I have issues coding it in php however; any help is greatly appreciated. My records do not have auto increment id attached to them. My code is as follows: $result = mysql_query($query) or die("Couldn't execute query...

How to get the relative directory no matter from where it's included in PHP?

If it's Path_To_DocumentRoot/a/b/c.php,should always be /a/b. I use this: dirname($_SERVER["PHP_SELF"]) But it won't work when it's included by another file in a different directory. EDIT I need a relative path to document root .It's used in web application. I find there is another question with the same problem,but no accepted an...

Can someone explain Kohana 3's routing system?

In bootstrap.php, where you set routes, I'm having a hard time getting them to work. I read some documentation a while ago that I can't seem to find again that explains them. Here is one of my examples Route::set('products', 'products/(type)', array('type' => '.+')) ->defaults(array( 'controller' => 'articles', 'action' => '...

PHP class problems. Cant call another class?

I have a class file: class_xx.php. And then a function file: function_xxx.php In my function_xxx.php: require_once('class_xx.php') ... // after few next lines $object = new class_xx1($arg1, $arg2); But it gives me: Fatal error: Class 'class_xx1' not found in "some_path" on line "1XX3" [sorry i cant exposed the codes yet], any ide...

Secure a PHP file

I have a PHP file i made that basically give me passwords to all my users. I want to be the only one able to view the contents and see the page. Whats the best way doing it? Password protection? Requiring a special cookie that only I have? Give me some ideas.. ...

smarty send query

in .php while ($line = mysql_fetch_assoc($result)){ $value[] = $line; $value['newvalue'] ='223457'; } $smarty->assign('view', $value); in .tpl {section name=i loop=$view} {$view[i].newvalue} {/section} no output for newvalue.im newbie in smarty ...

How can I throttle user login attempts in PHP

I was just reading this post http://stackoverflow.com/questions/549/the-definitive-guide-to-website-authentication-beta#477585 on Preventing Rapid-Fire Login Attempts. Best practice #1: A short time delay that increases with the number of failed attempts, like: 1 failed attempt = no delay 2 failed attempts = 2 sec delay 3 failed ...

PHP Curl with Google Calendar

<?php if(isset($_GET['token'])) { $url="http://www.google.com/calendar/feeds/default/allcalendars/full"; $useragent="PHP 5.2"; $header=array( "GET /accounts/AuthSubSessionToken HTTP/1.1", "Content-Type: application/x-www-form-urlencoded", "Authorization: AuthSub token=".$_GET['toke...

When user is inactive for 3 hour the session will expire. php

When user is inactive for 3 hour ,How to set session expire. Surly this is duplicate question , But other threads are not worked for me, what i have tried upto now is , define("APP_SESSION_TIMEOUT","10"); session_cache_expire(APP_SESSION_TIMEOUT); session_set_cookie_params(APP_SESSION_TIMEOUT*60); ini_set("session.gc_maxlifetime...

After fopen, can I search for a keyword in PHP?

If I use fopen on a file, is there any way to scan through the file to find the number of bytes a certain keyword begins at? If not, how can I do this? ...

Is a file based cache as fast as a file based session handler in PHP?

I am curious would a file based cache be just as fast as a file based session handler in PHP? ...

PHP subdomain linked to controller?

I have a site that operates in different geographical locations. Some example URLs for my site would be: http://losangeles.example.com http://sandiego.example.com/post/blog/travel/ http://sfbay.example.com/blog/read/12/ In these examples, my URL structure is translated to the following: http://[location code].example.com/[controller]...

How to Collaborate With Team Effectively for a Project?

This question is a follow up for this question: http://stackoverflow.com/questions/2083020/need-some-advice-about-web-development-project I would like to know if there are techniques or tools we could use in order for us to do our project effectively. To make this more specific, I'm basically looking for something that will help us work...

PHP's database operation not working property in IIS?

After this statement: insert into table... value(..,"It\'s my title") In database I can see : It\'s my title It only happens when in IIS.How to fix? ...

Swift Mailer vague response code

Have you encountered this error? "Expected response code(s) [250] but got response []" There's no response code at all. I just followed the basic usage of the module. Something like this: $email = new Email("Subject"); $email->to('[email protected]'); $email->message('Message'); $email->send('[email protected]'); Not sure on the ...

php.ini not working in IIS?

I've set magic_quotes_gpc = Off in php.ini,but I see it's still On in phpinfo(); ...