summaryrefslogtreecommitdiff
path: root/appli_3_alpha_old/app/include/ludo/auth.inc.php
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2018-06-30 11:26:37 +0200
committerLudovic Pouzenc <ludovic@pouzenc.fr>2018-06-30 11:26:37 +0200
commit19cdd5e2fde57d53f05570cd50f5ffd223182566 (patch)
treeed6a50c73c16b3c5a2cee8c8954e46268c256ee3 /appli_3_alpha_old/app/include/ludo/auth.inc.php
parent3c8d3719af0f77f8a01881b022e548d3a7d4604e (diff)
download2007-AWOR-19cdd5e2fde57d53f05570cd50f5ffd223182566.tar.gz
2007-AWOR-19cdd5e2fde57d53f05570cd50f5ffd223182566.tar.bz2
2007-AWOR-19cdd5e2fde57d53f05570cd50f5ffd223182566.zip
Renommage pour diff entre appli_3_alpha_old et beta_old1
Diffstat (limited to 'appli_3_alpha_old/app/include/ludo/auth.inc.php')
-rw-r--r--appli_3_alpha_old/app/include/ludo/auth.inc.php78
1 files changed, 0 insertions, 78 deletions
diff --git a/appli_3_alpha_old/app/include/ludo/auth.inc.php b/appli_3_alpha_old/app/include/ludo/auth.inc.php
deleted file mode 100644
index 18b339d..0000000
--- a/appli_3_alpha_old/app/include/ludo/auth.inc.php
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-/*
- * Collection de fonctions pour une authentification externe POP3
- */
-
-// Constantes d'erreur
-define("ERR_POP3_AUTH_BADSOCK", -1);
-define("ERR_POP3_AUTH_SERVERNACK", -2);
-define("ERR_POP3_AUTH_BADUSER", -3);
-define("ERR_POP3_AUTH_BADPASS", -4);
-define("ERR_BAD_PARAMS", -100);
-
-// Fonction d'authentification pop3
-function pop3_auth_simple($mail, $upw)
-{
- if ( ($ret = ereg ( "(^.*)@([[:alnum:]]+\.[[:alnum:]]+)", $mail, $re_tokens ) ) )
- {
- /* $re_tokens []
- * [0] : email complet
- * [1] : nom_mail
- * [2] : serveur_mail
- */
- require_once('config.inc.php');
- $srv_conf = $CONFIG['AUTH']['POP']['SERVERS'][strtolower($re_tokens[2])];
- if ( is_array($srv_conf) )
- {
- $server=$srv_conf['subdomain'];
- $port=$srv_conf['port'];
- if ( $srv_conf['username_is_full_mail'] )
- { $user = $mail; } else { $user = $re_tokens[1]; }
- return pop3_auth ($server, $port, $user, $upw);
- }
- }
- /* DEBUG
- echo $mail . "\n" . $ret . "\n";;
- print_r($re_tokens);
- */
- return ERR_BAD_PARAMS;
-}
-
-function pop3_auth ($server, $port, $user, $upw)
-{
- //echo "DEBUG : fsockopen($server, $port, $errno, $errstr, 10);";
- $sock = @fsockopen($server, $port, $errno, $errstr, 10);
- if ( $sock === false)
- {
- return ERR_POP3_AUTH_BADSOCK;
- }
-
- //stream_set_timeout ( $sock, 1, 0 );
-
- fputs($sock, "user $user\r\n");
-
- if ( pop3_GetAndTestReply($sock) === false )
- {
- return ERR_POP3_AUTH_BADUSER;
- }
-
- fputs($sock, "pass $upw\r\n");
-
- if ( pop3_GetAndTestReply($sock) === false )
- {
- return ERR_POP3_AUTH_BADPASS;
- }
-
- fputs($sock, "quit\r\n");
-
- return 0;
-}
-
-// Fonction interne testant les réponses du serveur POP3
-function pop3_GetAndTestReply($sock)
-{
- $reply = fgets($sock, 128);
- echo $reply . "\n";
- return ( substr($reply, 0, 4) == "+OK " );
-}
-?> \ No newline at end of file