store URL global before we redirect

How about adding parameters to the URL you redirect to:

wp_redirect ( add_query_arg("utm_source", $thispage, get_permalink ( $post->ID ) ));

and then checking the parameter on the target page?

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)