php

add php script in cron for scheduled task from php?

is there a way to add a php script (file) in cron for running this script every ten minutes or at a scheduled time? cause i want the user to be able to schedule when to send newsletter to a lot of emails he choses. so i have to create a cron job from php to run a php file on that scheduled time. is this possible if you have a shared w...

How should I add multi language support to my web app across PHP, JS and Template Files?

I'm building a website that needs to support different language translations. I have strings in PHP, JavaScript and Smarty Template files that need to translated. I want to use something like PHP's gettext() function and have a single language file for each locale. This is easy when the translatable strings are in the PHP files but I ...

How to include static html in php/smarty.

I have been asked to include some html snippet in this php/smarty page. It's basically a sales agreement at the end of an overview page before you pay. What is the code to include static html into my php/smarty template? Thanks... ...

Probably an easy one - PHP/CodeIgniter 'Undefined Variable'

Morning y'all This is probably an easy one but I barely got any sleep last night and am struggling to comprehend anything. I've got a CodeIgniter library I've made called Points.php. Here's the contents of Points: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Points { function __construct() {...

How to avoid resending data on refresh in php

Hello.I have a page "index.php" where i have a link called "add_users.php".In "add_users.php",i accept user information and come back to the same page "index.php" where information comes through post action and gets inserted into the database.When i refresh the page orhit back button,resend box appears.I went through many solution where ...

Could my forms be hacked.

Hi there, I posted a question yesterday, which I intend to get back to today however I wrote some JavaScript as a first line of prevention against XSS. However when testing this on my live server I catch some invalid input as the javascript catches the php section. My form uses post and php isn't in my form items (i haven't typed it in)....

Different session for admin and front end

Hi, Its my 1st App using ZF. As our client requirement i have made separate admin and front panel. Without using Zend_Acl. I have problem when session expires it always takes me on front end log in page . I have tried to solve it by session but it's using single session for both admin anf front panel. I there any way so i can create sep...

sort files by date in PHP

hi, I currently have an index.php file which allows me to output the list of files inside the same directory, the output shows the names then I used filemtime() function to show the date when the file was modified. my problem now is, how will I sort the output to show the latest modified file ?, I've been thinking for awhile how to do th...

How to calculate the hamming distance of two binary sequences in PHP?

hamming('10101010','01010101') The result of the above should be 8. How to implement it? ...

What is the way to show the progress of calculations?

Hello, I would like to monitor my program which is running on the web server. Can I draw the progress bar or simply show the percentage which is returned by my code? The php script is spawning the external code with parameters. $Status="rendering..."; $cmd = "cd $rpath && $envopts /home/arm2arm/bin/sph2grid"; $shellcmd=$cmd.$params.'...

PHP error handling : my code is not optimized

Hello, I must warn you, this code will hurt your eyes, so please don't judge me, i'm trying to improve the way I handle errors all my tests are like this : if ($something < 27) { $error_IP= '<div class="error_message">something bad</div> '; }else{ $erreur_IP=''; } and here's the ugliest thing : if( !isset($_POST) || ($erreur_captc...

split a string into a key => value array in php

+2-1+18*+7-21+3*-4-5+6x29 The above string is an example of the kind of string I'm trying to split into either a key => value array or something similar. The string is used to represent the layout of various classes on a three column page of an intranet site, which is editable by the user via drag and drop. This string is stored in a c...

how to display a array value in view page

Hai I am using codeigniter...I my function phpcalview()... This is my function function phpcalview() { $year = $this->input->post('yearvv'); $data['year'] = $this->adminmodel->selectyear(); $data['date'] = $this->adminmodel->selectmonth(); print_r($data['date'] ); $this->load->view('phpcal',$data); } I am printi...

get value from array in php

Array ( [0] => Array ( [OPT] => 65 ) ) how to get 65 to a variable in PHP help me please.... ...

php natural order sorting of mysql select rows

Hi, I'm running a select that returns alphanumeric results, e.g: ABC-1 ABC-2 ABC-10 SAM-1 SAM-2 SAM-10 SAM-20 I've tried using: ORDER BY CAST(mid(field_name, 6, LENGTH(class) -5) AS unsigned) and ORDER BY filed_name + 0 ASC this has helped put some order but I cant seem to order -2 before -10 many thanks ...

Php function available on other php page

I have a function that I use on index.php page and I would like to call it from other php page (other.php). How to make this function available without redeclaration? I think it's achievable using sessions, but I am not sure how to do it exactly. Th problem is that it works in index.php, because it uses some API declaration, but it doe...

How do I completely disable caching in Cakephp?

So I opened the cache floodgates in my Cakephp app and now I want to close them... I've done pretty much everything I can: delete all files in the tmp folder (but not the folders), turned 'Cache.disable' on in the core.php file in my app, have tried clearing the cache from within some controllers with clearCache() and Cache::clear() (bu...

List directives in Apache DirectoryIndex

Does anyone know of a way to parse the contents of the apache DirectoryIndex directive (in httpd.conf) using PHP? ...

How can i delete/drop entire keyspace using php: cassandra :thrift

How can i delete/drop entire keyspace using php: cassandra :thrift ...

How to restrict http access to video files?

I want to only let "right" people watch those videos. In other words, only registered users that are allowed (by other users, ie, friends) should see videos. I have a hard retriction for cpu usage in my shared environment, so I can't use things like php's readfile. ...