Update of /cvsroot/openfirst/update
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31386
Modified Files:
system.php
Log Message:
Ensure that FTP server is reachable after any relevant information changes.
Index: system.php
===================================================================
RCS file: /cvsroot/openfirst/update/system.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** system.php 19 Nov 2004 18:19:44 -0000 1.8
--- system.php 19 Nov 2004 20:46:21 -0000 1.9
***************
*** 45,49 ****
die(include_once($footer));
} elseif(! isset($_REQUEST["id"])) {
! // DEBUG HERE.
// Add as a new system
--- 45,59 ----
die(include_once($footer));
} elseif(! isset($_REQUEST["id"])) {
! echo "Testing FTP connection...<br>";
! $ftpreachable = ftp_connect($_REQUEST["ftpserver"]);
! if($ftpreachable) {
! $loginokay = @ftp_login($ftpreachable, $_REQUEST["ftpusername"], $_REQUEST["ftppassword"]);
! }
! if(! $ftpreachable || ! $loginokay) {
! echo "FTP server is unreachable or cannot login properly. <p>Fatal error: System profile not created<br>";
! include_once($footer);
! die();
! }
! echo "FTP connection okay.<br>";
// Add as a new system
***************
*** 59,62 ****
--- 69,96 ----
die(include_once($footer));
} elseif(isset($_REQUEST["id"])) {
+ if($_REQUEST["ftppassword"] == $_REQUEST["ftpconfirmpassword"] && $_REQUEST["ftppassword"] != "") {
+ mysql_query("UPDATE ofirst_systems SET ftppassword='" . $_REQUEST["ftppassword"] . "' WHERE id='" . $_REQUEST["id"] . "' AND owner='$user->id';");
+ echo "<br />FTP password updated.<br>";
+ } else {
+ echo "<br/ >FTP password not changed.<br>";
+ }
+
+ echo "Testing FTP connection...<br>";
+ $ftpreachable = ftp_connect($_REQUEST["ftpserver"]);
+ if($ftpreachable) {
+ if($_REQUEST["ftppassword"] == "") {
+ $loginokay = @ftp_login($ftpreachable, $_REQUEST["ftpusername"], $system->ftppassword);
+ } else {
+ $loginokay = @ftp_login($ftpreachable, $_REQUEST["ftpusername"], $_REQUEST["ftppassword"]);
+ }
+ }
+ if(! $ftpreachable || ! $loginokay) {
+ echo "FTP server is unreachable or cannot login properly. <p>Fatal error: System profile not updated<br>";
+ include_once($footer);
+ die();
+ }
+ echo "FTP connection okay.<br>";
+
+
// Update existing system configuration
echo "<br>Installation settings updated.<br>";
***************
*** 72,81 ****
WHERE id='" . $_REQUEST["id"] . "' AND owner='$user->id';");
echo "<br>" . mysql_error();
! if($_REQUEST["ftppassword"] == $_REQUEST["ftpconfirmpassword"] && $_REQUEST["ftppassword"] != "") {
! mysql_query("UPDATE ofirst_systems SET ftppassword='" . $_REQUEST["ftppassword"] . "' WHERE id='" . $_REQUEST["id"] . "' AND owner='$user->id';");
! echo "<br />FTP password updated.";
! } else {
! echo "<br/ >FTP password not changed.";
! }
include_once($footer);
die();
--- 106,110 ----
WHERE id='" . $_REQUEST["id"] . "' AND owner='$user->id';");
echo "<br>" . mysql_error();
!
include_once($footer);
die();
|