diff --git a/0.sms.command.sh b/0.sms.command.sh new file mode 100755 index 0000000..590514c --- /dev/null +++ b/0.sms.command.sh @@ -0,0 +1,30 @@ +# Author: Fred (support@qo-op.com) +# Version: 0.2 +# License: GPL (http://www.google.com/search?q=GPL) +################################################################################ +# READ /tmp/sms.commands and RUN it.. TODO, add keys for security ;) +################################################################################# +# RECEIVE COMMAND FROM ./www/LOVELand/g1billet/zen_sms.php +# +MY_PATH="`dirname \"$0\"`" # relative +MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized + +[[ -f /tmp/sms.commands ]] && echo "" > /tmp/sms.commands +tail -fn 1 /tmp/sms.commands | while read -r line +do + if [[ $line != "" ]]; then + mycmd="$MY_PATH/g1sms/sms_AUTH.sh $line" + echo "RUN: $mycmd" > /tmp/sms.commmand.result + eval "$mycmd" >> /tmp/sms.commmand.result + fi +done diff --git a/g1sms/sms_AUTH.sh b/g1sms/sms_AUTH.sh new file mode 100755 index 0000000..6296a68 --- /dev/null +++ b/g1sms/sms_AUTH.sh @@ -0,0 +1,57 @@ +#!/bin/bash +################################################################################ +# Author: Fred (support@qo-op.com) +# Version: 0.1 +# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) +################################################################################ +MY_PATH="`dirname \"$0\"`" # relative +MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized + +cd ~/.zen/astroport/g1sms/ + +source ./init.sh +source ./functions.sh + +PHONE=$1 +VALEUR=$2 +TODAY=$(date '+%Y%m%d') +log "__SUB:sms_AUTH.sh ($PHONE, $VALEUR)" + +## INITIALIZE RESULT FILE +[[ $VALEUR == "" ]] && echo "Indiquez la valeur des G1Billets" && exit 1 +[[ $PHONE != "" ]] && sms_INIT_ACCOUNT "$PHONE" "NOSMS" || exit 1 +[[ $UNKNOWN == "unknown" ]] && echo "G1sms Wallet $PHONE inconnu! Envoyer N au $MASTERPHONE" && exit 1 + +# Get AMOUNTG1, AMOUNTLOVE, AMOUNTDU +AMOUNTG1=$(silkaj_balance $PUBKEY) +AMOUNTDU=$(bc -l <<< "scale=2; $AMOUNTG1 / $DUFACTOR") +AMOUNTLOVE=$(bc -l <<< "scale=0; $AMOUNTG1 * 100 / $DUFACTOR") + +# Convert amount to G1 unit +VIR=$(bc -l <<< "scale=2; $VALEUR * $DUFACTOR / 100") + +# Need at least $MIN G1 available! +MIN=$(bc -l <<< "$AMOUNTG1 - $LIMIT") +testmin=$( echo "${VIR} < ${MIN}" | bc -l ) +SMSPIN=$((1000 + RANDOM % 9999)) + +log "__SUB:sms_AUTH.sh: CODE $SMSPIN : $VIR < $MIN ? $testmin" +if [[ "$testmin" -eq "1" ]] +then + mess="CODE: $SMSPIN +A saisir pour vous authentifier... +[G1] Zen Astroport Satellite #$(cat /etc/hostname)" + # Send response SMS + sms_SEND "$PHONE" "$mess" + echo $SMSPIN > /tmp/$PHONE.PIN.auth + echo $SMSPIN +else + text="Solde: $AMOUNTLOVE LOVE ($AMOUNTG1 G1 = $AMOUNTDU DU) +Insuffisant (minimum $VIR G1 + $LIMIT G1)" + sms_ERROR "$PHONE" "$text" + echo "Minimum $VIR G1 + $LIMIT G1" +fi +log "__SUB:sms_AUTH.sh: END sms_AUTH.sh " +log "~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + +exit 0 diff --git a/www/LOVELand/error/400.html b/www/LOVELand/error/400.html index 39fd163..a4167ba 100644 --- a/www/LOVELand/error/400.html +++ b/www/LOVELand/error/400.html @@ -54,7 +54,7 @@
Please contact the webmaster with any queries.