  On a smooth bounded domain \Omega \subset R^N we consider the Schr\"odinger
operators -\Delta -V, with V being either the critical borderline potential
V(x)=(N-2)^2/4 |x|^{-2} or V(x)=(1/4) dist (x,\partial\Omega)^{-2}, under
Dirichlet boundary conditions. In this work we obtain sharp two-sided estimates
on the corresponding heat kernels. To this end we transform the Scr\"odinger
operators into suitable degenerate operators, for which we prove a new
parabolic Harnack inequality up to the boundary. To derive the Harnack
inequality we have established a serier of new inequalities such as improved
Hardy, logarithmic Hardy Sobolev, Hardy-Moser and weighted Poincar\'e. As a
byproduct of our technique we are able to answer positively to a conjecture of
E.B.Davies.
