Share Code Quickly

What is Harigami?

Harigami is a simple source code sharing service. You can share source code by an URL which is issued after submission.
You can also run your source code online such as Python, Ruby, JavaScript and so on.
For free.Use for code review.
Preferences
anonymous No title
Python
def exception9(a):
    a.sort()
    return a[-1] if a.count(a[0]) > a.count(a[-1]) else a[0]
anonymous No title
PHP
<!DOCTYPE html>
<html lang="ja" >
  <head>
    <meta charset="utf-8">
    <title>簡易掲示板</title>
  </head>

  <body>
    <h1>簡易掲示板</h1>
    <form action="" method="post">
      
      <p>名前</p>
      <input type="text" name="user_name"><br>
      
      <p>コメント</p>
      <textarea name="comment" rows="4" cols="40"></textarea><br>
     
      <input type="submit" value="送信">
    </form>
<?php

error_reporting(0);
  
    $name=$_POST["user_name"];
   
   $comment=$_POST["comment"];
   
   $date=date("Y-m-d H:i:s");
  
   $filename="kadai_2_3(3).txt";
   
   $num=count(file($filename))+1;
   
   $parts="$num<>$name<>$comment<>$date";
  
   $fp=fopen($filename,"a");

    if(empty($name) && empty($comment)){
       echo "未記入箇所があります。<br>";
   }
  
   elseif(empty($name) ){
       echo "名前を入力してください<br>";
   }
  
   elseif(empty($comment)){
       echo "コメントを入力してください<br>";
   }
   
   elseif(isset($name) && isset($comment)){
     fwrite($fp,"$parts".PHP_EOL);
     fclose($fp);
   }
  
   if(file_exists($filename)){
     
     $lines=file($filename,FILE_IGNORE_NEW_LINES);
     foreach($lines as $line){
      
       list($num,$name,$comment,$date)=explode("<>",$line);
      
       echo "$num<>$name<>$comment<>$date"."<br>";
     }
   }
?>
  </body>
</html>
anonymous No title
PHP
<?php

define( 'FILENAME', 'kadai_2_3(2).txt');

date_default_timezone_set('Asia/Tokyo');

$now_date = null;
$data = null;
$file_handle = null;
$split_data = null;
$message = array();
$message_array = array();


if( !empty($_POST['btn_submit']) ) {
	
	if( $file_handle = fopen( FILENAME, "a") ) {
		$now_date = date("Y-m-d H:i:s");
		if (file_exists($filename)) {
   		 $num = count(file($filename))+1;
		} else {
    			$num = 1;
		}
		$data = $num."<>".$_POST['view_name']."<>".$_POST['message']."<>".$now_date.;

	
		fwrite( $file_handle, $data);
	
		fclose( $file_handle);
	}		
}

if( $file_handle = fopen( FILENAME,'r') ) {
	while( $data = fgets($file_handle) ){
	
		$split_data = preg_split( '/\'/', $data);
		
		$message = array(
			'view_name' => $split_data[1],
			'message' => $split_data[3],
			'post_date' => $split_data[5]
		);
		array_unshift( $message_array, $message);
	}
	
	fclose( $file_handle);
}

?>
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>簡易掲示板</title>
</head>
<body>
<h1>簡易掲示板</h1>
<form method="post">
	<div>
		<label for="view_name">名前</label>
		<input id="view_name" type="text" name="view_name" value="">
	</div>
	<div>
		<label for="message">コメント</label>
		<textarea id="message" name="message"></textarea>
	</div>
	<input type="submit" name="btn_submit" value="送信">
</form>
<hr>
<section>
<?php if( !empty($message_array) ): ?>
<?php foreach( $message_array as $value ): ?>
<article>
    <div class="info">
        <h2><?php echo $value['view_name']; ?></h2>
        <time><?php echo date('Y年m月d日 H:i', strtotime($value['post_date'])); ?></time>
    </div>
    <p><?php echo $value['message']; ?></p>
</article>
<?php endforeach; ?>
<?php endif; ?>
</section>
</body>
</html>
anonymous No title
PHP
<?php
define( 'FILENAME', 'kadai_2_3(2).txt');
date_default_timezone_set('Asia/Tokyo');
$now_date = null;
$data = null;
$file_handle = null;
$split_data = null;
$message = array();
$message_array = array();

if( !empty($_POST['btn_submit']) ) {
	if( $file_handle = fopen( FILENAME, "a") ) {
		$now_date = date("Y-m-d H:i:s");
  		$num=count(file($filename));
		$num++;
		$data = $num."<>".$_POST['view_name']."<>".$_POST['message']."<>".$now_date."'\n";
		fwrite( $file_handle, $data);
		fclose( $file_handle);	
	}	
}

