Jump to content


Photo

Is it possible...


  • Please log in to reply
10 replies to this topic

#1 marcus

marcus
  • Members
  • PipPipPip
  • Advanced Member
  • 1,842 posts
  • LocationRochester, NY

Posted 05 October 2006 - 10:22 PM

...to echo the viewers Town/City and State on a page?

#2 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 05 October 2006 - 10:41 PM

Yes, if they've already provided you with the details.

You can ask the user for those details and let them submit them, you can then save them somewhere, like inside a database, then recall them when the user returns.

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#3 marcus

marcus
  • Members
  • PipPipPip
  • Advanced Member
  • 1,842 posts
  • LocationRochester, NY

Posted 05 October 2006 - 10:53 PM

but i've seen places that havent gathered information and have posted my town and state

#4 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 05 October 2006 - 10:59 PM

ok, in that case they're psychic websites... Can you provide an example site, I'll check it out.

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#5 marcus

marcus
  • Members
  • PipPipPip
  • Advanced Member
  • 1,842 posts
  • LocationRochester, NY

Posted 05 October 2006 - 11:00 PM

hmm, i can't recall the site name

#6 printf

printf
  • Staff Alumni
  • Advanced Member
  • 889 posts

Posted 05 October 2006 - 11:03 PM

IP database (maxmind, ip2location) or other!

me!

#7 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 05 October 2006 - 11:03 PM

OK, pretty much the only information they can get from you is what your browser provides.  They maybe looking at your IP address and seeing where it's registered or something slightly more advanced, but it's unlikely.

Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#8 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 05 October 2006 - 11:06 PM

I do it with users ip's.

But i can not remember the site i got the database dump.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#9 printf

printf
  • Staff Alumni
  • Advanced Member
  • 889 posts

Posted 05 October 2006 - 11:12 PM

I have a old dump from last year that I bought, if you want it, tell me I'll post a link to it. It comes with a image script so you can write the city on to a image file!

me!

#10 marcus

marcus
  • Members
  • PipPipPip
  • Advanced Member
  • 1,842 posts
  • LocationRochester, NY

Posted 05 October 2006 - 11:13 PM

that would be great!

#11 printf

printf
  • Staff Alumni
  • Advanced Member
  • 889 posts

Posted 05 October 2006 - 11:38 PM

It will be another 20 minutes before I can get on my server that has the database, I'm doing a backup now so i don't want to login when it running. I will post the download after that...

Here is a simple example, you can use any image, the script uses an array() that sets the writing method (size, center, angles (hoz, vert)!

http://www.dinningou...wn.com/test.php

example of the script!

<?
	/* protect the include files */

	define ( 'SYSTEM_REQUESTED', 1 );

	/* the back end */

	include_once ( '/home/vhost_27/no_access/ip/geo.php' );

	/* begin the image display process */


	// the image we are going to write to (must be a PNG)

	$img = '/home/vhost_27/no_access/images/example.png';

	// the write text array

	/*
	* see the example image * /geo/example.png * to understand each array value
	top => 
		array ( 0 => font size, 
		1 => the text write angle, 
		2 => text start vertical position
		3 => text start writing position (from left edge of image)
		4 => the font path and name
		},
	bottom => 
		array ( 0 => font size, 
		1 => the text write angle, 
		2 => text start vertical position
		3 => text start writing position (from left edge of image)
		4 => the font path (full_path) and name
	);
	*
	*/

	$ta = array ( 
		'top' => array ( 10, -10, 250, 0, '/home/vhost_27/no_access/fonts/arabolic.ttf' ), 
		'bottom' => array ( 10, -10, 270, 0, '/home/vhost_27/no_access/fonts/arabolic.ttf' ) 
			); 

	// the top text

	$top = 'I love';

	// if a country name needs * the * before it we use this

	/* ~ explained! (only used if no city is found and a country is found)
	* countries that are a single word -> Canada, do not use $add
	* countries that contain more than one word with a space -> United States, use $add
	*/

	$add = ' the';

	// other result

	/*
	* when no city or country is found we use this
	*/

	$other = 'you';

	// ending for the (bottom) line of text

	$end = '!';


	/* check for city, if we don't have one, check for a country */

	if ( empty ( $data['city'] ) )
	{
		/* now check for a country, if no country we use $other */

		if ( empty ( $data['country'] ) )
		{
			$text = $other . $end;
		}
		else
		{
			/* check if we need to add ($add) or strip (-) */

			if ( str_word_count ( $data['country'] ) > 1 )
			{
				$top .= $add;
				$text = $data['country'] . $end;
			}
			if ( strpos ( $data['country'], '-' ) !== false )
			{
				$text = str_replace ( '-', ' ', $data['country'] ) . $end;
			}
			else
			{
				$text = $data['country'] . $end;
			}

		}
	}
	else
	{
		$text = $data['city'] . $end;
	}

	/* load the image and set the text colors for writing */

	$image = imagecreatefrompng ( $img );

	//$backg = imagecolorallocate ( $image, 255, 255, 255 );

	$color = imagecolorallocate ( $image, 131, 110, 92 );

	/* get the exact position to write our (top) text */

   	$center = imagettfbbox ( $ta['top'][0], $ta['top'][1], $ta['top'][4], $top );

	$horzp = ( ( imagesx ( $image ) - abs ( $center[4] ) ) / 2 ) - $ta['top'][3];

	/* write the (top) text */

	imagettftext ( $image, $ta['top'][0], $ta['top'][1], $horzp, $ta['top'][2], $color, $ta['top'][4], $top );


	/* get the exact position to write our (bottom) text */

   	$center = imagettfbbox ( $ta['bottom'][0], $ta['bottom'][1], $ta['bottom'][4], $text );

	$horzp = ( ( imagesx ( $image ) - abs ( $center[4] ) ) / 2 ) - $ta['bottom'][3];

	/* write the (bottom) text */

	imagettftext ( $image, $ta['bottom'][0], $ta['bottom'][1], $horzp, $ta['bottom'][2], $color, $ta['bottom'][4], $text );

	/* write it out to the browser */

	header ( 'Content-Type: image/jpeg;' );
	imagejpeg ( $image );
	imagedestroy ( $image );
?>



me!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users