php

Validation on user registration form ?

Hey Guys, i have made module in which i am trying to add validation like if the user had entered the characters in "Phone No" text filed and same on "Mobile No". This will run when user had open the user registration form. I have made this.... <?php function form_intro_form_alter($form_id,&$form){ if($form_id == 'user_register' || ...

setlocale having no effect in PHP

I have the following snippet of code: setlocale(LC_ALL, "de"); print(strftime("%A %e %B %Y", time())); and it's printing Tuesday 4 May 2010 instead of Dienstag 4. Mai 2010 Any ideas why? How to fix? ...

php java in memory database

i need to load data as array to memory in PHP.but in PHP if i write $array= array("1","2"); in test.php then this $array variable is initialized every time user requests.if we request test.php 100 times by clicking 100 times browser refresh button then this $array variable will be executed 100 times. but i need to execute the $array v...

PHP problem with selecting from Oracle global temporary table

Hello, I have an Oracle global temporary table which is "ON COMMIT DELETE ROWS". I have a loop in which I: Insert to global temporary table Select from global temporary table (post-processing) Commit, so that the table is purged before next iteration of the loop Insertion is done with a call to oci_execute($stmt, OCI_DEFAULT). Retr...

Adding php script to cron

What should be given as the url to the script while adding it to cron scheduler. The script is at domain.com/scripts/script.php PS:I am using cPanel ...

phpmailer sending mail

Hello! I am using phpmailer class to send email and i am attaching a file to the mail. The email is sent successfully but the attachment which is an sql file is empty which should not be the case. I have tried with an image file, but it seems that every file that i attach is empty. Can anyone help me solve this problem please? $mail = n...

How to separate date in php

I want to be able to separate the birthday from the mysql data into day, year and month. Using the 3 textbox in html. How do I separate it? I'm trying to think of what can I do with the code below to show the result that I want: Here's the html form with the php code: $idnum = mysql_real_escape_string($_POST['idnum']); mysql_select_db...

embedded php in html to include header (top part of page) into the page

Hi there, I'm trying to put the top of my page (which is all html) in a seperate file so I only need to change things once like the menu bar etc. So I googled some and found a solution on this website as well, but it doesn't work and I don't know why. So I have a page like article.html and on the top I have this: <!DOCTYPE HTML PUBL...

Adding a loading gif to simple script

Hello everyone, Im really really new to Javascript but Ive got this script that loads the contents of a url and everything works fine. I call the plannerSpin function with an onClick method on a button but how would I go about displaying an animated gif whilst all this is going on? var xmlHttp function plannerSpin(str) { xmlHttp = G...

Kohana 3 - get orm validation errors

if ($user->values($_POST)->check()) { $user->save(); } else { // How can i get the errors? } Any idea how that works? Thanks in advance! ...

Foreach time loop not working

There are a few parts to this code. The first part is creating fixtures. $totalRounds = $teams - 1; $matchesPerRound = $teams / 2; $rounds = array(); $roundDates = array(); $curTime = time(); for ($i = 0; $i < $totalRounds; $i++) { $rounds[$i] = array(); $numDays = $i * 4; $roundDates[$i] = s...

Does PHP have a framework which does URL routing like Django?

I have found plenty of great PHP frameworks, but so many of them seem to use rails-like URL routing. Anyone know of a PHP framework which emulates the django model? ...

How do manage the limit of executions to be done by hour (Max: 1000 requests per hour) without a database

I am currently developing a script in PHP to fetch webpages. The fact is that by doing so, I occasionally do too much requests to a particular website. In order to control any overflow, I would like to keep trace of how many requests have been done in the last hour or so for each domain. It doesn't need to be perfect, just a good estimat...

Returning objects in php

I see similar questions asked but I seem to have problem with more basic stuff than were asked. How to declare a variable in php? My specific problem is I have a function that reads a DB table and returns the record (only one) as an object. class User{ public $uid; public $name; public $status; } function GetUserInfo($uid) { ...

Is there any reason I shouldn't do database calls from the destructor?

I want to create a sort of datamapper library, where you'd do something like this: $users = Users::getTable(); $users->add($newUser1); $users->add($newUser2); Now $users contains 2 user records, but they aren't yet persisted to the database. To be efficient, I'd like to flush them all at once. I would like to have a flush() method to ...

PHP Array Key & value Question

Hi I writed a test code as below. <?php $url = 'http://localhost/events/result/cn_index.php?login'; print_r(parse_url($url)); echo parse_url($url, PHP_URL_PATH); ?> Output Array ( [scheme] => http [host] => localhost [path] => /events/result/cn_index.php [query] => login ) /events/result/cn_index.php Now I inserted the line be...

Is there any free opensource (GNU GPL, LGPL etc) Comet Video Chat? (PHP)

Is there any free opensource (GNU GPL, LGPL etc) Comet Video Chat? (PHP) I want to integrate it into my own CMS I am creating. ...

how do i convert RSAParameters from .net to .pem file so i can use it in php

Hello i have a private and public keys for RSA generated in .net in this format string privateKey = "<RSAKeyValue>" + "<Modulus>...kCFhsjB4xMW49mrx5B/Ga...</Modulus>" + "<Exponent>...</Exponent>" + "<P>...7bRCrQVgVIfXdTIH3iY8x...</P>" + ...

What's the best way to pass a PHP variable to Javascript?

I currently echo certain variables in hidden input fields and read them out with Javascript whenever I need them. Me and a colleague are now thinking of generating an extra Javascript file with PHP which only contains all variables for Javascript. This way the variables already exist and there is no extra code in the HTML. What are goo...

php: two objects from the same class work independent of each other

Good morning, I would like the code in my controller to look something like this: <?php $class = new sanitizeInput() $string1 = $class -> input($_POST[name]) -> mysql_escape(); $string2 = $class -> input($_POST[age]) -> mysql_escape(); print " String1: $string1 <br /> String2: $string2" ?> It seems with my sanitizeInput c...