if( $file_handle = fopen( FILENAME,'r') ) {
	while( $data = fgets($file_handle) ){
		$split_data = preg_split( '/\'/', $data);
        	$message = array(
            	'view_name' => $split_data[1],
            	'message' => $split_data[3],
            	'post_date' => $split_data[5]
        	);
        	array_unshift( $message_array, $message);
    }
	fclose( $file_handle);

?>


<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>簡易掲示板</title>
</head>
<body>
<h1>簡易掲示板</h1>
<form method="post">
	<div>
		<label for="view_name">名前</label>
		<input id="view_name" type="text" name="view_name" value="">
	</div>
	<div>
		<label for="message">コメント</label>
		<textarea id="message" name="message"></textarea>
	</div>
	<input type="submit" name="btn_submit" value="送信">
</form>
<hr>
<section>
<?php if( !empty($message_array) ): ?>
<?php foreach( $message_array as $value ): ?>
<article>
    <div class="info">
        <h2><?php echo $value['view_name']; ?></h2>
        <time><?php echo date('Y年m月d日 H:i', strtotime($value['post_date'])); ?></time>
    </div>
    <p><?php echo $value['message']; ?></p>
</article>
<?php endforeach; ?>
<?php endif; ?>
</section>
</body>
</html>
anonymous No title
PHP
<?php
define( 'FILENAME', 'kadai_2_3(2).txt');
date_default_timezone_set('Asia/Tokyo');
$now_date = null;
$data = null;
$file_handle = null;
$split_data = null;
$message = array();
$message_array = array();

if( !empty($_POST['btn_submit']) ) {
	if( $file_handle = fopen( FILENAME, "a") ) {
		$now_date = date("Y-m-d H:i:s");
  		$num=count(file($filename));
		$num++;
		$data = $num."<>".$_POST['view_name']."<>".$_POST['message']."<>".$now_date."'\n";
		fwrite( $file_handle, $data);
		fclose( $file_handle);	
	}	
}

if( $file_handle = fopen( FILENAME,'r') ) {
	while( $data = fgets($file_handle) ){
		$split_data = preg_split( '/\'/', $data);
        	$message = array(
            	'view_name' => $split_data[1],
            	'message' => $split_data[3],
            	'post_date' => $split_data[5]
        	);
        	array_unshift( $message_array, $message);
    }
	fclose( $file_handle);
}
?>


<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>簡易掲示板</title>
</head>
<body>
<h1>簡易掲示板</h1>
<form method="post">
	<div>
		<label for="view_name">名前</label>
		<input id="view_name" type="text" name="view_name" value="">
	</div>
	<div>
		<label for="message">コメント</label>
		<textarea id="message" name="message"></textarea>
	</div>
	<input type="submit" name="btn_submit" value="送信">
</form>
<hr>
<section>
<?php if( !empty($message_array) ): ?>
<?php foreach( $message_array as $value ): ?>
<article>
    <div class="info">
        <h2><?php echo $value['view_name']; ?></h2>
        <time><?php echo date('Y年m月d日 H:i', strtotime($value['post_date'])); ?></time>
    </div>
    <p><?php echo $value['message']; ?></p>
</article>
<?php endforeach; ?>
<?php endif; ?>
</section>
</body>
</html>
anonymous No title
PHP
<!DOCTYPE html>
<html>
<head>
<title>kadai_4 php</title>
</head>
<body>
<form action = "kadai_4.php" mothod = "get">
	<input type = "text" name ="sendtext"><br/>
	<input type ="submit" valude ="送信">
</form>
<?php
	echo "入力されたテキストが下に表示されます<br/>";
	if(isset($_GET["sendtext"])){
		echo $_GET["sendtext"];
	}
?>
</body>
</html>
anonymous No title
PHP
<!DOCTYPE html>
<html>
<head>
<title>kadai_3 php</title>
</head>
<body>
<?php
echo file_get_contents("saveDoc.txt");
?>
</body>
</html>
anonymous No title
PHP
<!DOCTYPE html>
<html>
<head>
<title>kadai_1_2 php</title>
</head>
<body>
<?php
$text = "Kadai_1_2 test OK!";
echo "<p>"."$text"."</p>";
echo '<p>Hello World!</p>';
$fp = fopen("saveDoc.txt","w");
fwrite($fp,"$text");
fclose($fp);
?>
</body>
</html>
anonymous No title
PHP
<!DOCTYPE html>
<html>
<head>
<title>kadai_1 php</title>
</head>
<body>
<?php
$text = "Kadai_1";
echo '<p>Hello World!</p>';
?>
</body>
</html>
anonymous No title
PHP
<!DOCTYPE html>
<html lang="ja" >
  <head>
    <meta charset="UTF-8">
    <title>簡易掲示板</title>
  </head>
  <body>
  <h1>簡易掲示板</h1>
    <form method="post" action="" >
      <p>名前</p>
      <input type="text" name="user_name" required>
      <p>コメント</p>
      <textarea name="comment" rows="4" cols="40"></textarea><br>
      <input type="submit" value="送信">
    </form>
    <?php
   	error_reporting(0);
    	$name=$_POST["user_name"];
   	$comment=$_POST["comment"];
   	$today = date("Y-m-d H:i:s");
   	$filename="kadai_2_2.txt";
   	$num=count(file($filename));
	$num++;
   	fwrite($fp, $num . '<>' . $name . '<>' . $comment . '<>' . $date . "\n");
     	fclose($fp);
    ?>
  </body>
</html>