Browse Source

Captcha and Activity updates

Nathaniel van Diepen 10 years ago
parent
commit
86f3d60e3c
4 changed files with 12 additions and 9 deletions
  1. 2 2
      data/pages/register.template
  2. 5 2
      php/activity.php
  3. 4 4
      php/captcha.php
  4. 1 1
      php/user.php

+ 2 - 2
data/pages/register.template

@@ -16,9 +16,9 @@
 	<div>
 		<input name="password1" class="fill-width"  placeholder="Verify Password" type="password"/>
 	</div>
-	<div class="fill-width" style="height:20px;background-repeat:no-repeat;background-position:center;background-size:165px 20px;" id="captcha"></div>
+	<div class="fill-width" style="height:50px;background-repeat:no-repeat;background-position:center;background-size:165px 50px;" id="captcha"></div>
 	<div>
-		<input name="captcha" class="fill-width" placeholder="Captcha" type="text"/>
+		<input name="captcha" autocomplete="off" class="fill-width" placeholder="Captcha" type="text"/>
 	</div>
 	<div>
 		<input type="button" value="cancel" class="cancel left"/>

+ 5 - 2
php/activity.php

@@ -54,8 +54,11 @@
 				);
 				switch($activity['type']){
 					case 'u':
-						$ret['rel'] = userObj($activity['u_id']);
-						$ret['url'] = '#~'.$ret['rel']['name'];
+						$ret['rel'] = userObj((int)$activity['u_id']);
+						if(isset($ret['rel']['name'])){
+							$ret['rel']['title'] = $ret['rel']['name'];
+							$ret['url'] = '#~'.$ret['rel']['name'];
+						}
 					break;
 					case 'p':
 						$ret['rel'] = projectObj($activity['p_id']);

+ 4 - 4
php/captcha.php

@@ -6,7 +6,7 @@
 		$_SESSION['captcha'] = $captcha;
 		//Set the image width and height
 		$width = 165;
-		$height = 20; 
+		$height = 50; 
 		//Create the image resource 
 		$image = ImageCreate($width, $height);  
 		//We are making three colors, white, black and gray
@@ -16,11 +16,11 @@
 		//Make the background black 
 		ImageFill($image, 0, 0, $black); 
 		//Add randomly generated string in white to the image
-		ImageString($image, 3, 30, 3, $captcha, $white); 
+		imagettftext($image,13,-7,5,20,$white,realpath(dirname(__FILE__)).'/../css/fonts/FiraMono/FiraMono-Bold.ttf',$captcha);
 		//Throw in some lines to make it a little bit harder for any bots to break 
 		ImageRectangle($image,0,0,$width-1,$height-1,$grey); 
-		imageline($image, 0, $height/2, $width, $height/2, $grey); 
-		imageline($image, $width/2, 0, $width/2, $height, $grey); 
+		imageline($image,0,0,$width,$height,$grey); 
+		imageline($image,$width,0,0,$height,$grey); 
 		//Tell the browser what kind of file is come in 
 		header("Content-Type: image/jpeg"); 
 		//Output the newly created image in jpeg format 

+ 1 - 1
php/user.php

@@ -32,7 +32,7 @@
 		if(is_string($id)){
 			$id = userId($id);
 		}
-		if($res = query("SELECT * FROM `users` WHERE id='%d'",Array($id))){
+		if($res = query("SELECT u.id,u.name,u.email,u.password,u.salt,u.key,u.last_pm_check FROM `users` AS u WHERE id=%d",Array($id))){
 			if($res->num_rows == 1){
 				if($user = $res->fetch_assoc()){
 					unset($user['password']);