--- wakaba.pl	2014-02-24 16:54:47.646866357 -0800
+++ wakaba_new.pl	2014-02-24 16:56:31.778867856 -0800
@@ -519,6 +519,14 @@
 		if($email=~/sage/i) { $email='sage'; }
 		else { $email=''; }
 	}
+	
+	# noko
+	my $noko=0;
+	if($c_email eq 'noko')
+	{
+		$email = '';
+		$noko = 1;
+	}
 
 	# clean up the inputs
 	$email=clean_string(decode_string($email,CHARSET));
@@ -574,33 +582,53 @@
 	build_cache();
 
 	# update the individual thread cache
+	my $num=0;
 	if($parent) { build_thread_cache($parent); }
 	else # must find out what our new thread number is
 	{
-		if($filename)
-		{
-			$sth=$dbh->prepare("SELECT num FROM ".SQL_TABLE." WHERE image=?;") or make_error(S_SQLFAIL);
-			$sth->execute($filename) or make_error(S_SQLFAIL);
-		}
-		else
-		{
-			$sth=$dbh->prepare("SELECT num FROM ".SQL_TABLE." WHERE timestamp=? AND comment=?;") or make_error(S_SQLFAIL);
-			$sth->execute($time,$comment) or make_error(S_SQLFAIL);
-		}
-		my $num=($sth->fetchrow_array())[0];
+		$num = get_post_num($time,$comment,$filename);
 
 		if($num)
 		{
 			build_thread_cache($num);
 		}
 	}
+	
+	if($noko and !$num)
+	{
+		$num = get_post_num($time,$comment,$filename);
+	}
 
 	# set the name, email and password cookies
 	make_cookies(name=>$c_name,email=>$c_email,password=>$c_password,
 	-charset=>CHARSET,-autopath=>COOKIE_PATH); # yum!
 
 	# forward back to the main page
-	make_http_forward(HTML_SELF,ALTERNATE_REDIRECT);
+	if(!$noko)
+	{
+		make_http_forward(HTML_SELF,ALTERNATE_REDIRECT);
+	}
+	else
+	{
+		make_http_forward(get_reply_link($num,$parent),ALTERNATE_REDIRECT);
+	}
+}
+
+sub get_post_num($$;$) {
+	my ($time,$comment,$filename)=@_;
+	my $sth;
+	
+	if($filename)
+	{
+		$sth=$dbh->prepare("SELECT num FROM ".SQL_TABLE." WHERE image=?;") or make_error(S_SQLFAIL);
+		$sth->execute($filename) or make_error(S_SQLFAIL);
+	}
+	else
+	{
+		$sth=$dbh->prepare("SELECT num FROM ".SQL_TABLE." WHERE timestamp=? AND comment=?;") or make_error(S_SQLFAIL);
+		$sth->execute($time,$comment) or make_error(S_SQLFAIL);
+	}
+	return ($sth->fetchrow_array())[0];
 }
 
 sub is_whitelisted($)
