<commit_before><?php

session_start();
if($_SESSION['authuser']!=1)
{
	header("Location:index.php");
	exit;
}
        
include('lib/connectionfile.php');
        
$username1=$_POST['username1'];
$username2=$_POST['username2'];
$status=$_POST['status'];

switch ($status)
{
	case "A":
		$count1=dbconfn()->prepare("DELETE FROM w_connections WHERE (username1='$username1' and username2='$username2') or (username1='$username2' and username2='$username1')");
		$count1->execute();
		header("Location:profile?id=$username1");
		exit;
	break;
	
	case "R":
	case "S":
		$count1=dbconfn()->prepare("DELETE FROM w_connections WHERE username1='$username1' and username2='$username2'");
		$count1->execute();
		if($status=='S')                                 //Status S: For Sent Invites from Homepage 
		{
			header("Location:home");
			exit;
		}
		else
		{
			header("Location:profile?id=$username2");
			exit;
		}
	break;
	
	case "I":
	case "J":
		$count1=dbconfn()->prepare("UPDATE w_connections SET status='A' WHERE username1='$username1' and username2='$username2'");
		$count1->execute();
		 
		if($status=='J')                                 //Status J: For Requests from Homepage 
		{
			header("Location:home");
			exit;
		}
			
		else
		{
			header("Location:profile?id=$username1");
			exit;
		}	
	break;
	
	case "O":
		$count1=dbconfn()->exec("INSERT INTO w_connections VALUES('$username1','$username2','R')");
		header("Location:profile?id=$username2");
		exit;
	break;
	
	default:
		//This error should be handled better in the future -WILLIAMKNAUSS
		die("Unknown status: ".$status);
	break;
}

?><commit_msg>Revert "Cleaned up index.php"<commit_after><?php
        session_start();
        if($_SESSION['authuser']!=1)
                header("Location:index.php");
        
        include('lib/connectionfile.php');
        
        $username1=$_POST['username1'];
        $username2=$_POST['username2'];
        $status=$_POST['status'];
        
        if($status=='A')
        {
                $count1=dbconfn()->prepare("DELETE FROM w_connections WHERE (username1='$username1' and username2='$username2') or (username1='$username2' and username2='$username1')");
                $count1->execute();
                header("Location:profile?id=$username1");
               
           }
        
       if($status=='R' || $status=='S' )
        {
                $count1=dbconfn()->prepare("DELETE FROM w_connections WHERE username1='$username1' and username2='$username2'");
                $count1->execute();
               if($status=='S')                                 //Status S: For Sent Invites from Homepage 
                        header("Location:home");
                
               else
                header("Location:profile?id=$username2");
               
           }
        
        if($status=='I' || $status=='J')
        {
                $count1=dbconfn()->prepare("UPDATE w_connections SET status='A' WHERE username1='$username1' and username2='$username2'");
                $count1->execute();
             
               if($status=='J')                                 //Status J: For Requests from Homepage 
                        header("Location:home");
                
               else
                        header("Location:profile?id=$username1");
                
           }
           
                   
        if($status=='O')
        {
                $count1=dbconfn()->exec("INSERT INTO w_connections VALUES('$username1','$username2','R')");
                header("Location:profile?id=$username2");
              
           }

?>
{'fraction_non_alphanumeric': 0.16246187967840311, 'fraction_numerical': 0.01885223177155531, 'mean_word_length': 2.1510917030567684, 'pattern_counts': {'":': 6, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3904537', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1023, 'n_words': 177}