⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 webconf.cgi

📁 SIP(Session Initiation Protocol)是由IETF定义
💻 CGI
📖 第 1 页 / 共 2 页
字号:
		     "VOCAL is not running now.<P>" .		     "Please make sure that VOCAL is running ". 		     "before trying to run this system." .		     "<P><a href=\"$script_url\">" .		     "Return to main menu</a>", 		     300);}sub log_out {    return "thank you for logging out.";}sub log_in {    my $output;    $output = start_multipart_form(-method=>"post",				   -action=>"$script_url");    $output .= "<input type=hidden name=\"cmd\" value=\"cookie\">";    $output .= "<table width=100%>";    $output .= Tr(td("Username"), 		  td("<input type=text name=\"username\"></input>" ));    $output .= Tr(td("Password"), 		  td("<input type=password name=\"password\"></input>" ));    $output .= Tr(td("<input type=reset name=\"_reset\" value=\"Revert\">"),		  td("<input type=submit name=\"_submit\" value=\"Log in\">"));    $output .= "</table>";    $output .= "</form>";    return $output;}sub bad_log_in {    my $output;    $output = "Your login was incorrect or expired.  Please log in again.<p>";    $output .= &log_in();    return $output;}sub Vars {    my(@list) = $query->param();    my($params) = {};    foreach $item (@list) {	$$params{$item} = $query->param($item);    }    return $params;}######################################################################sub command_login {    print &vprov::ui::box("Login", &log_in(), 200);}sub command_bad_login {    print &vprov::ui::box("Bad Login", &bad_log_in(), 200);}sub command_logout {    print &vprov::ui::box("Thank you for logging out", &log_out(), 200);}sub command_main {    print &vprov::ui::box("Choose an action", &show_actions_table(), 200);}sub command_changeuser {    print &vprov::ui::box("Choose user to change", &select_change_user(), 200);}sub command_deleteuser {    print &vprov::ui::box("Choose user to delete", &select_delete_user(), 200);}sub command_show {    print &vprov::ui::box("User " . param('user'), 		    &show_one_user(param('user')), 		    400);}sub command_adduser {    my($output);    $output = "<form method=post action=\"$script_url\">";    $output .= "<input type=hidden name=\"cmd\" value=\"create\">";    $output .= "Enter new user id: <input type=text name=\"user\" value=\"$userid\">\n";    $output .= "<p><input type=submit name=\"_submit\" value=\"Create User\"></input>";    $output .= "</form>";        print &vprov::ui::box("Add user",		    $output,		    400);}sub command_create {    $params = Vars;        my($output) = &create_new_user($params);        if($output !~ /failed/i) {	$output .= "<p>";	$output .= "<a href=\"$script_url?cmd=show&user=$$params{user}\">";	$output .= "Go to to user page</a>";	$output .= "<br>";    }	    $output .= "<a href=\"$script_url\">";    $output .= "Return to main menu</a>";	    print &vprov::ui::box("Trying to create user \"" . param('user') .'"',		    $output,		    400);}sub command_write {    $params = Vars;    my($fh);    if ($$params{'uploaded_greeting'}) {	$fh = $query->upload('uploaded_greeting');    }    my($output) = &update_one_user($params, $fh);        $output .= "<p>";    $output .= "<a href=\"$script_url?cmd=show&user=$$params{user}\">";    $output .= "Return to user page</a>";        $output .= "<br><a href=\"$script_url\">";    $output .= "Return to main menu</a>";        print &vprov::ui::box("Trying to save user \"" . param('user') .'"',		    $output,		    400);}sub command_delete {    $params = Vars;        my($output) = &delete_one_user($params);        $output .= "<p>";    $output .= "<a href=\"$script_url\">";    $output .= "Return to main page</a>";        print &vprov::ui::box("Trying to delete user \"" . param('user') .'"',		    $output,		    400);}sub command_setvmdialplan {    $params = Vars;    my($output) = &set_vm_dialplan();        $output .= "<p>";    $output .= "<a href=\"$script_url\">";    $output .= "Return to main page</a>";    print &vprov::ui::box("Trying to create VM dialplan",		    $output,		    400);}sub command_writegw {    $params = Vars;        my($output) = &update_gw($params);        $output .= "<p><a href=\"$script_url\">";    $output .= "Return to main menu</a>";        print &vprov::ui::box("Trying to write Gateway",		    $output,		    400);}sub command_showgw {    $params = Vars;    print &vprov::ui::box("Change Gateway",		    &show_gw(),		    400);}sub command_showstatus {    my($output)="<table width=\"100%\" border=\"0\" cellspacing=\"0\">";    my (@color) = ("#ffffff", "#e0e0ff");    my $count = 1;    $output .= Tr({ -align=>LEFT}, th(['Process', 'Port', 'PID']));    open STATUS, "../bin/vocalctl status |" or die "can't fork";    while (<STATUS>) {      ($proc, $port, $pid) = split;      if ( ($proc eq "ps") || ($proc eq "vmserver") )      {        $pid = $port;        $port = "";      }      $output .= Tr({ -align=>LEFT, -bgcolor=>$color[$count % 2]  }, td([$proc, $port, $pid]));      $count++;    }    $output .= "</table>";    print &vprov::ui::box("System Status",		    $output,		    400);}$cmd = {	main => { code => \&command_main, text => "Main menu", menu => 1 },	adduser => { code => \&command_adduser, text => "Add user", menu => 2 },	changeuser => { code => \&command_changeuser, text => "Change user", menu => 3 },	deleteuser => { code => \&command_deleteuser, text => "Delete user", menu => 4 },#	setvmdialplan => { code => \&command_setvmdialplan, text => "Enable VM dialplan", menu => 5 },	showgw => {  code => \&command_showgw, text => "Change gateway", menu => 5 },	showstatus => {  code => \&command_showstatus, text => "System Status", menu => 6 },	show => { code => \&command_show, text => "Show" },	write => { code => \&command_write, text => "Write" },	create => { code => \&command_create, text => "Create" },	delete => { code => \&command_delete, text => "Delete" },	writegw => { code => \&command_writegw, text => "Writegw" },	login => { code => \&command_login, text => "Log in", menu => 7 },	login_again => { code => \&command_login, text => "Log in again" },	bad_login => { code => \&command_bad_login, text => "Bad login" },	logout => { code => \&command_logout, text => "Log out", menu => 8 },       };if($query->param()) {    $command = $query->param('cmd');} else {    $command = "main";}if($command eq "logout") {    $cookie_user = cookie(-name => "user",			  -value => "",			  -path => "/vocalconf/",			  -expires => "");    $cookie_pass = cookie(-name => "pass",			  -value => "",			  -path => "/vocalconf/",			  -expires => "");} elsif($command eq "cookie") {    # form a cookie    if(&set_user_pass($query->param("username"), $query->param("password"))) {	$cookie_user = cookie(-name => "user",			      -value => param('username'),			      -path => "/vocalconf/",			      -expires => "");	$cookie_pass = cookie(-name => "pass",			      -value => param('password'),			      -path => "/vocalconf/",			      -expires => "");	$command = "main";	$verify_ok = &verify_active();	&psdebug("verify: $verify_ok\n");    } else {	$command = "bad_login";    }} elsif($query->param('debugmode')) {    print STDERR "\n\nDebug mode\n\n";    &set_user_pass($query->param("username"), $query->param("password"));    # debug-mode -- just go forward    $verify_ok = &verify_active();    &psdebug("verify: $verify_ok\n");} elsif( !($query->cookie("user") && $query->cookie("pass")) || 	 !&set_user_pass($query->cookie("user"), $query->cookie("pass"))) {    # not logged in.    $command = "login";} else {    # $verify_ok is true if the PSERVER is active    $verify_ok = &verify_active();    &psdebug("verify: $verify_ok\n");}&psdebug("command: $command\n");$cmd_to_exec = $$cmd{$command}{code};if($cookie_user && $cookie_pass) {    print &html_header($cookie_user, $cookie_pass);} else {    print &html_header();}if($command eq "login" || $command eq "logout" || $command eq "login_again" || $command eq "bad_login" || $verify_ok) {    if(!$cmd_to_exec) {	$cmd_to_exec = \&command_main;    }        &{$cmd_to_exec}();} else {    print &inactive_box();}&psdebug("ended: " . time());print "<PRE>" . &psdebug_get() . "</PRE>\n" if $debug;print &html_footer();sub debug {    $debug_string .= join('\n', @_);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -