[PHP] Radius Authenticatie

Pagina: 1
Acties:
  • 51 views sinds 30-01-2008

  • HekkeySE
  • Registratie: Maart 2000
  • Niet online
Ik zoek een php script die via een radius server authenticeert. Heb een script gevonden maar die werkt niet :'(

Kan iemand mij helpen?

Recht op morgen heb ik niet, maar morgen wordt beter dan vandaag en gisteren bestaat niet.


  • seweso
  • Registratie: Augustus 2003
  • Laatst online: 04-04-2018

seweso

de mouw is uit de aap

Eeh als je nou eens de fout uit het script haalt? :P

seweso's blog


  • BtM909
  • Registratie: Juni 2000
  • Niet online

BtM909

Watch out Guys...

HekkeySE schreef op 22 april 2004 @ 09:27:
Ik zoek een php script die via een radius server authenticeert. Heb een script gevonden maar die werkt niet :'(

Kan iemand mij helpen?
* BtM909 helpt meezoeken... Heb je al in de schuur gekeken :?


oftewel: lees ook eens: P&W Beleid

Ace of Base vs Charli XCX - All That She Boom Claps (RMT) | Clean Bandit vs Galantis - I'd Rather Be You (RMT)
You've moved up on my notch-list. You have 1 notch
I have a black belt in Kung Flu.


  • HekkeySE
  • Registratie: Maart 2000
  • Niet online
seweso schreef op 22 april 2004 @ 09:45:
Eeh als je nou eens de fout uit het script haalt? :P
Haha das een goede ;)

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
    if ($PHP_AUTH_USER=="") {
    header("HTTP/1.0 401 Unauthorized");
    Header("WWW-Authenticate: Basic realm=\"PHP Radius test script\"");
    echo "<html><head><title>401 Unauthorized access</title></head><body>";
    echo "<h1>401 Unauthorized access</h1>";
    echo "You must login using your username and password.</body></html>";
    exit;
    }

    require "radius_authentication.inc";
    function radius_authenticate($user,$password) {
    global $HTTP_COOKIE_VARS;
    global $REMOTE_ADDR;

    if (($db=dba_open("/tmp/radiuscache","c","ndbm"))==FALSE) {
        echo "Couldn't open /tmp/radiuscache<br>\n";
    }

    $cookie=$HTTP_COOKIE_VARS["radius_test"];
    if ($cookie!="") {
        $lastid=dba_fetch($cookie."_id",$db);
        $laston=dba_fetch($cookie."_laston",$db);
        $lasthost=dba_fetch($cookie."_fromip",$db);
        $lastuserid=dba_fetch($cookie."_userid",$db);
    }

    if ($cookie=="" || $lastid=="" ||
        $laston==0 || $laston<time()-15*60 ||
        $lasthost!=$REMOTE_ADDR || $lastuserid!=$user) {

        // 2 -> Access-Accept
        // 3 -> Access-Reject
        if (($retval=RADIUS_AUTHENTICATION($user,$password))==2) {
        if ($cookie=="") $cookie=md5(uniqid(rand()));
        setcookie("radius_test",$cookie);
        dba_replace($cookie."_id",$cookie,$db);
        dba_replace($cookie."_userid",$user,$db);
        dba_replace($cookie."_fromip",$REMOTE_ADDR,$db);
        dba_replace($cookie."_laston",time(),$db);
        }
    } else {
        setcookie("radius_test",$cookie);
        dba_replace($cookie."_laston",time(),$db);
        $retval=2;
    }

    dba_close($db);
    return $retval==2;
    }

    if (!radius_authenticate($PHP_AUTH_USER,$PHP_AUTH_PW)) {
    header("HTTP/1.0 401 Unauthorized");
    Header("WWW-Authenticate: Basic realm=\"PHP Radius test script\"");
    echo "<html><head><title>401 Unauthorized access</title></head><body>";
    echo "<h1>401 Unauthorized access</h1>";
    echo "You must login using a valid username and password</body></html>";
    echo "Used was '$PHP_AUTH_USER' '$PHP_AUTH_PW'<br>\n";
    exit;
    }
    
    echo "<html><head><title>200 Welcome!</title></head><body>";
    echo "<h1>200 Welcome</h1>";
    echo "You logged in using a valid username and password</body></html>";

Recht op morgen heb ik niet, maar morgen wordt beter dan vandaag en gisteren bestaat niet.


  • Erkens
  • Registratie: December 2001
  • Niet online

Erkens

Fotograaf

dus wij moeten scripts die jij niet draaiend krijgt debuggen?

  • whoami
  • Registratie: December 2000
  • Laatst online: 23:32
Scriptrequests zijn hier niet toegestaan.
Ondersteuning van scripts die door anderen geschreven zijn doen we hier niet.
Debuggen moet je zelf kunnen.
Lees ook eens de P&W Quickstart

https://fgheysels.github.io/

Pagina: 1

Dit topic is gesloten.