<?php
/*
Libreria di query da utilizzare
Guerrieri Luca lucaguerrieri@techrama.com
Le Query si dividono in:
Static : Tutte le query che sono definite a priori dal programmatore
Dynamic: Tutte le query che hanno bisogno dell'immissione (a run time) di valori come ad esempio uno username
Per distinguere questi due tipi di Query basta inserire i tag
Query statica : <!-- static -->
Query dinamic : <!-- dynamic -->
Per una guida sui Segnaposto (placeholders) e la sostituzione dinamica leggi la guida
***/
//query for session
$Q_set_session="<!-- dynamic -->INSERT INTO `session`( `user_id` , `session_id`, `login_time`) VALUES ('<!-- user_id -->','<!-- session_id -->','<!-- login_time -->')";
$Q_unset_session="<!-- dynamic -->DELETE FROM `session` WHERE username='<!-- username -->'";
//query for mail log
$Q_register_mail="<!-- dynamic -->INSERT INTO `mail`(`from`, `to`,`object`,`message`,`result`) VALUES ('<!-- from -->','<!-- to -->','<!-- object -->','<!-- message -->','<!-- result -->')";
$Q_add_utente="<!-- dynamic -->INSERT INTO `users` ( `username` , `password` ) VALUES ('<!-- username -->', '<!-- password -->')";
$Q_nomi="<!-- static -->SELECT username,password FROM `users`";
//query for manage users
$Q_username="<!-- dynamic -->SELECT * FROM `users` WHERE username='<!-- username -->'";
$Q_register_user="<!-- dynamic -->INSERT INTO `users`(`username`, `password`, `level` , `status`) VALUES ('<!-- username -->','<!-- password -->','<!-- level -->','<!-- status -->')";
$Q_register_user_profile="<!-- dynamic -->INSERT INTO `profile`(`name`, `address`, `cap`, `state` , `email`, `secret`, `sec_answer`, `username`) VALUES ('<!-- name -->', '<!-- address -->', '<!-- cap -->', '<!-- state -->', '<!-- email -->', '<!-- secret -->', '<!-- sec_answer -->', '<!-- username -->')";
$Q_activate_user="<!-- dynamic -->UPDATE `users` SET `status` = '1' WHERE `username` = '<!-- username -->'";
$Q_control_question="<!-- dynamic -->SELECT * FROM `profile` WHERE username='<!-- username -->'";
$Q_utenti="<!-- static -->SELECT * FROM `users`";
////
$Q_level="<!-- static -->SELECT * FROM `level`";
$Q_add_level="<!-- dynamic -->INSERT INTO `level` ( `level` , `name`, `description` ) VALUES ('<!-- level -->','<!-- name -->', '<!-- description -->')";
$Q_remember_password="<!-- dynamic -->SELECT profile.name, profile.secret, profile.username, users.username, users.password from profile, users where profile.username=users.username and users.username='lucanov'";
?>
|