This update features numerous new possibilities, that's why we bring it up as version 5. It's also our way to mark the change from AlexPHPTeam to AlexGuestbook.
The list of changes and corrections to the script is in the changelog_en.txt file.
All informations, updates and support for the script are available on www.alexguestbook.net
Before making any changes, make a backup of your database (and of your skins, if you modified them).
We strongly recommend to install the skins included in this new version and to modify these if necessary. Upgrading an old skin is possible (second part of this page) but it's absolutely not recommended ! The changes are numerous, there's an important risk of making mistakes.
Before starting, make sure you've downloaded the zip with the new version.
Using your FTP software, send all files to your server (replace all existing files), except the "setup.php" file, files in the "config/" and "templates/" folders. However, in this folder : copy and replace also the content of the "templates/admin/ folder.
The structure of the tables in the database has changed. Using your favorite database management software (i.e. phpmyadmin), execute the following requests.
Attention, the names of your tables might be different, names used here are the default ones. You might also need to change the options values, which here are the default choices.
RENAME TABLE `alex_livre_ip` TO `alex_livre_ban` ;
ALTER TABLE `alex_livre_ban` CHANGE `id_ip` `id_ban` MEDIUMINT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT ;
ALTER TABLE `alex_livre_ban` ADD `pseudo` VARCHAR( 40 ) NOT NULL , ADD `email` VARCHAR( 150 ) NOT NULL ;
ALTER TABLE `alex_livre_users` CHANGE `gestion_ip` `gestion_bannissement` TINYINT( 1 ) NOT NULL DEFAULT '0';
CREATE TABLE `alex_livre_config` (
`nom_config` varchar(255) NOT NULL,
`valeur_config` varchar(255),
KEY `nom_config` (`nom_config`)
) Type=MyISAM;
INSERT INTO `alex_livre_config` VALUES ('langue', 'francais');
INSERT INTO `alex_livre_config` VALUES ('skin_to_use', 'AguestNew');
INSERT INTO `alex_livre_config` VALUES ('temps_session', '1800');
INSERT INTO `alex_livre_config` VALUES ('send_mail', '1');
INSERT INTO `alex_livre_config` VALUES ('temps_ip_post', '60');
INSERT INTO `alex_livre_config` VALUES ('format_date', 'd/m/Y');
INSERT INTO `alex_livre_config` VALUES ('admin_valide_messages', '0');
INSERT INTO `alex_livre_config` VALUES ('admin_envoyer_remerciement', '0');
INSERT INTO `alex_livre_config` VALUES ('admin_add_code_securite', '0');
INSERT INTO `alex_livre_config` VALUES ('admin_bannir_mot', '0');
INSERT INTO `alex_livre_config` VALUES ('url_interdites', '1');
INSERT INTO `alex_livre_config` VALUES ('url_cliquables', '0');
INSERT INTO `alex_livre_config` VALUES ('color_txt_code', '#000000');
INSERT INTO `alex_livre_config` VALUES ('color_background_code', '#FFFFFF');
INSERT INTO `alex_livre_config` VALUES ('champ_pseudo', '0');
INSERT INTO `alex_livre_config` VALUES ('champ_email', '0');
INSERT INTO `alex_livre_config` VALUES ('champ_site', '0');
INSERT INTO `alex_livre_config` VALUES ('champ_pays', '0');
INSERT INTO `alex_livre_config` VALUES ('champ_note', '0');
INSERT INTO `alex_livre_config` VALUES ('champ_ville', '0');
INSERT INTO `alex_livre_config` VALUES ('ok_aff_moteur', '1');
INSERT INTO `alex_livre_config` VALUES ('nb_pages', '10');
INSERT INTO `alex_livre_config` VALUES ('cut_mots', '75');
INSERT INTO `alex_livre_config` VALUES ('maxi_car', '1500');
INSERT INTO `alex_livre_config` VALUES ('nb_max_smileys', '20');
INSERT INTO `alex_livre_config` VALUES ('url_recharger', 'index.php');
INSERT INTO `alex_livre_config` VALUES ('extension_url', '');
INSERT INTO `alex_livre_config` VALUES ('decalage_horaire', '0');
INSERT INTO `alex_livre_config` VALUES ('autoriser_smileys', '1');
INSERT INTO `alex_livre_config` VALUES ('inclure_livre', '0');
INSERT INTO `alex_livre_config` VALUES ('fichier_inclusion', '');
INSERT INTO `alex_livre_config` VALUES ('donner_focus', '0');
INSERT INTO `alex_livre_config` VALUES ('lien_admin', '1');
INSERT INTO `alex_livre_config` VALUES ('lien_accueil', '1');
INSERT INTO `alex_livre_config` VALUES ('chemin_lien_accueil', '/');
INSERT INTO `alex_livre_config` VALUES ('symbole_champ_obligatoire', '*');
INSERT INTO `alex_livre_config` VALUES ('symbole_champ_prive', '[P]');
From the guestbook folder on your host' server, download to your computer the "config/config_base.php" file with your FTP software.
Open this file with a text editor. Its content should look like this :
<?php
$database_type = "MySQL";
$f_mysql_host = "localhost";
$f_mysql_user = "root";
$f_mysql_pass = "****";
$f_mysql_base = "guestbook";
$name_table['alex_livre_sessions'] = "alex_livre_sessions";
$name_table['alex_livre_users'] = "alex_livre_users";
$name_table['alex_livre_messages'] = "alex_livre_messages";
$name_table['alex_livre_censure'] = "alex_livre_censure";
$name_table['alex_livre_ban'] = "alex_livre_ban";
$name_table['alex_livre_smileys'] = "alex_livre_smileys";
$name_table['alex_img_verif_add'] = "alex_livre_img_verif_add";
$name_table['alex_livre_txt_lang'] = "alex_livre_txt_lang";
$name_table['alex_livre_config'] = "alex_livre_config";
?>
Replace the crossed out line by the one below, in red.
Then add the second red line at the end of the file.
Save the file then re-upload it to the server. Check that the old file has been replaced (if necessary, first delete the file on the server before uploading the modified one).
Go to the admin part of your guestbook, look at the new available options, set these options to your taste, then click on the "save" button. This step is necessary to avoid further problems.
On the server, delete both the /config/config.php and /config/test files.
If you did not modify your skins, you can upload the entire "/templates/skins/" folder, replacing the old one. This method is strongly recommended (the code of the skins has changed a lot !) and furthermore, all skins are now xhtml valid.
If you wish to keep your old skins, you must upgrade them. If not, this update is now done for you.
Let's remind you that it's strongly recommended to adapt a new skin to your needs instead of trying to upgrade an already modified old skin.
Before upgrading your skin, be sure it's at the version 4.0.5 level. If it's not yet the case, see the instructions in the file Instructions to upgrade from version 4.0.4 to version 4.0.5.
Replace :
<div class="add_msg_left"><mx:text id="nom_pseudo_visiteur"/> *</div>
<div class="add_msg_right"><input class="i_text" type="text" tabindex="1" name="nom" size="34" maxlength="50" onfocus="this.className='i_focus'" onblur="this.className='i_text'"<mx:text id="value_nom"/> /></div>
By :
<mx:bloc id="bloc_pseudo">
<div class="add_msg_left"><mx:text id="nom_pseudo_visiteur"/> <mx:text id="symbole_champ_obligatoire"/><mx:text id="symbole_champ_prive"/></div>
<div class="add_msg_right"><input class="i_text" type="text" tabindex="1" name="nom" id="nom" size="34" maxlength="50" onfocus="this.className='i_focus'" onblur="this.className='i_text'"<mx:text id="value_nom"/> /></div>
</mx:bloc id="bloc_pseudo">
Replace :
<div class="add_msg_left"><mx:text id="email_visiteur"/></div>
<div class="add_msg_right"><input class="i_text" type="text" tabindex="2" name="email" size="34" maxlength="150" onfocus="this.className='i_focus'" onblur="this.className='i_text'"<mx:text id="value_email"/> /></div>
By :
<div class="add_msg_left"><mx:text id="email_visiteur"/> <mx:text id="symbole_champ_obligatoire"/><mx:text id="symbole_champ_prive"/></div>
<div class="add_msg_right"><input class="i_text" type="text" tabindex="2" name="email" id="email" size="34" maxlength="150" onfocus="this.className='i_focus'" onblur="this.className='i_text'"<mx:text id="value_email"/> /></div>
Replace :
<div class="add_msg_left"><mx:text id="site_web_visiteur"/></div>
<div class="add_msg_right"><input class="i_text" type="text" tabindex="3" name="site" size="34" maxlength="150" onfocus="this.className='i_focus'" onblur="this.className='i_text'"<mx:text id="value_site"/> /></div>
By :
<div class="add_msg_left"><mx:text id="site_web_visiteur"/> <mx:text id="symbole_champ_obligatoire"/><mx:text id="symbole_champ_prive"/></div>
<div class="add_msg_right"><input class="i_text" type="text" tabindex="3" name="site" id="site" size="34" maxlength="150" onfocus="this.className='i_focus'" onblur="this.className='i_text'"<mx:text id="value_site"/> /></div>
Replace :
<!-- city & country -->
<mx:bloc id="bloc_pays">
<div class="add_msg_left"><mx:text id="ville_visiteur"/></div>
<div class="add_msg_right"><input class="i_text" type="text" tabindex="4" name="ville" size="34" maxlength="60" onfocus="this.className='i_focus'" onblur="this.className='i_text'"<mx:text id="value_ville"/> /></div>
<div class="add_msg_left"><mx:text id="pays_visiteur"/></div>
<div class="add_msg_right"><select tabindex="5" size="1" name="pays" onchange="update_flag(this)"><option value="">-</option><mx:text id="select_pays"/></select> <img id="img_flags" src="<mx:text id="chem_absolu"/>images/<mx:text id="img_flags"/>" width="18" height="12" alt="" title="<mx:text id="flag"/>" /></div>
</mx:bloc id="bloc_pays">
By :
<!-- city -->
<mx:bloc id="bloc_ville">
<div class="add_msg_left"><mx:text id="ville_visiteur"/> <mx:text id="symbole_champ_obligatoire"/><mx:text id="symbole_champ_prive"/></div>
<div class="add_msg_right"><input class="i_text" type="text" tabindex="4" name="ville" id="ville" size="34" maxlength="60" onfocus="this.className='i_focus'" onblur="this.className='i_text'"<mx:text id="value_ville"/> /></div>
</mx:bloc id="bloc_ville">
<!-- country -->
<mx:bloc id="bloc_pays">
<div class="add_msg_left"><mx:text id="pays_visiteur"/> <mx:text id="symbole_champ_obligatoire"/><mx:text id="symbole_champ_prive"/></div>
<div class="add_msg_right"><select tabindex="5" size="1" name="pays" id="pays" onchange="update_flag(this)"><option value="">-</option><mx:text id="select_pays"/></select> <img id="img_flags" src="<mx:text id="chem_absolu"/>images/<mx:text id="img_flags"/>" width="18" height="12" alt="" title="<mx:text id="flag"/>" /></div>
</mx:bloc id="bloc_pays">
Replace :
<div class="add_msg_left"><mx:text id="note_visiteur"/></div>
<div class="add_msg_right"><select tabindex="6" size="1" name="note_site">
By :
<div class="add_msg_left"><mx:text id="note_visiteur"/> <mx:text id="symbole_champ_obligatoire"/><mx:text id="symbole_champ_prive"/></div>
<div class="add_msg_right"><select tabindex="6" size="1" name="note_site" id="note_site">
Replace :
<div class="d_center" style="clear: both;"><mx:text id="message_visiteur"/> *</div>
By :
<div class="d_center" style="clear: both;"><mx:text id="message_visiteur"/> <mx:text id="symbole_champ_obligatoire"/></div>
Replace :
<mx:bloc id="bloc_code_securite">
<div class="d_center"><br /><mx:text id="veuillez_taper_code"/> : (<a href="javascript:script_popup('<mx:text id="chem_absolu"/>infos_code.php?lang=<mx:text id="lang"/>','down',350,280,'scrollbars=yes')" class="a_info_code"><mx:text id="a_quoi_ca_sert"/></a>)<br />
<div>
<div class="d_code1"><img width="82" height="20" src="<mx:text id="chem_absolu"/>genImg/index.php?id=<mx:text id="id_genImg"/>" alt="" title="Code" /></div>
<div class="d_code2"><input tabindex="8" class="code_sec" maxlength="4" type="text" name="code_securite" size="5" /></div>
<input type="hidden" name="num_id" value="<mx:text id="id_genImg"/>" />
</div></div>
</mx:bloc id="bloc_code_securite">
By :
<mx:bloc id="bloc_code_securite">
<div class="d_center"><br /><mx:text id="veuillez_taper_code"/> : (<a href="javascript:script_popup('<mx:text id="chem_absolu"/>infos_code.php?lang=<mx:text id="lang"/>','down',350,280,'scrollbars=yes')" class="a_info_code"><mx:text id="a_quoi_ca_sert"/></a>)<br />
<div>
<div class="d_code1"><img width="82" height="20" src="<mx:text id="chem_absolu"/>genImg/index.php?id=<mx:text id="id_genImg"/>" alt="" title="Code" /></div>
<div class="d_code2"><input tabindex="8" class="code_sec" maxlength="4" type="text" name="code_securite" size="5" /></div>
</div></div>
</mx:bloc id="bloc_code_securite">
<input type="hidden" name="num_id" id="num_id" value="<mx:text id="id_genImg"/>" />
Replace :
<!-- submit -->
<div class="d_submit_msg"><br /><input type="submit" tabindex="9" value="<mx:text id="ajouter_message_visiteur"/>" name="ajouter" class="btn_add" /></div>
By :
<!-- submit -->
<div class="d_submit_msg"><br /><input type="submit" tabindex="9" value="<mx:text id="ajouter_message_visiteur"/>" name="ajouter" id="ajouter" class="btn_add" /></div>
Just before :
<?xml version="1.0" encoding="<mx:text id="SCRIPT_ENCODAGE"/>"?>
Add :
<!--=== BLOC HEADER_HTML ===-->
Just before the </head> tag, add :
<script language="javascript" type="text/javascript">
<!--
function donner_focus(champs){
document.getElementById(champs).focus();
}
//-->
</script>
Replace :
<body>
By :
<body <mx:text id="donner_focus"/>>
<!--=== /BLOC HEADER_HTML ===-->
Replace :
function verif_mail(adresse) {
var place = adresse.indexOf("@",1);
var point = adresse.indexOf(".",place+1);
if ((place > -1)&&(adresse.length >2)&&(point > 1))
return true;
else
return false;
}
By :
function verif_mail(adresse){
if (adresse.match(/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i))
return true;
else
return false;
}
function verif_url(adresse){
if (adresse.match(/^(?:(?:https?)\:\/\/)?\w+([\.\-]\w+)*\.\w{2,4}(\:\d+)*([\/\.\-\?\&\%\#]\w+)*\/?$/i))
return true;
else
return false;
}
Replace :
function verif_add(){
var F = document.getElementById("form_add_guest");
var nom = F.nom.value;
var message = F.message_textarea.value;
<mx:bloc id="bloc_verif_mail">
var mail= F.email.value;
</mx:bloc id="bloc_verif_mail">
if (!nom){
alert("<mx:text id="erreur_add_nom"/> ");
return false;
}
else if (!message){
alert("<mx:text id="erreur_add_message"/> ");
return false;
}
<mx:bloc id="bloc_verif_mail2">
else if (!verif_mail(mail) && mail){
alert("<mx:text id="erreur_mail"/> ");
return false;
}
</mx:bloc id="bloc_verif_mail2">
else if (F.code_securite && !F.code_securite.value){
alert("<mx:text id="erreur_code_securite"/>");
return false;
}
By :
function verif_add(){
var F = document.getElementById("form_add_guest");
var message = F.message_textarea.value;
<mx:bloc id="bloc_verif_nom">
var nom = F.nom.value;
if (!nom){
alert("<mx:text id="erreur_add_nom"/> ");
return false;
}
</mx:bloc id="bloc_verif_nom">
<mx:bloc id="bloc_verif_email">
var email = F.email.value;
if (!email){
alert("<mx:text id="erreur_add_email"/> ");
return false;
}
</mx:bloc id="bloc_verif_email">
<mx:bloc id="bloc_verif_site">
var site = F.site.value;
if (!site){
alert("<mx:text id="erreur_add_site"/> ");
return false;
}
</mx:bloc id="bloc_verif_site">
<mx:bloc id="bloc_verif_ville">
var ville = F.ville.value;
if (!ville){
alert("<mx:text id="erreur_add_ville"/> ");
return false;
}
</mx:bloc id="bloc_verif_ville">
<mx:bloc id="bloc_verif_pays">
var pays = F.pays.value;
if (!pays){
alert("<mx:text id="erreur_add_pays"/> ");
return false;
}
</mx:bloc id="bloc_verif_pays">
<mx:bloc id="bloc_verif_note">
var note = F.note_site.value;
if (!note){
alert("<mx:text id="erreur_add_note"/> ");
return false;
}
</mx:bloc id="bloc_verif_note">
if (!message){
alert("<mx:text id="erreur_add_message"/> ");
return false;
}
<mx:bloc id="bloc_verif_email2">
var email = F.email.value;
if (!verif_mail(email) && email){
alert("<mx:text id="erreur_mail"/> ");
return false;
}
</mx:bloc id="bloc_verif_email2">
<mx:bloc id="bloc_verif_site2">
var site = F.site.value;
if (!verif_url(site) && site){
alert("<mx:text id="erreur_url"/> ");
return false;
}
</mx:bloc id="bloc_verif_site2">
else if (F.code_securite && !F.code_securite.value){
alert("<mx:text id="erreur_code_securite"/>");
return false;
}
}
Just before :
<mx:text id="message_alert"/>
Add :
<div id="alexguestbook">
<mx:text id="lien_accueil"/>
Replace :
</body>
</html>
By :
<mx:text id="lien_admin"/>
</div>
<!--=== BLOC FOOTER_HTML ===-->
</body>
</html>
<!--=== /BLOC FOOTER_HTML ===-->
Replace :
<div class="d_pseudo"><a name="id<mx:text id="idMsg"/>"><mx:text id="flag"/> <mx:text id="pseudo"/> <mx:text id="pays_ville"/> <mx:text id="img_home"/> <mx:text id="img_mail"/></a></div>
By :
<div class="d_pseudo"><a name="id<mx:text id="idMsg"/>"><mx:text id="flag"/> <mx:text id="pseudo"/> <mx:text id="ville"/><mx:text id="pays"/> <mx:text id="img_home"/> <mx:text id="img_mail"/></a></div>
To avoid conflicts between the styles of the guestbook and of the rest of the site, the guestbook is now placed inside a container (DIV tags). You therefore have to add the #alexguestbook prefix (the ID of the container) before the name of each style.
Example :
input, textarea, select {
font-family: Verdana, Helvetica, sans-serif;
font-size: 1em;
border: 1px solid #757575;
}
Becomes :
#alexguestbook input, #alexguestbook textarea, #alexguestbook select {
font-family: Verdana, Helvetica, sans-serif;
font-size: 1em;
border: 1px solid #757575;
}
Or else :
input.btn_add {
font-size: 1em;
cursor: pointer;
font-weight: bold;
color: #373737;
}
Becomes :
#alexguestbook input.btn_add {
font-size: 1em;
cursor: pointer;
font-weight: bold;
color: #373737;
}
Replace :
body {
background-color: #FFFFFF;
font-family: Verdana, Helvetica, sans-serif;
color: #000000;
font-size: 0.7em;
}
By :
#alexguestbook {
background-color: #FFFFFF;
font-family: Verdana, Helvetica, sans-serif;
color: #000000;
font-size: 0.7em;
}
Almost done on this file : add (i.e. at the end of the file) :
#alexguestbook #lien_accueil a:link, #alexguestbook #lien_accueil a:hover, #alexguestbook #lien_accueil a:visited, #alexguestbook #lien_administration a:link, #alexguestbook #lien_administration a:hover, #alexguestbook #lien_administration a:visited {
text-decoration: underline;
color: #4A7DAC;
}
#alexguestbook #lien_accueil img, #alexguestbook #lien_administration img {
vertical-align: text-bottom;
width: 16px;
height: 16px;
border: 0;
margin: 0 2px 0 0;
}
#alexguestbook #lien_administration {
text-align: center;
margin-top: 10px;
}
#alexguestbook .symbole_champ_obligatoire {
color: #FF0000;
}
#alexguestbook .symbole_champ_prive {
color: #0000FF;
}
Open the ZIP file of the new version and copy the "templates/skins/AguestNew/img/administration.png" and "templates/skins/AguestNew/img/accueil.png" images. Create an "img" folder into the folder of your skin and paste these images.