slitaz-forge rev 326

usbkey.slitaz.org update
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Aug 15 16:32:07 2012 +0200 (2012-08-15)
parents efd18dbda796
children b4b47a61fb4b
files usbkey/head.php usbkey/helper.sh usbkey/main.php usbkey/preorder.php usbkey/resend.php
line diff
     1.1 --- a/usbkey/head.php	Fri Aug 10 08:47:21 2012 +0000
     1.2 +++ b/usbkey/head.php	Wed Aug 15 16:32:07 2012 +0200
     1.3 @@ -17,7 +17,7 @@
     1.4  #bottom {
     1.5  	text-align: center;
     1.6  }
     1.7 -.cfrm { // capcha
     1.8 +#capcha {
     1.9  	display: none;
    1.10  }
    1.11  	</style>
     2.1 --- a/usbkey/helper.sh	Fri Aug 10 08:47:21 2012 +0000
     2.2 +++ b/usbkey/helper.sh	Wed Aug 15 16:32:07 2012 +0200
     2.3 @@ -15,7 +15,8 @@
     2.4  	print last " : " n
     2.5  }'
     2.6  	else
     2.7 -		ls $dir/?/* 2> /dev/null | wc -l
     2.8 +		sed '/"count";s:1:/!d;s/.*"count";s:1:"\([0-9]*\)";.*/\1/' $dir/?/* | \
     2.9 +			awk 'BEGIN { n=0 }{ n+=$0 } END { print n }'
    2.10  	fi
    2.11  	exit	
    2.12  fi
    2.13 @@ -36,13 +37,13 @@
    2.14  From: usbkey-preorder@$DOMAIN
    2.15  Reply-To: no-reply@$DOMAIN
    2.16  To: $SENDTO
    2.17 -Date: $(date '+%a, %d %b %Y %H:%M:%S %z')
    2.18 +Date: $(LC_ALL=C date '+%a, %d %b %Y %H:%M:%S %z')
    2.19  Subject: $SUBJECT
    2.20  
    2.21  Hello $SURNAME,
    2.22  
    2.23  A $KEYSIZE SliTaz USB key will be reserved for you.
    2.24 -Would you mind confirming the pre-ordering with the following link
    2.25 +Would you mind confirm the pre-ordering with the following link
    2.26  http://usbkey.slitaz.org/?confirm=$HASH
    2.27  
    2.28  Or cancel the registration with the following link
     3.1 --- a/usbkey/main.php	Fri Aug 10 08:47:21 2012 +0000
     3.2 +++ b/usbkey/main.php	Wed Aug 15 16:32:07 2012 +0200
     3.3 @@ -8,7 +8,8 @@
     3.4  	<!-- Information/image -->
     3.5  	<div id="block_info">
     3.6  		<?php echo $characteristics ?>
     3.7 -		<h4><?php system("../helper.sh --stats confirmed"); echo $stats ?></h4>
     3.8 +		<h4><?php system("../helper.sh --stats confirmed"); echo $stats.", ";
     3.9 +		          system("../helper.sh --stats pending"); echo $pending."."  ?></h4>
    3.10  	</div>
    3.11  </div>
    3.12  		
    3.13 @@ -39,7 +40,7 @@
    3.14  <!--
    3.15  function valid(f)
    3.16  {
    3.17 -	if (f.email.value.indexOf("@",0) < 0) {
    3.18 +	if (f.email.value == "" || f.email.value.indexOf("@",0) < 0) {
    3.19  		alert("<?php echo $enter_email ?>")
    3.20  		f.email.focus()
    3.21  		return
    3.22 @@ -77,6 +78,14 @@
    3.23  </script>
    3.24  <form method="post" action="../preorder.php">
    3.25  <input type="hidden" name="lang" value="<?php echo $lang ?>" />
    3.26 +<input type="hidden" name="ip" value="<?php 
    3.27 +if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) 
    3.28 +     echo $_SERVER["HTTP_X_FORWARDED_FOR"];
    3.29 +else echo $_SERVER["REMOTE_ADDR"];
    3.30 +?>" />
    3.31 +<div id="capcha">
    3.32 +<input name="host" type="text" value="" />
    3.33 +</div>
    3.34  <table width="100%">
    3.35  <tbody>
    3.36  	<tr>
     4.1 --- a/usbkey/preorder.php	Fri Aug 10 08:47:21 2012 +0000
     4.2 +++ b/usbkey/preorder.php	Wed Aug 15 16:32:07 2012 +0200
     4.3 @@ -2,6 +2,7 @@
     4.4  include("./head.php");
     4.5  
     4.6  echo '<div id="content">';
     4.7 +if (!isset($_POST['host']) || $_POST['host'] == "") { // capcha
     4.8  $data = serialize($_POST);
     4.9  $hash = md5($data);
    4.10  @mkdir("pending/".substr($hash,0,1),0777,TRUE);
    4.11 @@ -13,6 +14,7 @@
    4.12  	  $_POST['email']."' '".$_POST['surname']."' '".$_POST['size'].
    4.13  	  "' ".$hash);
    4.14  echo "Thanks ".$_POST['surname'].".<br>\nAn email has been send to ".$_POST['email'].".";
    4.15 +}
    4.16  echo '</div>';
    4.17  include("./tail.php");
    4.18  ?>
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/usbkey/resend.php	Wed Aug 15 16:32:07 2012 +0200
     5.3 @@ -0,0 +1,12 @@
     5.4 +<?php
     5.5 +$i = 1;
     5.6 +for ($i = 1; isset($argv[$i]); $i++) {
     5.7 +	$hash = basename($argv[$i]);
     5.8 +	$data = file_get_contents($argv[$i]);
     5.9 +	$_POST = unserialize($data);
    5.10 +
    5.11 +system(dirname($_SERVER["SCRIPT_FILENAME"])."/helper.sh '".
    5.12 +	  $_POST['email']."' '".$_POST['surname']."' '".$_POST['size'].
    5.13 +	  "' ".$hash);
    5.14 +}
    5.15 +?>