@@ -25,25 +25,31 @@ function save($curpass, $passwd)
2525 $ vesta_port = '8083 ' ;
2626 }
2727
28- $ request = 'email= ' .$ _SESSION ['username ' ].'& ' ;
29- $ request .= 'password= ' .$ curpass .'& ' ;
30- $ request .= 'new= ' .$ passwd .'& ' ;
31-
32-
33- $ context = stream_context_create (array (
34- 'http ' => array (
35- 'method ' => 'POST ' ,
36- 'header ' => 'Content-Type: application/x-www-form-urlencoded ' . PHP_EOL ,
37- 'content ' => $ request ,
38- ),
39- ));
40-
41- $ result = file_get_contents (
42- $ file = "https:// " .$ vesta_host .": " .$ vesta_port ."/reset/mail/? " ,
43- $ use_include_path = false ,
44- $ context );
45-
46- if ($ result == 'ok ' ){
28+ $ postvars = array (
29+ 'email ' => $ _SESSION ['username ' ],
30+ 'password ' => $ curpass ,
31+ 'new ' => $ passwd
32+ );
33+
34+ $ postdata = http_build_query ($ postvars );
35+
36+ $ send = 'POST /reset/mail/ HTTP/1.1 ' . PHP_EOL ;
37+ $ send .= 'Host: ' . $ vesta_host . PHP_EOL ;
38+ $ send .= 'User-Agent: PHP Script ' . PHP_EOL ;
39+ $ send .= 'Content-length: ' . strlen ($ postdata ) . PHP_EOL ;
40+ $ send .= 'Content-type: application/x-www-form-urlencoded ' . PHP_EOL ;
41+ $ send .= 'Connection: close ' . PHP_EOL ;
42+ $ send .= PHP_EOL ;
43+ $ send .= $ postdata . PHP_EOL . PHP_EOL ;
44+
45+ $ fp = fsockopen ('ssl:// ' . $ vesta_host , $ vesta_port );
46+ fputs ($ fp , $ send );
47+ $ result = fread ($ fp , 2048 );
48+ fclose ($ fp );
49+
50+
51+ if (strpos ($ result , 'ok ' ) && !strpos ($ html , 'error ' ))
52+ {
4753 return PASSWORD_SUCCESS ;
4854 }
4955 else {
0 commit comments