Archive for the ‘Tips’ Category

How to set site Cookies!

Sunday, April 13th, 2008

Below is a short tutorial on how to set your site cookies especially when using a forum integration. Over the years working in support this has to be the most comment mistake when people set things up and can lead to alot of headaches.

You should always set your cookies as follows below,

Cookie Path: This setting should always be set in both your forum and photopost products to / nothing else. Basically this will make a cookie work on any directory on the site provided the domain name is the same in the cookie so this is a must.

Cookie Prefix: Some important things to consider when settings cookies is which forum you are integrating with and what prefix the cookie uses as without setting this correct you will not be able to login correctly. Examples would be that if you are integrating with phpbb2 this is normally phpbb2mysql or with vbulletin the cookie prefix is bb. Now to be sure you can check in phpbb2 in your global admin configuration or in vbulletin all pertinent info is found in the config.php file in your forum includes directory.

Cookie Domain: Okay the following I can not stress enough. You must always unless you run your forum under your forum directory which most people do not do set the cookie domain on your site to something like this.

This does not include www or photos etc as those are subdomains. Setting it to a period then your base domain name will make the cookie read over all domains on your site and prevent all cookie issues.

Cookie Name: The following is only set when running install but is a necessary when running SMF, WOWBB or PHPBB3 integrations. You must set the forum cookie name or you will never be allowed to login to your Photopost Products. This is because none of these products use cookie prefix to make unique cookie names instead they use an absolute cookie name you make up either defined in the config file or admin area. Your cookie names must match between the forum and photopost product so this must be entered correctly on install.

I hope the following assists you when setting up your photopost product and saves you some time having to post for assistance.

Tip: Show Random Photos Anywhere

Friday, October 12th, 2007
  • It’s easy to show random photo uploads from your PhotoPost gallery anywhere on your site. This thread has the details, skip to the end for the latest, and the PHP code snippet for random photos is:
$host   = 'localhost';
$dbUser = 'root';
$dbPass = 'database-password';
$db = 'database-name';
mysql_connect("$host", "$dbUser", "$dbPass") or die(mysql_error());
mysql_select_db("$db") or die(mysql_error());

$result = mysql_query("SELECT id,cat,bigimage FROM pp_photos order by rand() LIMIT 1" ) or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
print "<a href="/photos/showphoto.php/photo/" . $row['id'] . ""><img src="/photos/data/" . $row['cat'] . "/thumbs/" .  $row['bigimage'] . ""></a>";