#!/usr/bin/perl

# If you are NT user, "/put/the/place/of/the/script/": 
$root = "";

##############################################
##                                          ##
##  PROFILE MANAGER 1.13                    ##
##                                          ##
##  Aytekin Tank                            ##
##  email: aytekin@interlogy.com            ##
##  http://www.interlogy.com/scripts/pmpre  ##
##                                          ##
##  Copyright 1999-2001, Aytekin Tank.      ##
##                                          ##
##############################################


###############################
# Let the browser know..
###############################
print "Content-type: text/html\n\n";

 ###############################
 # Security block:
 ###############################
 @blocked_features = qw( delete modify deleted modify_success delete_success panel  );

 if($input{'action'} eq "show"){
	foreach(@blocked_features){
		if($input{'temp'} eq $_){
			err("This feature is blocked for \"show\" action!");
			exit;
		}
	}
 }

###############################
# Make it easy to find the errors
###############################
eval("main");
if ($@) {
   print "Content-type: text/plain\n\n",
   &err("<p>\n$@\n");
  }
 
sub main
{
 ###############################
 # functions library:
 ###############################
 require "${root}pm.lib";

 ###############################
 # Read the data coming from the form..
 ###############################
 if(!$dontparse){ &readit; }
 
 ###############################
 # main comfiguration file:
 ###############################
 require "${root}pm.cfg";

 ###############################
 # some definations:
 ###############################
 $info = "login=$input{'login'}";
 if($input{'ID'} ne "")
 { $info .= "&ID=$input{'ID'}"; $gotid=1;}
 elsif((&pm_check) eq "yes")
 { $info .= "&ID=$values{'ID'}";}
 &init_errors;


 ###############################
 # create the links
 ###############################
 &link_em;

 ########
 # MENU #
 ########
  if ($input{'action'} eq "display")
  { &display_cgi;}
  elsif ($input{'action'} eq "delete")
  { if(!(&pm_check =~ /^n/)){&pm_delete_form;} }
  elsif ($input{'action'} eq "deleted")
  { &pm_delete; }
  elsif ($input{'action'} eq "register")
  {&pm_register; }
  elsif ($input{'action'} eq "search")
  {&search_cgi; }
  elsif ($input{'action'} eq "error")
  { &err($error_message{$input{'why'}}); }
  elsif ($input{'action'} eq "modify")
  { if(!(&pm_check =~ /^n/)){&pm_modify_form;} }
  elsif ($input{'action'} eq "show")
  { $input{'action'}=$input{'temp'}; &tempwiz; }
  elsif ($input{'action'} eq "modified")
  { &pm_modify; }
  elsif ($input{'action'} eq "login")
  {  if($save_stats eq "yes") {&log_event;} &panel_check; }
  elsif ($input{'action'} eq "send_password")
  { &pm_send_password; }

  else
  {  &panel_check; }

 exit;
}
#######
# END #
#######

