session_save_path("/home/users/web/b506/nf.stilljewellery/cgi-bin/tmp"); session_start(); //if($_SESSION['vf_username'] && $_SESSION['vf_email'] && $_SESSION['vf_id']) // $loggedin = true; require_once("db.inc.php"); require_once("smartywrapper.inc.php"); //phpinfo(); //require_once("/home/.tamaki/tabbymarie/db.inc.php"); //require_once("/home/.tamaki/tabbymarie/vf.prestigeinteractivetools.com/smartywrapper.inc.php"); $siteName = "Renee Taylor Acupuncture"; to_template("siteName", $siteName); //standard functions here. //this is the first function I install now. some bloke found this fabulous //way to implement the coldfusion debugging tool function dump($x,$y=null,$z=null) { require_once("dbug.inc.php"); dbug($x); if ($y !== null) dbug($y); if ($z !== null) dbug($z); exit; } //this is a simple helper function that autoloads the classes //this keeps us from having to require_once each file function __autoload($class) { $file = strtolower("../models/{$class}.inc"); //$file = strtolower("/home/.tamaki/tabbymarie/vf.prestigeinteractivetools.com/classes/{$class}.inc"); if (!file_exists($file)) error("cant load class $class"); require_once($file); } if($loggedin) { $userid = $_SESSION['vf_id']; $loggedinuser = new User($userid); to_template("loggedinuser",$loggedinuser); } # call this function for an internal error, i.e. something went horribly wrong function error($public_msg, $internal_msg=null, $data=null) { global $no_session; static $num_errors = 0; if ( $num_errors > 1 ) die("Hard stop, recursive error detected"); // if we're already partway through the smarty template, don't show it (but // mention how much had been sent) $sent = strlen(ob_get_contents()); ob_clean(); if ($sent > 0) echo "
"; print_r($_POST); echo ""; } $out = ob_get_contents(); ob_end_clean(); return $out; } #useful for a sql_insert or sql_update function get_params_from_req($fields, $bool_fields=null, $all=false) { global $_REQUEST; $request = $_REQUEST; if (is_array($bool_fields)) $fields = array_merge($fields, $bool_fields); else $bool_fields = array(); $params = array(); foreach ($fields as $f) { $val = $request[$f]; # Bools are always set, since browsers don't pass any value when unchecked if ($bool_fields && in_array($f, $bool_fields)) $val = (($val == "on" || $val == "t") ? "t" : "f"); # Other types of values are left null when unset. if (!isset($val) and !$all) continue; $params[$f] = $val; } return $params; } ########### HTTP and HTML ########### function redirect($url, $cgi=null) { session_write_close(); # make sure session info written before redirecting global $__SQLtransactions; if ($__SQLtransactions > 0) error("there are still open sql transactions when trying to redirect"); if ($cgi) { $cgivars = http_build_query($cgi); if ($cgivars) $url .= "?$cgivars"; } header("Location: $url\n\n"); exit(); } ?>