Create or create and download. Code tidy. Swap Submit button
This commit is contained in:
		| @@ -188,7 +188,8 @@ case 'confirm': | |||||||
| 	<p><form action='<?php echo $PHP_SELF?>' method=post> | 	<p><form action='<?php echo $PHP_SELF?>' method=post> | ||||||
| 	<?php echo  $hidden_fields ?> | 	<?php echo  $hidden_fields ?> | ||||||
| 	<input type=hidden name=form_stage value=final> | 	<input type=hidden name=form_stage value=final> | ||||||
|   	<input type=submit name=submit value='Yes!  Create and Download' >  |   	<input type=submit name=submit value='Yes.  Create and Download' >  | ||||||
|  | 	<input type=submit name=submit value='Yes.  Just Create' >  | ||||||
|   	<input type=submit name=submit value='Go Back'> |   	<input type=submit name=submit value='Go Back'> | ||||||
| 	</form> | 	</form> | ||||||
|  |  | ||||||
| @@ -212,13 +213,12 @@ case 'confirm': | |||||||
| 	break; | 	break; | ||||||
|  |  | ||||||
| case 'final': | case 'final': | ||||||
| 	if ($submit == "Yes!  Create and Download") { | 	if ($submit == "Yes  Create and Download" || $submit == "Yes.  Just Create") { | ||||||
| 		if (! $serial = CAdb_in($email,$common_name)) { | 		if (! $serial = CAdb_in($email,$common_name)) { | ||||||
| 			list($ret,$errtxt) = CA_create_cert($cert_type, $country, $province, $locality, $organization, $unit, $common_name, $email, $expiry, $passwd, $keysize, $dns_names, $ip_addr); | 			list($ret,$errtxt) = CA_create_cert($cert_type, $country, $province, $locality, $organization, $unit, $common_name, $email, $expiry, $passwd, $keysize, $dns_names, $ip_addr); | ||||||
|  |  | ||||||
| 			if (! $ret) { | 			if (! $ret) { | ||||||
| 	                	printHeader(); | 	                	printHeader(); | ||||||
|  |  | ||||||
| 				?> | 				?> | ||||||
| 				<form action="<?php echo $PHP_SELF?>" method="post"> | 				<form action="<?php echo $PHP_SELF?>" method="post"> | ||||||
| 					<font color=#ff0000> | 					<font color=#ff0000> | ||||||
| @@ -233,7 +233,6 @@ case 'final': | |||||||
| 					<p> | 					<p> | ||||||
| 				</form> | 				</form> | ||||||
| 				<?php | 				<?php | ||||||
|  |  | ||||||
| 				printFooter(); | 				printFooter(); | ||||||
| 				break; | 				break; | ||||||
|         		} |         		} | ||||||
| @@ -241,7 +240,9 @@ case 'final': | |||||||
| 				$serial = $errtxt; | 				$serial = $errtxt; | ||||||
|         		} |         		} | ||||||
| 		} | 		} | ||||||
|  | 	} | ||||||
| 	 | 	 | ||||||
|  |     if ($submit == "Yes  Create and Download") { | ||||||
| 		switch($cert_type) { | 		switch($cert_type) { | ||||||
| 		case 'server': | 		case 'server': | ||||||
| #               upload(array("$config[private_dir]/$serial-key.pem","$config[new_certs_dir]/$serial.pem",$config['cacert_pem']), "$common_name ($email).pem",'application/pkix-cert'); | #               upload(array("$config[private_dir]/$serial-key.pem","$config[new_certs_dir]/$serial.pem",$config['cacert_pem']), "$common_name ($email).pem",'application/pkix-cert'); | ||||||
| @@ -258,11 +259,15 @@ case 'final': | |||||||
| 				break; | 				break; | ||||||
| 		} | 		} | ||||||
| 	     | 	     | ||||||
|  | 		# Clear common_name fields | ||||||
|  | 	    $common_name = ''; | ||||||
| 		break; | 		break; | ||||||
|  | 	} | ||||||
| 	 | 	 | ||||||
| # Clear common_name fields | # Clear common_name fields | ||||||
| $common_name = ''; | $common_name = ''; | ||||||
| 	} |  | ||||||
|  | // We could add 'return to index or create another certificate' | ||||||
|  |  | ||||||
| default: | default: | ||||||
| 	# | 	# | ||||||
| @@ -284,6 +289,7 @@ default: | |||||||
|  |  | ||||||
| 	printHeader(); | 	printHeader(); | ||||||
| 	?> | 	?> | ||||||
|  | 	 | ||||||
| 	<body onLoad="self.focus();document.request.common_name.focus();document.request.cert_type.onchange();"> | 	<body onLoad="self.focus();document.request.common_name.focus();document.request.cert_type.onchange();"> | ||||||
| 	<form action="<?php echo $PHP_SELF?>" method=post name=request> | 	<form action="<?php echo $PHP_SELF?>" method=post name=request> | ||||||
| 	<table width=99%> | 	<table width=99%> | ||||||
| @@ -329,8 +335,8 @@ default: | |||||||
| 	<tr> | 	<tr> | ||||||
| 	<td>Certificate Life<font color=red size=3>*</font> </td> | 	<td>Certificate Life<font color=red size=3>*</font> </td> | ||||||
| 	<td><select name=expiry> | 	<td><select name=expiry> | ||||||
| 	<?php |  | ||||||
|  |  | ||||||
|  | 	<?php | ||||||
| 	print "<option value=0.083 " . ($expiry == 1 ? "selected='selected'" : "") . " >1 Month</option>\n" ; | 	print "<option value=0.083 " . ($expiry == 1 ? "selected='selected'" : "") . " >1 Month</option>\n" ; | ||||||
| 	print "<option value=0.25 " . ($expiry == 1 ? "selected='selected'" : "") . " >3 Months</option>\n" ; | 	print "<option value=0.25 " . ($expiry == 1 ? "selected='selected'" : "") . " >3 Months</option>\n" ; | ||||||
| 	print "<option value=0.5 " . ($expiry == 1 ? "selected='selected'" : "") . " >6 Months</option>\n" ; | 	print "<option value=0.5 " . ($expiry == 1 ? "selected='selected'" : "") . " >6 Months</option>\n" ; | ||||||
| @@ -351,8 +357,8 @@ default: | |||||||
| 	for ( $i = 512 ; $i <= 4096 ; $i+= 512 ) { | 	for ( $i = 512 ; $i <= 4096 ; $i+= 512 ) { | ||||||
| 		print "<option value=$i " . ($keysize == $i ? "selected='selected'" : "") . ">$i bits</option>\n" ; | 		print "<option value=$i " . ($keysize == $i ? "selected='selected'" : "") . ">$i bits</option>\n" ; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	?> | 	?> | ||||||
|  |  | ||||||
| 	</select></td> | 	</select></td> | ||||||
| 	</tr> | 	</tr> | ||||||
|  |  | ||||||
| @@ -379,9 +385,12 @@ default: | |||||||
| 	<tr id="testrow1" name="testrow1" style="visibility:hidden;display:none;"> | 	<tr id="testrow1" name="testrow1" style="visibility:hidden;display:none;"> | ||||||
| 	<td>IP's<br>(only one per Line)</td><td><textarea name=ip_addr cols=30 rows=5><?php echo htvar($ip_addr) ?></textarea></td> | 	<td>IP's<br>(only one per Line)</td><td><textarea name=ip_addr cols=30 rows=5><?php echo htvar($ip_addr) ?></textarea></td> | ||||||
| 	</tr> | 	</tr> | ||||||
|  |  | ||||||
|     <tr> |     <tr> | ||||||
| 	<td><center><input type=submit name=submit value='Submit Request'></center><input type=hidden name=form_stage value='validate'></td><td><font color=red size=3>* Fields are required</td> | 		<td> </td> | ||||||
|  | 		<td> </td> | ||||||
|  | 	</tr> | ||||||
|  | 	<tr> | ||||||
|  | 	<td><font color=red size=3>* Fields are required</td><td><input type=submit name=submit value='Submit Request'><input type=hidden name=form_stage value='validate'></td> | ||||||
| 	</tr> | 	</tr> | ||||||
| 	</table> | 	</table> | ||||||
| 	</form> | 	</form> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 John Crisp
					John Crisp