- split() -> explode()
authorNozomi Anzai <anzai at sraoss.co.jp>
Tue, 11 Oct 2011 07:28:14 +0000 (07:28 +0000)
committerNozomi Anzai <anzai at sraoss.co.jp>
Tue, 11 Oct 2011 07:28:14 +0000 (07:28 +0000)
- based on one coding rule

changePassword.php

index 5f835b8e53b3f77ecd0172cbf1b475da4c5e2fd8..3d43dc8de84018a1777e6112f1182b76ad9a1e96 100644 (file)
@@ -26,7 +26,7 @@
 require_once('common.php');
 $tpl->assign('help', basename( __FILE__, '.php'));
 
-if(!isset($_SESSION[SESSION_LOGIN_USER])) {
+if (!isset($_SESSION[SESSION_LOGIN_USER])) {
     header('Location: login.php');
     exit();
 }
@@ -41,7 +41,7 @@ if(isset($_POST['action'])) {
 switch ( $action ) {
     case 'update':
 
-        if(!isset($_POST['password']) || !isset($_POST['password2'])) {
+        if (!isset($_POST['password']) || !isset($_POST['password2'])) {
             $tpl->display('changePassword.tpl');
             break;
         }
@@ -49,23 +49,23 @@ switch ( $action ) {
         $password  = $_POST['password'];
         $password2 = $_POST['password2'];
 
-        if($password == '' || $password2 == '') {
+        if ($password == '' || $password2 == '') {
             $tpl->assign('error', $message['errPasswordMismatch']);
             $tpl->display('changePassword.tpl');
             break;
         }
 
-        if($password === $password2) {
+        if ($password === $password2) {
 
             $passFile = @file(_PGPOOL2_PASSWORD_FILE);
-            if($passFile == false) {
+            if ($passFile == FALSE) {
                 $errorCode = 'e6001';
                 $tpl->assign('errorCode', $errorCode);
                 $tpl->display('error.tpl');
                 exit();
             }
 
-            if! is_writable(_PGPOOL2_PASSWORD_FILE) ) {
+            if (! is_writable(_PGPOOL2_PASSWORD_FILE) ) {
                 $errorCode = 'e6003';
                 $tpl->assign('errorCode', $errorCode);
                 $tpl->display('error.tpl');
@@ -73,12 +73,12 @@ switch ( $action ) {
             }
             $fw = fopen(_PGPOOL2_PASSWORD_FILE, 'w');
 
-            for($i=0; $i<count($passFile); $i++) {
+            for ($i = 0; $i<count($passFile); $i++) {
 
                 $line = $passFile[$i];
-                $spt = split(":", $line);
+                $spt = explode(":", $line);
 
-                if($spt[0] == $_SESSION[SESSION_LOGIN_USER]) {
+                if ($spt[0] == $_SESSION[SESSION_LOGIN_USER]) {
                     $line = $_SESSION[SESSION_LOGIN_USER] . ":" . md5($password) . "\n";
                 }
                 fputs($fw, $line);
@@ -88,6 +88,7 @@ switch ( $action ) {
             session_unset();
             $tpl->display('login.tpl');
             break;
+
         } else {
             $tpl->assign('error', $message['errPasswordMismatch']);
         }