IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Web Perl Discussion :

Trouver le chemin du cgi-bin


Sujet :

Web Perl

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    152
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2006
    Messages : 152
    Points : 66
    Points
    66
    Par défaut Trouver le chemin du cgi-bin
    Bonjour, je suis vraiment désolé de poster ici mais je ne comprends vraiment pas où aller.

    Je suis en train d'essayer d'installer mon premier script perl dans le répertoire cgi-bin.
    La notice me dit d'indiquer le chemin du cgi. (N.B utiliser la syntaxe UNIX pour décrire le chemin).

    Pouvez-vous me dire ce que je dois faire exactement?

    Merci d'avance

  2. #2
    Responsable Perl et Outils

    Avatar de djibril
    Homme Profil pro
    Inscrit en
    Avril 2004
    Messages
    19 820
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 19 820
    Points : 499 184
    Points
    499 184
    Par défaut
    Sur ton serveur linux ou unix je suppose, tu y mets ton script perl dans le répertoire cgi-bin, c'est tout.
    Tu as surement dû configurer ton serveur apache pour faire du cgi non ?

  3. #3
    Membre du Club
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    152
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2006
    Messages : 152
    Points : 66
    Points
    66
    Par défaut
    Malheureusement, je fonctionne avec un serveur ovh pour débutant (tout déjà installé)

    En fait, c'est pour faire fonctionner un script perl.
    Merci d'avance

  4. #4
    Responsable Perl et Outils

    Avatar de djibril
    Homme Profil pro
    Inscrit en
    Avril 2004
    Messages
    19 820
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 19 820
    Points : 499 184
    Points
    499 184
    Par défaut
    bon je ne comprends pas ton souci. Met le script dans le répertoire cgi-bin, c'est tout. Quel est ton autre souci ?

  5. #5
    Membre du Club
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    152
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2006
    Messages : 152
    Points : 66
    Points
    66
    Par défaut
    Bonjour,

    en fait, j'ai l'impression que le script a un bug, il me marque internal server error.

    Pourriez-vous jeter un oeil aux deux pièces jointes?
    Je suis vraiment désolé de vous demander ça, mais je n'ai jamais fait de perl et là je me retrouve avec un script qui doit marcher d'ici demain, sinon je me fais fusiller par mon responsable.

    J'ai mis les deux fichiers en pièce jointe.

    Le fichier perl est le fichier modacgi.txt et monenquete.html est le questionnaire en ligne. En fait, le fichier perl traite les données du questionnaire et les stocke dans un fichier modarep.txt (qui est vierge donc je ne l'ai pas joint).

    Merci d'avance
    Fichiers attachés Fichiers attachés

  6. #6
    Expert éminent
    Avatar de Jedai
    Homme Profil pro
    Enseignant
    Inscrit en
    Avril 2003
    Messages
    6 245
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Avril 2003
    Messages : 6 245
    Points : 8 586
    Points
    8 586
    Par défaut
    Bon d'abord ton fichier ".txt" est en postscript... Nous sommes des programmeurs, inutile de nous envoyer une version colorée de ton code, du texte brut (avec l'extension classique .pl ou .cgi) serait nettement plus appréciable, ou même directement collée dans le forum (avec les balises codes).

    D'autre part ton script CGI est écrit dans un style à l'ancienne. Tu n'utilises pas le module CGI, tu utilises une forme de open() relativement fragile, tu n'utilises pas les pragma "strict" et "warnings"...

    Commence par nous donner une version propre de ton script et nous dire exactement quel type d'hébergement tu utilises.

    --
    Jedaï

  7. #7
    Membre du Club
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    152
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2006
    Messages : 152
    Points : 66
    Points
    66
    Par défaut
    J'ai un hébergement 90 Plan chez ovh, j'imagine que les scripts cgi sont supportés.
    Voici le code, par quoi puis-je remplacer les fonctions auxquelles tu fais référence (open par exemple) ?:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    #!/usr/bin/perl 
    if($ENV{'REQUEST_METHOD'} eq 'POST') 
    { 
      read(STDIN, $Data, $ENV{'CONTENT_LENGTH'}); 
    if (open (FICHIER, ">>../modalisa/modarep.txt") != false) 
    { 
    flock (FICHIER, 2);              # verouille en écriture 
    print FICHIER "REMOTE_ADDR:", $ENV{'REMOTE_ADDR'},";"; 
    print FICHIER "REMOTE_HOST:", $ENV{'REMOTE_HOST'},";"; 
    print FICHIER "\n"; 
    print FICHIER $Data; 
    print FICHIER "\n"; 
     flock (FICHIER, 8);              # déverrouille 
      close (FICHIER); 
    # ======Sortie vers le navigateur : 
    print "Content-type: text/html\n\n"; 
    print <<html_fin; 
    <HTML> 
    <HEAD> 
         <TITLE>Merci</TITLE> 
    </HEAD> 
    <BODY> 
    <B>Votre réponse est enregistrée.<P> Merci de votre participation !</B> <P> 
    </BODY> 
    </HTML> 
    html_fin 
    } 
    else      # ======erreur fichier 
    { 
    # Sortie vers le navigateur : 
    print "Content-type: text/html\n\n"; 
    print <<html_fin; 
    <HTML> 
    <HEAD> 
         <TITLE>Erreur</TITLE> 
    </HEAD> 
    <BODY> 
    <B>Impossible d'écrire les réponses sur le serveur</B> <P> 
    </BODY> 
    </HTML> 
    html_fin 
    } 
    } 
    exit;

  8. #8
    Membre éclairé
    Profil pro
    Inscrit en
    Août 2008
    Messages
    505
    Détails du profil
    Informations personnelles :
    Localisation : France, Puy de Dôme (Auvergne)

    Informations forums :
    Inscription : Août 2008
    Messages : 505
    Points : 712
    Points
    712
    Par défaut
    ben il dit que même pour faire un test, ton script est vraiment old-fashion, ce qui veut dire:
    - pas du tout simple
    - pas du tout efficace
    - pas du tout secure

    Regarde le module CGI de perl. Il y a de quoi faire de bien plus jolies choses et probablement plus compatible.

    Ceci dit, le script à l'air correct. Je ne sais pas quelle est la politique chez ton hébergeur. Il est possible qu'il n'aime pas que tu accède en écriture à un fichier de cette manière (peut-être un porblème de droit). Ou peut-être que ton fichier n'a pas les dorits d'éxécution ?
    Difficile d'avoir un avis précis sans regarder les logs du serveur apache. Souvent, les hébergeurs permettent d'avoir accès, est-ce ton cas ?

  9. #9
    Membre du Club
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    152
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2006
    Messages : 152
    Points : 66
    Points
    66
    Par défaut
    A priori j'ai le droit d'accéder aux logs chez ovh.
    Voici les 3 liens proposés:
    http://logs.ovh.net/monsite.fr/urchin/
    http://logs.ovh.net/monsite.fr/osl/
    http://logs.ovh.net/monsite.fr/awstats-osl/

    Lesquelles dois-je consulter?

  10. #10
    Membre éclairé
    Profil pro
    Inscrit en
    Août 2008
    Messages
    505
    Détails du profil
    Informations personnelles :
    Localisation : France, Puy de Dôme (Auvergne)

    Informations forums :
    Inscription : Août 2008
    Messages : 505
    Points : 712
    Points
    712
    Par défaut
    osl log dans google te confirme qu'il faut regarder dans osl.

  11. #11
    Membre du Club
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    152
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2006
    Messages : 152
    Points : 66
    Points
    66
    Par défaut
    J'ai changé d'idée, je vais enregistrer les données du formulaire dans une bdd au lieu d'un fichier texte et au lieu de faire appel à un script perl, je vais faire un script php.

    Sauriez-vous par hasard ce que donne ce script perl en php? (je connais un peu php mais pas du tout perl)
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    if($ENV{'REQUEST_METHOD'} eq 'POST') 
    { 
      read(STDIN, $Data, $ENV{'CONTENT_LENGTH'}); 
    if (open (FICHIER, ">>../modalisa/modarep.txt") != false) 
    { 
    flock (FICHIER, 2);              # verouille en écriture 
    print FICHIER "REMOTE_ADDR:", $ENV{'REMOTE_ADDR'},";"; 
    print FICHIER "REMOTE_HOST:", $ENV{'REMOTE_HOST'},";"; 
    print FICHIER "\n"; 
    print FICHIER $Data; 
    print FICHIER "\n"; 
     flock (FICHIER, 8);              # déverrouille 
      close (FICHIER); 
    }

  12. #12
    Débutant  
    Profil pro
    Inscrit en
    Mai 2005
    Messages
    3 096
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Mai 2005
    Messages : 3 096
    Points : 944
    Points
    944
    Par défaut
    Citation Envoyé par djibril Voir le message
    Sur ton serveur linux ou unix je suppose, tu y mets ton script perl dans le répertoire cgi-bin, c'est tout.
    Tu as surement dû configurer ton serveur apache pour faire du cgi non ?

    Salut je tomve sur ce poste qui resemble à mon problème.

    J'implémente un outil pour transferer des fichiers sur un server ftp
    lightloader
    http://www.seemysites.net/projFolder/uploader/

    Il est dit de placer le fichier upload.cgi dans le repertoire approprié.
    Donc je l'ai mis de le repetoire cgi-bin/.

    Ensuite il m'et demandé de modifié le champs action="" pour qu'il pointe sur le fichier cgi-bin/upload.cgi

    Je ne sais pas comment trouver ce chemin.

    Djibril, tu dit que de le metre dans cgi-bin et c'est tout. mais allors comment renseigner mon formulaire pour qu'il exécute mon fichier upload.cgi?

    Je suis un peu confu.

    Merci pour vos lumières
    Il ne suffit pas de tout savoir. Vouloir et persévérer, c'est déjà presque tout!

  13. #13
    Responsable Perl et Outils

    Avatar de djibril
    Homme Profil pro
    Inscrit en
    Avril 2004
    Messages
    19 820
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 19 820
    Points : 499 184
    Points
    499 184
    Par défaut
    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    action="/cgi-bin/upload.cgi"

  14. #14
    Futur Membre du Club
    Profil pro
    Inscrit en
    Février 2011
    Messages
    5
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Février 2011
    Messages : 5
    Points : 5
    Points
    5
    Par défaut accès refusé dossier cgi
    Bonjour à tous et aux pros de perl.
    avant toute chose, sachez que je ne maitrise pas du tout perl puisque qu'il y a qques jours je ne connaissais pas son existence. Et j'en suis désolé
    Je vous expose cependant mon problème:
    j'aide un ami qui a mis en ligne un site sur les chateaux et qui m' a demandé de transférer ce site vers un autre hébergeur moins cher.
    voici l'adresse web du site de départ ( encore actif) www.viedechateau.info qui comprend un dossier www avec un sous-dossier cgi-bin (A)( avec chateau.cgi et chateau.data) et l'autre viedechateau.info(B) comprenant les pages htm. L'accès à la BD ne pose aucun problème.
    Là où ça devient problématique c'est sur l'autre hébergeur.
    j'ai sorti les deux fichiers principaux A et B et les ai mis à la racine.
    Seulement, l'accès au fichier cgi-bin est impossible. J'ai soit une erreur 403 ou 404. L'hebergeur me dit ne savoir rien faire à part supprimer ce fichier!
    Etant donné que je ne connais pas perl, je ne sais quoi faire pour que les liens qui dirigent vers ce cgi-bin fonctionnent.
    Je vous mets donc le fichiers chateau.cgi du site de départ et l'adresse de l'autre site où il doit être hébergé.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752
    753
    754
    755
    756
    757
    758
    759
    760
    761
    762
    763
    764
    765
    766
    767
    768
    769
    770
    771
    772
    773
    774
    775
    776
    777
    778
    779
    780
    781
    782
    783
    784
    785
    786
    787
    788
    789
    790
    791
    792
    793
    794
    795
    796
    797
    798
    799
    800
    801
    802
    803
    804
    805
    806
    807
    808
    809
    810
    811
    812
    813
    814
    815
    816
    817
    818
    819
    820
    821
    822
    823
    824
    825
    826
    827
    828
    829
    830
    831
    832
    833
    834
    835
    836
    837
    838
    839
    840
    841
    842
    843
    844
    845
    846
    847
    848
    849
    850
    851
    852
    853
    854
    855
    856
    857
    858
    859
    860
    861
    862
    863
    864
    865
    866
    867
    868
    869
    870
    871
    872
    873
    874
    875
    876
    877
    878
    879
    880
    881
    882
    883
    884
    885
    886
    887
    888
    889
    890
    891
    892
    893
    894
    895
    896
    897
    898
    899
    900
    901
    902
    903
    904
    905
    906
    907
    908
    909
    910
    911
    912
    913
    914
    915
    916
    917
    918
    919
    920
    921
    922
    923
    924
    925
    926
    927
    928
    929
    930
    931
    932
    933
    934
    935
    936
    937
    938
    939
    940
    941
    942
    943
    944
    945
    946
    947
    948
    949
    950
    951
    952
    953
    954
    955
    956
    957
    958
    959
    960
    961
    962
    963
    964
    965
    966
    967
    968
    969
    970
    971
    972
    973
    974
    975
    976
    977
    978
    979
    980
    981
    982
    983
    984
    985
    986
    987
    988
    989
    990
    991
    992
    993
    994
    995
    996
    997
    998
    999
    1000
    1001
    1002
    1003
    1004
    1005
    1006
    1007
    1008
    1009
    1010
    1011
    1012
    1013
    1014
    1015
    1016
    1017
    1018
    1019
    1020
    1021
    1022
    1023
    1024
    1025
    1026
    1027
    1028
    1029
    1030
    1031
    1032
    1033
    1034
    1035
    1036
    1037
    1038
    1039
    1040
    1041
    1042
    1043
    1044
    1045
    1046
    1047
    1048
    1049
    1050
    1051
    1052
    1053
    1054
    1055
    1056
    1057
    1058
    1059
    1060
    1061
    1062
    1063
    1064
    1065
    1066
    1067
    1068
    1069
    1070
    1071
    1072
    1073
    1074
    1075
    1076
    1077
    1078
    1079
    1080
    1081
    1082
    1083
    1084
    1085
    1086
    1087
    1088
    1089
    1090
    1091
    1092
    1093
    1094
    1095
    1096
    1097
    1098
    1099
    1100
    1101
    1102
    1103
    1104
    1105
    1106
    1107
    1108
    1109
    1110
    1111
    1112
    1113
    1114
    1115
    1116
    1117
    1118
    1119
    1120
    1121
    1122
    1123
    1124
    1125
    1126
    1127
    1128
    1129
    1130
    1131
    1132
    1133
    1134
    1135
    1136
    1137
    1138
    1139
    1140
    1141
    1142
    1143
    1144
    1145
    1146
    1147
    1148
    1149
    1150
    1151
    1152
    1153
    1154
    1155
    1156
    1157
    1158
    1159
    1160
    1161
    1162
    1163
    1164
    1165
    1166
    1167
    1168
    1169
    1170
    1171
    1172
    1173
    1174
    1175
    1176
    1177
    1178
    1179
    1180
    1181
    1182
    1183
    1184
    1185
    1186
    1187
    1188
    1189
    1190
    1191
    1192
    1193
    1194
    1195
    1196
    1197
    1198
    1199
    1200
    1201
    1202
    1203
    1204
    1205
    1206
    1207
    1208
    1209
    1210
    1211
    1212
    1213
    1214
    1215
    1216
    1217
    1218
    1219
    1220
    1221
    1222
    1223
    1224
    1225
    1226
    1227
    1228
    1229
    1230
    1231
    1232
    1233
    1234
    1235
    1236
    1237
    1238
    1239
    1240
    1241
    1242
    1243
    1244
    1245
    1246
    1247
    1248
    1249
    1250
    1251
    1252
    1253
    1254
    1255
    1256
    1257
    1258
    1259
    #!/usr/bin/perl
    #
     
    #(c)
     
    use CGI;
    $query = new CGI;
     
    #You need to modify this script at all parts of Step B
     
    #Depending on where Perl is on your server, the above location
    #may not be correct.  To find where Perl is, telnet to your
    #server and at the prompt type: which perl  This will tell you
    #the correct path to Perl on your server.  Or, contact your
    #server administrator
    #Script Description
    #Created on:       2/6/2005
     
    #STEP A================================
     
    #A1. The following lines get and process data passed 
    #through the URL, do not modify
    $stringpassed=$ENV{'QUERY_STRING'};
     
    #A2. Replace all plusses with spaces for data passed via URL
    $stringpassed=~s/\+/ /g;
     
    #STEP B================================
    #B1. Data
      $data="/home/viedechateau/www/cgi-bin/chateau.data";
      $thisurl="http://viedechateau.info/cgi-bin/chateau.cgi";
      $openinghtml="/home/viedechateau/www/viedechateau.info/template.htm";
      $adminpassword="****";
      $forwardingURL="http://viedechateau.info/tableaudebord.htm";
     
    #STEP C================================
     
    #C1. NOMBRE MAXIMUM DE DONNEES PAR PAGE
      $maximumpage=250;
    #C2. NOMBRE MAXIMUM DE RESULTATS PAR RECHECHE,
      $maximum=250;	
     
    #ETAPE C================================
     
    #C1. Patch de date
    # Définit les jours de la semaine et les mois de l'année. 
    @days = ('Dimanche','Lundi','Mardi','Mercredi', 'Jeudi','Vendredi','Samedi');
    @months = ('Janvier','Fevrier','Mars','Avril','Mai','Juin','Juillet', 'Aout','Septembre','Octobre','Novembre','Decembre'); 
    # rajoute 1900 à la date pour obtenir les années après 2000. #
    ($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6]; 
    $time = sprintf("%02d:%02d:%02d",$hour,$min,$sec); 
    $year += 1900;
    $mon = ($mon + 1) ;
    # Affiche la date  
    #$Date = "$days[$wday],$mday $months[$mon] $year"; 
    $Date = "$mday/$mon/$year"; 
    $Datejour =$Date;
     
    #STEP D================================
    #NE PAS MODIFIER LE RESTE DU SCRIPT
     
    #D1. verification de la page de template sur le serveur
    if (-e "$openinghtml"){
     
    #D2. If so, open it and write opening and closing text to different strings
    #to be used throughout the script
    $problem="Impossible d'ouvrir le fichier.  Make sure you are referencing the file and not just a directory.";
    open(OPENING, "$openinghtml") || &security;
    @wholefile=<OPENING>;
    close(OPENING);
    $fulltemplate=join("\n",@wholefile);
    ($templatestart,$templateend)=split(/\+\+\+/,$fulltemplate);}
    else{
     
    #D3. If template file not found, use this for now
    $templatestart="<HTML><HEAD><TITLE>Vie de chateau: viedechateau.info</TITLE></HEAD><BODY>";
    $templateend="</BODY></HTML>";}
      $delimiter="\t";
     
    #D6. Get Password Entered by User
      $checkpassword=$query->param('checkpassword');
     
    #D7. Figure out what action user wants to take.
      $actiontotake=$query->param('actiontotake');
     
      $linenumberpass=$query->param('linenumberpass');
     
    #D8. If user wants to delete record, and has already
    #verified password, then go to the makechange subroutine
    if ($actiontotake eq "Delete Record"){
    $recordaction="Deleted";
    &makechange;
    exit;}
     
    #D9. If user wants to edit record, and has already
    #verified password, then go to the makechange subroutine
    if ($actiontotake eq "Edit Record"){
    $recordaction="Edited";
    &makechange;
    exit;}
     
    #D10. If user wants to edit record, to go subroutine to verify
    if ($actiontotake eq "Edit"){
    &edit;
    exit;}
     
    #D11. If user wants to delete record, to go subroutine to verify
    if ($actiontotake eq "Delete"){
    &delete;
    exit;}
     
    #D12. If user wants to add record, go to add subroutine
    if ($actiontotake eq "Add"){
    &addrecord;
    exit;}
     
    #STEP E================================
    #E1. Get the data passed from user
      $Ref=$query->param('Ref');
      $Refwork=lc($Ref);
    #E1b. The line below chops characters that cause problems in Perl word searches
      $Refwork=~tr/[a-zA-Z0-9 \.\,\?\@\-]/ /cd;
    if ($Refwork eq "select"){
    $Refwork="";
    $Ref="";}
      $Refpass="$Ref";
     
    #E1. Get the data passed from user
      $Pays=$query->param('Pays');
      $Payswork=lc($Pays);
    #E1b. The line below chops characters that cause problems in Perl word searches
      $Payswork=~tr/[a-zA-Z0-9 \.\,\?\@\-]/ /cd;
    if ($Payswork eq "select"){
    $Payswork="";
    $Pays="";}
      $Payspass="$Pays";
     
    #E1. Get the data passed from user
      $Code=$query->param('Code');
      $Codework=lc($Code);
    #E1b. The line below chops characters that cause problems in Perl word searches
      $Codework=~tr/[a-zA-Z0-9 \.\,\?\@\-]/ /cd;
    if ($Codework eq "select"){
    $Codework="";
    $Code="";}
      $Codepass="$Code";
     
    #E1. Get the data passed from user
      $Nom=$query->param('Nom');
      $Nomwork=lc($Nom);
    #E1b. The line below chops characters that cause problems in Perl word searches
      $Nomwork=~tr/[a-zA-Z0-9 \.\,\?\@\-]/ /cd;
    if ($Nomwork eq "select"){
    $Nomwork="";
    $Nom="";}
      $Nompass="$Nom";
     
    #E1. Get the data passed from user
      $Loca=$query->param('Loca');
      $Locawork=lc($Loca);
    #E1b. The line below chops characters that cause problems in Perl word searches
      $Locawork=~tr/[a-zA-Z0-9 \.\,\?\@\-]/ /cd;
    if ($Locawork eq "select"){
    $Locawork="";
    $Loca="";}
      $Locapass="$Loca";
     
    #E1. Get the data passed from user
      $Entite=$query->param('Entite');
      $Entitework=lc($Entite);
    #E1b. The line below chops characters that cause problems in Perl word searches
      $Entitework=~tr/[a-zA-Z0-9 \.\,\?\@\-]/ /cd;
    if ($Entitework eq "select"){
    $Entitework="";
    $Entite="";}
      $Entitepass="$Entite";
     
    #E1. Get the data passed from user
      $Prov=$query->param('Prov');
      $Provwork=lc($Prov);
    #E1b. The line below chops characters that cause problems in Perl word searches
      $Provwork=~tr/[a-zA-Z0-9 \.\,\?\@\-]/ /cd;
    if ($Provwork eq "select"){
    $Provwork="";
    $Prov="";}
      $Provpass="$Prov";
     
    #E1. Get the data passed from user
      @Categarray=$query->param('Categ');
      $searchelemcount=@Categarray;
    if ($searchelemcount==1){
      @Categarray=split(/; /,$Categarray[0]);}
      $Categ=join("\; ",@Categarray);
      $Categ=~s/Select; //g;
     
      $Categwork=lc($Categ);
    #E1b. The line below chops characters that cause problems in Perl word searches
      $Categwork=~tr/[a-zA-Z0-9 \.\,\?\@\-]/ /cd;
    if ($Categwork eq "select"){
    $Categwork="";
    $Categ="";}
      $Categpass="$Categ";
     
    #E1. Get the data passed from user
      @Stylearray=$query->param('Style');
      $searchelemcount=@Stylearray;
    if ($searchelemcount==1){
      @Stylearray=split(/; /,$Stylearray[0]);}
      $Style=join("\; ",@Stylearray);
      $Style=~s/Select; //g;
     
      $Stylework=lc($Style);
    #E1b. The line below chops characters that cause problems in Perl word searches
      $Stylework=~tr/[a-zA-Z0-9 \.\,\?\@\-]/ /cd;
    if ($Stylework eq "select"){
    $Stylework="";
    $Style="";}
      $Stylepass="$Style";
     
    #E1. Get the data passed from user
      @Utilarray=$query->param('Util');
      $searchelemcount=@Utilarray;
    if ($searchelemcount==1){
      @Utilarray=split(/; /,$Utilarray[0]);}
      $Util=join("\; ",@Utilarray);
      $Util=~s/Select; //g;
     
      $Utilwork=lc($Util);
    #E1b. The line below chops characters that cause problems in Perl word searches
      $Utilwork=~tr/[a-zA-Z0-9 \.\,\?\@\-]/ /cd;
    if ($Utilwork eq "select"){
    $Utilwork="";
    $Util="";}
      $Utilpass="$Util";
     
    #E1. Get the data passed from user
      $Res3=$query->param('Res3');
      $Res3work=lc($Res3);
    #E1b. The line below chops characters that cause problems in Perl word searches
      $Res3work=~tr/[a-zA-Z0-9 \.\,\?\@\-]/ /cd;
    if ($Res3work eq "select"){
    $Res3work="";
    $Res3="";}
      $Res3pass="$Res3";
     
    #E6. Get number of records already displayed
      $startitem=$query->param('startitem');
     
    #E7. Figure the last record to display on this page
      $enditem=$startitem+$maximumpage;
     
    #F4a.  Support for European characters.  Uncomment and replace with your
    #character set in brackets for all non-English Characters.  See help files.
    $Refwork=~tr/[ÈÉÊËéêëè]/e/;
    $Refwork=~tr/[ÀÁÂÃÄÅÆàáâãäåæ]/a/;
    $Refwork=~tr/[çÇ]/c/;
    $Refwork=~tr/[ìíîïÍÎÏÌ]/i/;
    $Refwork=~tr/[ÒÓÔÕÖòóôõöô]/o/;
    $Refwork=~tr/[ÙÚÛÜùúûü]/u/;
    ($Refone, $Reftwo, $Refthree, $Reffour, $Reffive, $Refsix, $Refseven)=split(/ /, $Refwork);
    #F4a.  Support for European characters.  Uncomment and replace with your
    #character set in brackets for all non-English Characters.  See help files.
    $Payswork=~tr/[ÈÉÊËéêëè]/e/;
    $Payswork=~tr/[ÀÁÂÃÄÅÆàáâãäåæ]/a/;
    $Payswork=~tr/[çÇ]/c/;
    $Payswork=~tr/[ìíîïÍÎÏÌ]/i/;
    $Payswork=~tr/[ÒÓÔÕÖòóôõöô]/o/;
    $Payswork=~tr/[ÙÚÛÜùúûü]/u/;
    ($Paysone, $Paystwo, $Paysthree, $Paysfour, $Paysfive, $Payssix, $Paysseven)=split(/ /, $Payswork);
    #F4a.  Support for European characters.  Uncomment and replace with your
    #character set in brackets for all non-English Characters.  See help files.
    $Codework=~tr/[ÈÉÊËéêëè]/e/;
    $Codework=~tr/[ÀÁÂÃÄÅÆàáâãäåæ]/a/;
    $Codework=~tr/[çÇ]/c/;
    $Codework=~tr/[ìíîïÍÎÏÌ]/i/;
    $Codework=~tr/[ÒÓÔÕÖòóôõöô]/o/;
    $Codework=~tr/[ÙÚÛÜùúûü]/u/;
    ($Codeone, $Codetwo, $Codethree, $Codefour, $Codefive, $Codesix, $Codeseven)=split(/ /, $Codework);
    #F4a.  Support for European characters.  Uncomment and replace with your
    #character set in brackets for all non-English Characters.  See help files.
    $Nomwork=~tr/[ÈÉÊËéêëè]/e/;
    $Nomwork=~tr/[ÀÁÂÃÄÅÆàáâãäåæ]/a/;
    $Nomwork=~tr/[çÇ]/c/;
    $Nomwork=~tr/[ìíîïÍÎÏÌ]/i/;
    $Nomwork=~tr/[ÒÓÔÕÖòóôõöô]/o/;
    $Nomwork=~tr/[ÙÚÛÜùúûü]/u/;
    ($Nomone, $Nomtwo, $Nomthree, $Nomfour, $Nomfive, $Nomsix, $Nomseven)=split(/ /, $Nomwork);
    #F4a.  Support for European characters.  Uncomment and replace with your
    #character set in brackets for all non-English Characters.  See help files.
    $Locawork=~tr/[ÈÉÊËéêëè]/e/;
    $Locawork=~tr/[ÀÁÂÃÄÅÆàáâãäåæ]/a/;
    $Locawork=~tr/[çÇ]/c/;
    $Locawork=~tr/[ìíîïÍÎÏÌ]/i/;
    $Locawork=~tr/[ÒÓÔÕÖòóôõöô]/o/;
    $Locawork=~tr/[ÙÚÛÜùúûü]/u/;
    ($Locaone, $Locatwo, $Locathree, $Locafour, $Locafive, $Locasix, $Locaseven)=split(/ /, $Locawork);
    #F4a.  Support for European characters.  Uncomment and replace with your
    #character set in brackets for all non-English Characters.  See help files.
    $Entitework=~tr/[ÈÉÊËéêëè]/e/;
    $Entitework=~tr/[ÀÁÂÃÄÅÆàáâãäåæ]/a/;
    $Entitework=~tr/[çÇ]/c/;
    $Entitework=~tr/[ìíîïÍÎÏÌ]/i/;
    $Entitework=~tr/[ÒÓÔÕÖòóôõöô]/o/;
    $Entitework=~tr/[ÙÚÛÜùúûü]/u/;
    ($Entiteone, $Entitetwo, $Entitethree, $Entitefour, $Entitefive, $Entitesix, $Entiteseven)=split(/ /, $Entitework);
    #F4a.  Support for European characters.  Uncomment and replace with your
    #character set in brackets for all non-English Characters.  See help files.
    $Provwork=~tr/[ÈÉÊËéêëè]/e/;
    $Provwork=~tr/[ÀÁÂÃÄÅÆàáâãäåæ]/a/;
    $Provwork=~tr/[çÇ]/c/;
    $Provwork=~tr/[ìíîïÍÎÏÌ]/i/;
    $Provwork=~tr/[ÒÓÔÕÖòóôõöô]/o/;
    $Provwork=~tr/[ÙÚÛÜùúûü]/u/;
    ($Provone, $Provtwo, $Provthree, $Provfour, $Provfive, $Provsix, $Provseven)=split(/ /, $Provwork);
    #F4a.  Support for European characters.  Uncomment and replace with your
    #character set in brackets for all non-English Characters.  See help files.
    $Categwork=~tr/[ÈÉÊËéêëè]/e/;
    $Categwork=~tr/[ÀÁÂÃÄÅÆàáâãäåæ]/a/;
    $Categwork=~tr/[çÇ]/c/;
    $Categwork=~tr/[ìíîïÍÎÏÌ]/i/;
    $Categwork=~tr/[ÒÓÔÕÖòóôõöô]/o/;
    $Categwork=~tr/[ÙÚÛÜùúûü]/u/;
    ($Categone, $Categtwo, $Categthree, $Categfour, $Categfive, $Categsix, $Categseven)=split(/ /, $Categwork);
    #F4a.  Support for European characters.  Uncomment and replace with your
    #character set in brackets for all non-English Characters.  See help files.
    $Stylework=~tr/[ÈÉÊËéêëè]/e/;
    $Stylework=~tr/[ÀÁÂÃÄÅÆàáâãäåæ]/a/;
    $Stylework=~tr/[çÇ]/c/;
    $Stylework=~tr/[ìíîïÍÎÏÌ]/i/;
    $Stylework=~tr/[ÒÓÔÕÖòóôõöô]/o/;
    $Stylework=~tr/[ÙÚÛÜùúûü]/u/;
    ($Styleone, $Styletwo, $Stylethree, $Stylefour, $Stylefive, $Stylesix, $Styleseven)=split(/ /, $Stylework);
    #F4a.  Support for European characters.  Uncomment and replace with your
    #character set in brackets for all non-English Characters.  See help files.
    $Utilwork=~tr/[ÈÉÊËéêëè]/e/;
    $Utilwork=~tr/[ÀÁÂÃÄÅÆàáâãäåæ]/a/;
    $Utilwork=~tr/[çÇ]/c/;
    $Utilwork=~tr/[ìíîïÍÎÏÌ]/i/;
    $Utilwork=~tr/[ÒÓÔÕÖòóôõöô]/o/;
    $Utilwork=~tr/[ÙÚÛÜùúûü]/u/;
    ($Utilone, $Utiltwo, $Utilthree, $Utilfour, $Utilfive, $Utilsix, $Utilseven)=split(/ /, $Utilwork);
    #F4a.  Support for European characters.  Uncomment and replace with your
    #character set in brackets for all non-English Characters.  See help files.
    $Res3work=~tr/[ÈÉÊËéêëè]/e/;
    $Res3work=~tr/[ÀÁÂÃÄÅÆàáâãäåæ]/a/;
    $Res3work=~tr/[çÇ]/c/;
    $Res3work=~tr/[ìíîïÍÎÏÌ]/i/;
    $Res3work=~tr/[ÒÓÔÕÖòóôõöô]/o/;
    $Res3work=~tr/[ÙÚÛÜùúûü]/u/;
    ($Res3one, $Res3two, $Res3three, $Res3four, $Res3five, $Res3six, $Res3seven)=split(/ /, $Res3work);
     
    #F6. You have configured the field named Code so that the searcher must enter
    #at least 2 nonblank characters.  To remove this restriction, put a # in front of
    #five lines below, or edit your script and make the change in the search preferences
    #$Codecheck=$Code;
    #$Codecheck=~s/ +//g;
    #if (length($Codecheck)<2  && !$actiontotake){
    ##$problem="Please press Back on your browser and provide more information for the field <B>Code</b>";
    #&security;}
     
    #F6. You have configured the field named Nom so that the searcher must enter
    #at least 2 nonblank characters.  To remove this restriction, put a # in front of
    #five lines below, or edit your script and make the change in the search preferences
    #$Nomcheck=$Nom;
    #$Nomcheck=~s/ +//g;
    #if (length($Nomcheck)<2  && !$actiontotake){
    #$problem="Please press Back on your browser and provide more information for the field <B>Nom</b>";
    #&security;}
     
    #STEP G================================
    #Do not modify this section
     
    #G1. Open datafile and write contents to an array, if can't open report the problem at the security subroutine
    $problem="You do not have a file to search on the server.  Please ADD test records before trying to search your test data file.";
    open (FILE, "$data") || &security;
    @all=<FILE>;
    close (FILE);
     
    #G2.  The line below is required, do not modify
    print "Content-type: text/html\n\n";
     
    #G3. Display HTML Header
    print "$templatestart\n";
     
    #G5. Show words user searched for
     
    #STEP H================================
    #H1. Read each line of the data file, compare with search words
     
    foreach $line (@all){
    $line=~s/\n//g;
    $loopsaround++;
     
    $checkleng=length($line);
    if ($checkleng<2){next};
     
    $linetemp1=lc($line);
     
    #H1a.  Support for European characters.  Uncomment and replace with your
    #character set in brackets for all non-English Characters.  See help files.
    $linetemp1=~tr/[ÈÉÊËéêëè]/e/;
    $linetemp1=~tr/[ÀÁÂÃÄÅÆàáâãäåæ]/a/;
    $linetemp1=~tr/[çÇ]/c/;
    $linetemp1=~tr/[ìíîïÍÎÏÌ]/i/;
    $linetemp1=~tr/[ÒÓÔÕÖòóôõöô]/o/;
    $linetemp1=~tr/[ÙÚÛÜùúûü]/u/;
     
    ($Ref,$Pays,$Code,$Nom,$Propri,$Rue,$Loca,$Entite,$Prov,$Tel,$Fax,$Mail,$Web,$Chapeau,$Descrip,$Nbmini,$Agmini,$Leggr,$Legm1,$Legm2,$Legm3,$Detail,$Video,$Categ,$Style,$Util,$Accestext,$Acceslien,$Tarifs,$Pub,$Res1,$Legm4,$Res3,$Date,$Password,$skipthisfield)=split (/$delimiter/,$linetemp1);
     
    #H9. This line specifies the fields to sort results by
    #See help databases for patches to allow various kinds of sorts
    $line="$Pays$Code$delimiter$loopsaround$delimiter$line";
     
    #H9.5 This line removes stray leading spaces before sorting your results
    $line=~s/^ +//;
     
    $increcount=0;
    #H12. Look for matches in field named Ref
    if (($Ref =~/\b$Refone/ && $Ref =~/\b$Reftwo/ && $Ref =~/\b$Refthree/ && $Ref =~/\b$Reffour/  && $Ref =~/\b$Reffive/ && $Ref=~/\b$Refsix/ && $Ref=~/\b$Refseven/) || !$Refwork) {
    $increcount++;
    $Metatitle= $Loca;
    $Metadescr= $Chapeau;
     
     
    }
     
    #H12. Look for matches in field named Pays
    if (($Pays =~/\b$Paysone/ && $Pays =~/\b$Paystwo/ && $Pays =~/\b$Paysthree/ && $Pays =~/\b$Paysfour/  && $Pays =~/\b$Paysfive/ && $Pays=~/\b$Payssix/ && $Pays=~/\b$Paysseven/) || !$Payswork) {
    $increcount++;}
     
    #H12. Look for matches in field named Code
    if (($Code =~/\b$Codeone/ && $Code =~/\b$Codetwo/ && $Code =~/\b$Codethree/ && $Code =~/\b$Codefour/  && $Code =~/\b$Codefive/ && $Code=~/\b$Codesix/ && $Code=~/\b$Codeseven/) || !$Codework) {
    $increcount++;}
     
    #H12. Look for matches in field named Nom
    if (($Nom =~/\b$Nomone/ && $Nom =~/\b$Nomtwo/ && $Nom =~/\b$Nomthree/ && $Nom =~/\b$Nomfour/  && $Nom =~/\b$Nomfive/ && $Nom=~/\b$Nomsix/ && $Nom=~/\b$Nomseven/) || !$Nomwork) {
    $increcount++;}
     
    #H12. Look for matches in field named Loca
    if (($Loca =~/\b$Locaone/ && $Loca =~/\b$Locatwo/ && $Loca =~/\b$Locathree/ && $Loca =~/\b$Locafour/  && $Loca =~/\b$Locafive/ && $Loca=~/\b$Locasix/ && $Loca=~/\b$Locaseven/) || !$Locawork) {
    $increcount++;}
     
    #H12. Look for matches in field named Entite
    if (($Entite =~/\b$Entiteone/ && $Entite =~/\b$Entitetwo/ && $Entite =~/\b$Entitethree/ && $Entite =~/\b$Entitefour/  && $Entite =~/\b$Entitefive/ && $Entite=~/\b$Entitesix/ && $Entite=~/\b$Entiteseven/) || !$Entitework) {
    $increcount++;}
     
    #H12. Look for matches in field named Prov
    if (($Prov =~/\b$Provone/ && $Prov =~/\b$Provtwo/ && $Prov =~/\b$Provthree/ && $Prov =~/\b$Provfour/  && $Prov =~/\b$Provfive/ && $Prov=~/\b$Provsix/ && $Prov=~/\b$Provseven/) || !$Provwork) {
    $increcount++;}
     
    #H11. Look for any word entered in this field
    if (!$Categwork){
    $increcount++;
    }else{
    $nomatch=0;
    foreach $chunk (@Categarray){
    if ($Categ!~/\b$chunk/i){
    $nomatch=1;;
    }}
    if (!$nomatch){
    $increcount++;}
    }
     
    #H11. Look for any word entered in this field
    if (!$Stylework){
    $increcount++;
    }else{
    $nomatch=0;
    foreach $chunk (@Stylearray){
    if ($Style!~/\b$chunk/i){
    $nomatch=1;;
    }}
    if (!$nomatch){
    $increcount++;}
    }
     
    #H11. Look for any word entered in this field
    if (!$Utilwork){
    $increcount++;
    }else{
    $nomatch=0;
    foreach $chunk (@Utilarray){
    if ($Util!~/\b$chunk/i){
    $nomatch=1;;
    }}
    if (!$nomatch){
    $increcount++;}
    }
     
    #H12. Look for matches in field named Res3
    if (($Res3 =~/\b$Res3one/ && $Res3 =~/\b$Res3two/ && $Res3 =~/\b$Res3three/ && $Res3 =~/\b$Res3four/  && $Res3 =~/\b$Res3five/ && $Res3=~/\b$Res3six/ && $Res3=~/\b$Res3seven/) || !$Res3work) {
    $increcount++;}
     
    if ($increcount==11){
    push (@keepers,$line);}}
     
    #STEP J================================
    #J1. Sort matches stored in array. 
    @keepers=sort(@keepers);
     
    #J2. Get and display number of matches found
    $length1=@keepers;
     
    #J3. If the number of matches is less than enditem, adjust
    if ($length1<$enditem){
    $enditem=$length1;
    $displaystat="Y";}
     
    #J4. The first field about to display
    $disstart=$startitem+1;
     
    #J5. Show user total number of matches found
    if ($length1){
    #K1. Do some HTML formatting before showing results
    print "<title>$Metatitle : $Metadescr</title>\n";
    print "<meta name=\"description\" content=\"Vie de chateau vous parle de..: $Metadescr\">\n";
    print "<meta name=\"keywords\" content=\"$Metatitle, chateau, vie de chateau,\">\n";
    print "<meta name=\"author\" content=\"Media-2001\">\n";
    print "<meta name=\"generator\" content=\"WebExpert 6\">\n";
    print "</head>\n";
    print "<body background=\"http://viedechateau.info/public/Background.jpg\" topmargin=0 leftmargin=0 rightmargin=0 bottommargin=0>\n";
    print "<table width=100% cellspacing=5 cellpadding=5>\n";
    print "<tr>\n";
    print "<td width=*>&nbsp;</td>\n";
    print "<td width=\"630\" align=\"center\" valign=\"top\" background=\"http://viedechateau.info/public/rosebg2.jpg\" style=\"border:1pt solid black;border-bottom-color: black; border-left-color: gray; border-right-color: silver; border-top-color: white;\">\n";
    print "<table border=0 width=100% height=100% cellspacing=2 cellpading=10>\n";
    } else {
    print "Désolé.<BR>Aucun résultat ! veuillez faire une autre recherche.<P>\n";}
     
    #STEP K================================	
    if ($length1>1){
    print "<tr><td colspan=4><Font face=Verdana color=#993333><H1>Liste des châteaux</H1></td></tr>\n";
    $liste = "OUI";}
     
    #K4. Keep track of results processed on this page
    foreach $line (@keepers){
     
    #K5. Delete stray hard returns
    $line=~s/\n//g;
     
    #K6. Keep track of records displayed
     
    $countline1++;
     
    #K7. Decide whether or not this record goes on this page
    if ($countline1>$startitem && $countline1<=$enditem){
     
    #K8. Open each line of sorted array for displaying
     
    ($sortfield,$loopsaround,$Ref,$Pays,$Code,$Nom,$Propri,$Rue,$Loca,$Entite,$Prov,$Tel,$Fax,$Mail,$Web,$Chapeau,$Descrip,$Nbmini,$Agmini,$Leggr,$Legm1,$Legm2,$Legm3,$Detail,$Video,$Categ,$Style,$Util,$Accestext,$Acceslien,$Tarifs,$Pub,$Res1,$Legm4,$Res3,$Date,$Password,$skipthisfield)=split (/$delimiter/,$line);
     
    if ($liste){
    print "<tr><td valign=top><a href=\"/cgi-bin/chateau.cgi?Ref=".$Ref."\"><Font size=1 face=Verdana color=#993333>$Code-$Loca</a></td><td valign=top><Font size=1 face=Verdana color=#993333>$Prov</td><td colspan=2><Font size=1  face=\"Verdana\" color=#993333>$Nom</td></tr>\n";
    }
    else{
     
    print "<tr valign=top><td width=25%></td><td width=25%></td><td width=25%></td><td width=25%></td></tr>\n";
    print "<tr valign=top><td colspan=4 align=center background=\"http://viedechateau.info/public/Background.jpg\" style=\"border:1pt solid black;border-bottom-color: white; border-left-color: silver; border-right-color: gray; border-top-color: black;\"><font face=tahoma color=white><H1>$Nom</td></tr>\n";
    print "<tr valign=top><td width=200>\n"; 
     
    if ($Nbmini){
    print "<table width=100% height=100%><tr><td align=center>\n";
    print "<SCRIPT LANGUAGE=\"JavaScript\">afficheVignette(\"http://viedechateau.info/public/$Ref-B.jpg\",\"http://viedechateau.info/public/$Ref-BHR.jpg\",\"Photo\");</SCRIPT>\n";
    print "<Font size=1 face=Verdana color=#993333>$Legm1</td></tr>\n";	
     
    if ($Nbmini>1){
    print "<tr><td align=center>\n";	
    print "<SCRIPT LANGUAGE=\"JavaScript\">afficheVignette(\"http://viedechateau.info/public/$Ref-C.jpg\",\"http://viedechateau.info/public/$Ref-CHR.jpg\",\"Photo\");</SCRIPT>\n";
    print "<Font size=1 face=Verdana color=#993333>$Legm2</td></tr>\n";}
     
    if ($Nbmini>2){
    print "<tr><td align=center>\n";	
    print "<SCRIPT LANGUAGE=\"JavaScript\">afficheVignette(\"http://viedechateau.info/public/$Ref-D.jpg\",\"http://viedechateau.info/public/$Ref-DHR.jpg\",\"Photo\");</SCRIPT>\n";
    print "<Font size=1 face=Verdana color=#993333>$Legm3</td></tr>\n";}
     
    if ($Nbmini==4){
    print "<tr><td align=center>\n";	
    print "<SCRIPT LANGUAGE=\"JavaScript\">afficheVignette(\"http://viedechateau.info/public/$Ref-E.jpg\",\"http://viedechateau.info/public/$Ref-EHR.jpg\",\"Photo\");</SCRIPT>\n";
    print "<Font size=1 face=Verdana color=#993333>$Legm4</td></tr>\n";}
    print "</table>\n";}  
     
    print "</td><td colspan=3 align=center>\n"; 
     
    print "<Font face=Verdana color=\"#993333\"><H3><B>$Chapeau</H3></b>\n";
     
    if ($Leggr) {
    print "<img src=\"http://viedechateau.info/public/$Ref-A.jpg\" width=450 style=\"border: 1pt solid black\"><BR><Font size=1>$Leggr</font>\n";}
     
    print "<BR><Font face=Verdana size=2 color=\"#993333\"><P align=justify>$Descrip</P><Center>\n";
    if (!$Detail eq "."){
    print "<a href=\"http://viedechateau.info/public/$Ref$Detail\">descriptif detaillé</A><BR>\n";}	
     
    if ($Res3){
    print "<tr valign=top><td colspan=4><Table width=100%><tr><td  background=\"http://viedechateau.info/public/Background.jpg\" style=\"border:1pt solid #993333\"><font size=2 face=Verdana color=black><B>Visites:</B><Font color=black size=2>\n"; 
    print "<B>$Res3</B><BR>\n";
    print "$Tarifs</td></tr></table>\n";}
     
    print "</td></tr>\n"; 	
    print "<tr valign=top><td colspan=4><table width=100%><tr><td valign=top width=33%><font size=2 face=Verdana color=black><B>Coordonnées:</B><br><Font color=#996600 size=1>\n"; 
    print "$Rue<BR>\n";
    print "$Code - $Loca<BR>\n"; 
    print "$Entite <a href=\"http://maps.fr.msn.be/home.aspx?strt1=$Rue&city1=$Entite&zipc1=$Code&cnty1=7\" target=\"_blank\">Plan de situation</A><BR>\n";
    print "$Prov - $Pays<BR>\n";
    print "Web:<a href=\"$Web\">$Web</a>\n";  
     
    #print "</td><td valign=top><font size=2 face=Verdana color=black><B>Itinéraire:</B><br><Font color=#996600 size=1>$Accestext<BR>\n"; 
     
    print "</td><td valign=top width=33%><font size=2 face=Verdana color=black><B>Propriétaire:</B><br><Font color=#996600 size=1>\n"; 
    print "$Propri<BR>\n";
    print "Tel: $Tel<BR>\n";
    print "Fax: $Fax<BR>\n";
    print "e-mail: <a href=\"mailto:$Mail\">$Mail</A></td>\n";	 
    print "<td valign=top width=33%><font size=2 face=Verdana color=black><B>Caractéristiques:</B><br><Font color=#996600 size=1>\n"; 
    print "Catégorie: $Categ<BR>\n";
    print "Style: $Style<BR>\n";
    print "Mise à jour: $Date<BR>\n";
    print "Usage: $Util</td></tr></table>\n";
     
    print "<form action=\"http://maps.fr.msn.be/directionsFind.aspx\" target=\"_blank\" method=\"get\">\n";
    print "<Font face=\"Verdana\" color=\"black\" style=\"font-size:9pt\"><center>\n";
    print "<B>Itinéraire</B>, départ de la rue:<input type=text name=\"strt1\" SIZE=\"20\" style=\"font-family:arial;font-size:10px;color:#996600;background-color:white;border: 1 solid #000000;font-weight:bold\">\n";
    print "C.P.:<input type=text name=\"zipc1\"  SIZE=\"3\" style=\"font-family:arial;font-size:10px;color:#996600;background-color:white;border: 1 solid #000000;font-weight:bold\"> \n";
    print "Ville:<input type=text name=\"city1\" SIZE=\"15\" style=\"font-family:arial;font-size:10px;color:#996600;background-color:white;border: 1 solid #000000;font-weight:bold\">	\n";
    print "Pays:<select name=\"cnty1\" style=\"font-family:arial;font-size:10px;color:#996600;background-color:white;border: 1 solid #000000;font-weight:bold\"><option value=7>Belgique<option value=3>France<option value=8>Luxembourg<option value=12>Pays-Bas<option value=4>Allemagne</select>\n";
    print "<input type=hidden  name=\"rtyp\" value=\"0\"> \n";
    print "<input type=hidden  name=\"strt2\" value=\"$Rue\">\n";
    print "<input type=hidden  name=\"city2\" value=\"$Entite\">\n";
    print "<input type=hidden  name=\"zipc2\" value=\"$Code\">\n";
    print "<input type=hidden  name=\"cnty2\" value=\"7\"> \n";
    print "<input type=hidden name=\"unit\" value=\"1\">\n";
    print "<input type=submit value=\"Afficher\">\n";
    print "</form>\n";
     
     
    if ($adminpassword eq $checkpassword || $actiontotake eq "Useredit"){
    print "<tr valign=top><td colspan=2><form method=POST action=\"$thisurl\"><input type=hidden name=\"linenumberpass\" value=\"$loopsaround\"><input type=hidden name=\"checkpassword\" value=\"$checkpassword\"><input type=submit name=\"actiontotake\" value=\"Edit\"> <input type=submit name=\"actiontotake\" value=\"Delete\"></td></tr></form>\n";}
     
     
    #STEP L================================
    #L1. If total displayed equals maximum you set, then exit
    if ($countline1 == $maximum && $maximum){
    $problem2="Your search was terminated at $maximum records, please be more specific in your search";
    last;}
     
    #L2. If script just got to last match then exit program
    if ($length1 == $countline1){
    last;}
     
    #L3. If script is at the end of a page then show NEXT button
    if ($countline1 == $enditem && $displaystat ne "Y"  && $maximum>$countline1){
    $stopit="Y";
    last;
    }
    }
    }
    if (!$liste){
    print "</table>\n";}
     
    }
    #L4. Display NEXT MATCHES button
    if ($stopit eq "Y"){
    print "<form method=POST action=\"$thisurl\">\n";
     
    #L5. Pass hidden variables so script will know how to display next page
    print "<input type=hidden name=\"Ref\" value=\"$Refpass\"> \n";
    print "<input type=hidden name=\"Pays\" value=\"$Payspass\"> \n";
    print "<input type=hidden name=\"Code\" value=\"$Codepass\"> \n";
    print "<input type=hidden name=\"Nom\" value=\"$Nompass\"> \n";
    print "<input type=hidden name=\"Loca\" value=\"$Locapass\"> \n";
    print "<input type=hidden name=\"Entite\" value=\"$Entitepass\"> \n";
    print "<input type=hidden name=\"Prov\" value=\"$Provpass\"> \n";
    print "<input type=hidden name=\"Categ\" value=\"$Categpass\"> \n";
    print "<input type=hidden name=\"Style\" value=\"$Stylepass\"> \n";
    print "<input type=hidden name=\"Util\" value=\"$Utilpass\"> \n";
    print "<input type=hidden name=\"Res3\" value=\"$Res3pass\"> \n";
    print "<input type=hidden name=\"checkpassword\" value=\"$checkpassword\"> \n";
    print "<input type=hidden name=\"startitem\" value=\"$enditem\"> \n";
    print "<input type=submit value=\"Get Next Matches\"></form>\n";
    }
     
    #L6. Show problems
    print "$problem2\n";
     
    print "</td></tr></table>\n";
    #L7. Show credits.  If registered, you can delete entire Step L7
    print "<CENTER><FONT size=\"1\" face=Verdana><i><b><A href=\"http://www.media-2001.net\">Media-2001.net</B> Hébergement de sites Internet</A></FONT></CENTER>\n";
     
    #L8. If opening.htm was found, show its closing html codes
    print "$templateend\n";
    exit;
     
    #STEP M================================
    sub security{
    #M1. This is the subroutine that reports all problems
    print "Content-type: text/html\n\n";
     
    print "$templatestart\n";
    print "<CENTER><FONT size=+2>Data Error</FONT></CENTER><P>\n";
    print "<FONT size=\"+1\">Please correct the following error:<blockquote>$problem</blockquote></FONT>\n";
    print "$templateend\n";
    exit;
    }
     
    #STEP N================================
    sub edit{
    #N1. Open data file and read it
    $problem="Can't open data file to read from it at edit subroutine";
    open (FILE,"$data") || &security;
    @all=<FILE>;
    close (FILE);
     
    #N2. Read each line of the data file
    foreach $line (@all){
    $line=~s/\n//g;
    ($copyRef,$copyPays,$copyCode,$copyNom,$copyPropri,$copyRue,$copyLoca,$copyEntite,$copyProv,$copyTel,$copyFax,$copyMail,$copyWeb,$copyChapeau,$copyDescrip,$copyNbmini,$copyAgmini,$copyLeggr,$copyLegm1,$copyLegm2,$copyLegm3,$copyDetail,$copyVideo,$copyCateg,$copyStyle,$copyUtil,$copyAccestext,$copyAcceslien,$copyTarifs,$copyPub,$copyRes1,$copyLegm4,$copyRes3,$copyDate,$copyPassword,$skipthisfield)=split (/$delimiter/,$line);
     
    $keepcount++;
     
    #N3. Find the line user wants to modify
    if ($keepcount==$linenumberpass){
    $linetokeep=$line;
    $linetokeep=~s/markedtoedit//g;
    last;
    }
    }
     
    #N6. Split matching line into its respective variables
    ($Ref,$Pays,$Code,$Nom,$Propri,$Rue,$Loca,$Entite,$Prov,$Tel,$Fax,$Mail,$Web,$Chapeau,$Descrip,$Nbmini,$Agmini,$Leggr,$Legm1,$Legm2,$Legm3,$Detail,$Video,$Categ,$Style,$Util,$Accestext,$Acceslien,$Tarifs,$Pub,$Res1,$Legm4,$Res3,$Date,$Password,$skipthisfield)=split (/$delimiter/,$linetokeep);
     
    #N7. Check password sent via hidden field
    $copyPassword=~s/\"//g;
    if ($copyPassword ne $checkpassword && $adminpassword ne $checkpassword){
    $problem="Your password matches neither the master password nor the user password for this record.";
    &security;}
     
    #Required Header, do not delete
    print "Content-type: text/html\n\n";
     
    #N8. If can't find opening html, display default header
    print "$templatestart\n";
     
    print "<P><CENTER><FONT size=\"+1\">Editer cet enregistrement</FONT></CENTER><P>\n";
     
    print "<BR><FORM ACTION=\"$thisurl\" METHOD=\"POST\" $allowupload><table>\n";
    print "<tr valign=top><td>Ref:</td><td><input type=text name=\"Ref\"  value=\"$Ref\" size=35></td>\n";
    print "<td>Pays:</td><td><select name=\"Pays\">\n";
    print "<option>$Pays\n";
    print "<option>Select\n";
    print "<option>BE-Belgique\n";
    print "<option>DE-Allemagne\n";
    print "<option>FR-France\n";
    print "<option>LU-Luxembourg\n";
    print "<option>NL-Hollande\n";
    print "</select></td></tr>\n";
    print "<tr valign=top><td>Nom du chateau:</td><td><input type=text name=\"Nom\"  value=\"$Nom\" size=35></td>\n";
    print "<td>Propriétaire:</td><td><input type=text name=\"Propri\"  value=\"$Propri\" size=35></td></tr>\n";
    print "<tr valign=top><td>Rue:</td><td><input type=text name=\"Rue\"  value=\"$Rue\" size=35></td>\n";
    print "<td>Code + localite</td><td><input type=text name=\"Code\"  value=\"$Code\" size=5>-<input type=text name=\"Loca\"  value=\"$Loca\" size=25></td></tr>\n";
    print "<tr valign=top><td>Entite:</td><td><input type=text name=\"Entite\"  value=\"$Entite\" size=35></td><td>Prov:</td><td><select name=\"Prov\">\n";
    print "<option>$Prov\n";
    print "<option>Select\n";
    print "<option>Bruxelles\n";
    print "<option>Brabant Wallon\n";
    print "<option>Brabant Flamand\n";
    print "<option>Flandre Occidentale\n";
    print "<option>Flandre Orientale\n";
    print "<option>Anvers\n";
    print "<option>Limbourg\n";
    print "<option>Liège\n";
    print "<option>Luxembourg\n";
    print "<option>Namur\n";
    print "<option>Hainaut\n";
    print "<option>Alsace\n";
    print "<option>Aquitaine\n";
    print "<option>Auvergne\n";
    print "<option>Bourgogne\n";
    print "<option>Bretagne\n";
    print "<option>Centre-val-de-Loire\n";
    print "<option>Champagne-ardennes\n";
    print "<option>Corse\n";
    print "<option>Franche-comte\n";
    print "<option>Ile-de-France\n";
    print "<option>Languedoc-Roussillon\n";
    print "<option>Limousin\n";
    print "<option>Lorraine\n";
    print "<option>Midi-Pyrenees\n";
    print "<option>Nord-Pas-de-calais\n";
    print "<option>Basse-normandie \n";
    print "<option>Haute-normandie\n";
    print "<option>Pays de loire\n";
    print "<option>Picardie\n";
    print "<option>Poitou-Charentes	\n";
    print "<option>P.A.C.A.\n";
    print "<option>Rhone-Alpes\n";
    print "</select></td></tr>\n";
    print "<tr valign=top><td>Tel:</td><td><input type=text name=\"Tel\"  value=\"$Tel\" size=35></td>\n";
    print "<td>Fax:</td><td><input type=text name=\"Fax\"  value=\"$Fax\" size=35></td></tr>\n";
    print "<tr valign=top><td>Mail:</td><td><input type=text name=\"Mail\"  value=\"$Mail\" size=35></td>\n";
    print "<td>Web:</td><td><input type=text name=\"Web\"  value=\"$Web\" size=35></td></tr>\n";
    $Chapeau=~s/<br>/\n/g;
    $Chapeau=~s/<BR>/\n/g;
    print "<tr valign=top><td colspan=2>Chapeau:<BR><textarea name=\"Chapeau\" cols=45 rows=4>$Chapeau</textarea></td>\n";
    $Descrip=~s/<br>/\n/g;
    $Descrip=~s/<BR>/\n/g;
    print "<td colspan=2 rowspan=3>Descrip:<BR><textarea name=\"Descrip\" cols=45 rows=10>$Descrip</textarea></td></tr>\n";
    print "<tr valign=top><td>Photos mini:</td><td><select name=\"Nbmini\">\n";
    print "<option>$Nbmini\n";
    print "<option>Select\n";
    print "<option>0\n";
    print "<option>1\n";
    print "<option>2\n";
    print "<option>3\n";
    print "<option>4\n";
    print "</select></td>\n";
    #$Agmini=~s/\"//g;
    #print "<td>Agrandissements:</td><td><input type=radio name=\"Agmini\" value=\"$Agmini\" checked>$Agmini<BR>\n";
    #print "<input type=radio name=\"Agmini\" value=\"OUI\">OUI<BR>\n";
    #print "<input type=radio name=\"Agmini\" value=\"NON\">NON<BR></select>\n";
    #print "</td></tr>\n";
    print "<tr valign=top><td>Légende Gd:</td><td><input type=text name=\"Leggr\"  value=\"$Leggr\" size=45></td></tr>\n";
    print "<tr valign=top><td>Légende 1:</td><td><input type=text name=\"Legm1\"  value=\"$Legm1\" size=45></td>\n";
    print "<td>Légende 2:</td><td><input type=text name=\"Legm2\"  value=\"$Legm2\" size=45></td></tr>\n";
    print "<tr valign=top><td>Légende 3:</td><td><input type=text name=\"Legm3\"  value=\"$Legm3\" size=45></td>\n";
    print "<td>Légende 4:</td><td><input type=text name=\"Legm4\"  value=\"$Legm4\" size=45></td></tr>\n";
    print "<tr valign=top><td>Page supplé.:</td><td><select name=\"Detail\">\n";
    print "<option>$Detail\n";
    print "<option>Select\n";
    print "<option>.htm\n";
    print "<option>.txt\n";
    print "<option>.doc\n";
    print "<option>.pdf\n";
    print "</select></td>\n";
    print "<td>Video:</td><td><select name=\"Video\">\n";
    print "<option>$Video\n";
    print "<option>Select\n";
    print "<option>.jpg\n";
    print "<option>.wmv\n";
    print "</select></td></tr>\n";
    print "<tr><td colspan=4><table width=100%><tr><td valign=top width=25%>\n";
    @Categ=split(/\; /,$Categ);
    foreach $content (@Categ){
    $content=~tr/[a-zA-Z0-9]//cd;
    $checkCateg{$content}="checked";}
    print "Categégorie:<BR>\n";
    print "<input type=checkbox name=\"Categ\" $checkCateg{'Chateau'} value=\"Chateau\"> Chateau<BR>\n";
    print "<input type=checkbox name=\"Categ\" $checkCateg{'ChateauFort'} value=\"Chateau-Fort\"> Chateau-Fort<BR>\n";
    print "<input type=checkbox name=\"Categ\" $checkCateg{'Donjon'} value=\"Donjon\"> Donjon<BR>\n";
    print "<input type=checkbox name=\"Categ\" $checkCateg{'Manoir'} value=\"Manoir\"> Manoir<BR>\n";
    print "<input type=checkbox name=\"Categ\" $checkCateg{'Ruines'} value=\"Ruines\"> Ruines<BR>\n";
    print "<input type=checkbox name=\"Categ\" $checkCateg{'Ralais'} value=\"Ralais\"> Ralais<BR>\n";
    print "</td>\n";
    @Style=split(/\; /,$Style);
    foreach $content (@Style){
    $content=~tr/[a-zA-Z0-9]//cd;
    $checkStyle{$content}="checked";}
    print "<td valign=top width=25%>Style:<br>\n";
    print "<input type=checkbox name=\"Style\" $checkStyle{'Renaissance'} value=\"Renaissance\"> Renaissance<BR>\n";
    print "<input type=checkbox name=\"Style\" $checkStyle{'Noclassique'} value=\"Néo-classique\"> Néo-classique<BR>\n";
    print "<input type=checkbox name=\"Style\" $checkStyle{'Gothique'} value=\"Gothique\"> Gothique<BR>\n";
    print "<input type=checkbox name=\"Style\" $checkStyle{'Nogothique'} value=\"Néo-gothique\"> Néo-gothique<BR>\n";
    print "<input type=checkbox name=\"Style\" $checkStyle{'Classique'} value=\"Classique\"> Classique<BR>\n";
    print "</td>\n";
    @Util=split(/\; /,$Util);
    foreach $content (@Util){
    $content=~tr/[a-zA-Z0-9]//cd;
    $checkUtil{$content}="checked";}
    print "<td valign=top width=25%>Utilisation:<br>\n";
    print "<input type=checkbox name=\"Util\" $checkUtil{'Antiquité - Gallerie'} value=\"Antiquité - Gallerie\"> Antiquité - Gallerie d'art<BR>\n";
    print "<input type=checkbox name=\"Util\" $checkUtil{'Amenagement'} value=\"Aménagement\"> Aménagement<BR>\n";
    print "<input type=checkbox name=\"Util\" $checkUtil{'Construction'} value=\"Construction\"> Construction<BR>\n";
    print "<input type=checkbox name=\"Util\" $checkUtil{'Defense - Fortifications '} value=\"Défense - Fortifications \"> Défense - Fortifications <BR>\n";
    print "<input type=checkbox name=\"Util\" $checkUtil{'Location evenements '} value=\"Location événements \"> Location événements <BR>\n";
    print "<input type=checkbox name=\"Util\" $checkUtil{'Residence - Plaisance'} value=\"Résidence - Plaisance\"> Résidence - Plaisance<BR>\n";
    print "<input type=checkbox name=\"Util\" $checkUtil{'Industriel'} value=\"Industriel\"> Industriel<BR>\n";
    print "</td><td valign=top width=25%><BR><input type=checkbox name=\"Util\" $checkUtil{'Reception - Séminaires '} value=\"Réception - Séminaires \"> Réception - Séminaires <BR>\n";
    print "<input type=checkbox name=\"Util\" $checkUtil{'Musee'} value=\"Musée \"> Musée<BR>\n";
    print "<input type=checkbox name=\"Util\" $checkUtil{'Animation - Culture '} value=\"Animation - Culture \"> Animation - Culture <BR>\n";
    print "<input type=checkbox name=\"Util\" $checkUtil{'Hebergement - Restauration '} value=\"Hébergement - Restauration \"> Hébergement Restauration<BR>\n";
    print "<input type=checkbox name=\"Util\" $checkUtil{'Palais royal et Princier '} value=\"Palais royal et Princier \"> Palais royal et Princier <BR>\n";
    print "<input type=checkbox name=\"Util\" $checkUtil{'Ferme'} value=\"Ferme\"> Ferme<BR>\n";
    print "<input type=checkbox name=\"Util\" $checkUtil{'Domaine parc et jardin '} value=\"Domaine, parc et jardin \"> Domaine, parc et jardin <BR>\n";
    print "</td></tr></table></td></tr>\n";
    print "<tr valign=top><td>Itinéraire:</td><td><input type=text name=\"Accestext\"  value=\"$Accestext\" size=35></td>\n";
    print "<td>Lien Mappy:</td><td><input type=text name=\"Acceslien\"  value=\"$Acceslien\" size=35></td></tr>\n";
    print "<tr valign=top><td>Visites:</td><td><input type=text name=\"Res3\" value=\"$Res3\"></td>\n";
    print "<td>Tarifs:</td><td><input type=text name=\"Tarifs\"  value=\"$Tarifs\" size=35></td></tr>\n";
    $Pub=~s/\"//g;
    print "<tr valign=top><td>Publicité:</td><td><input type=radio name=\"Pub\" value=\"$Pub\" checked>$Pub \n";
    print "<input type=radio name=\"Pub\" value=\"OUI\">OUI \n";
    print "<input type=radio name=\"Pub\" value=\"NON\">NON \n";
    print "</select></td>\n";
    print "<td>Res1:</td><td><input type=text name=\"Res1\"  value=\"$Res1\" size=35></td></tr>\n";
    print "<tr valign=top><td>Date:</td><td><input type=text name=\"Date\"  value=\"$Date\" size=35></td>\n";
    print "<td>Password:</td><td><input type=text name=\"Password\"  value=\"$Password\" size=35></td></tr>\n";
    #N10. Pass values to next screen
    print "</table>\n";
    print "<input type=hidden name=\"linenumberpass\" value=\"$linenumberpass\">\n";
    print "<input type=hidden name=\"checkpassword\" value=\"$checkpassword\">\n";
    print "<input type=submit name=\"actiontotake\" value=\"Edit Record\"></form><P>\n";
    print "$templateend\n";
    exit;
    }
     
    #STEP O================================
    sub delete{
    #O1. Open data file and read it
    $problem="Can't open data file to read from it at delete subroutine";
    open (FILE,"$data") || &security;
    @all=<FILE>;
     
    close (FILE);
    #O2. Read each line of the file
    foreach $line (@all){
    $line=~s/\n//g;
    ($copyRef,$copyPays,$copyCode,$copyNom,$copyPropri,$copyRue,$copyLoca,$copyEntite,$copyProv,$copyTel,$copyFax,$copyMail,$copyWeb,$copyChapeau,$copyDescrip,$copyNbmini,$copyAgmini,$copyLeggr,$copyLegm1,$copyLegm2,$copyLegm3,$copyDetail,$copyVideo,$copyCateg,$copyStyle,$copyUtil,$copyAccestext,$copyAcceslien,$copyTarifs,$copyPub,$copyRes1,$copyLegm4,$copyRes3,$copyDate,$copyPassword,$skipthisfield)=split (/$delimiter/,$line);
     
    $keepcount++;
    #O3. Find line to delete
    if ($keepcount==$linenumberpass){
    $linetokeep=$line;
    $linetokeep=~s/markedtoedit//g;
    last;
    }
    }
    ($Ref,$Pays,$Code,$Nom,$Propri,$Rue,$Loca,$Entite,$Prov,$Tel,$Fax,$Mail,$Web,$Chapeau,$Descrip,$Nbmini,$Agmini,$Leggr,$Legm1,$Legm2,$Legm3,$Detail,$Video,$Categ,$Style,$Util,$Accestext,$Acceslien,$Tarifs,$Pub,$Res1,$Legm4,$Res3,$Date,$Password,$skipthisfield)=split (/$delimiter/,$linetokeep);
     
    #O5. Check password sent via hidden field
    if ($Password ne $checkpassword && $adminpassword ne $checkpassword){
    $problem="Your password matches neither the master password nor the user password for this record.";
    &security;}
     
    #O6. Requred Header, do not delete
    print "Content-type: text/html\n\n";
    print "$templatestart\n";
    print "<P><CENTER><FONT size=\"+1\">Delete this Record?</FONT></CENTER><P>\n";
    ($Ref,$Pays,$Code,$Nom,$Propri,$Rue,$Loca,$Entite,$Prov,$Tel,$Fax,$Mail,$Web,$Chapeau,$Descrip,$Nbmini,$Agmini,$Leggr,$Legm1,$Legm2,$Legm3,$Detail,$Video,$Categ,$Style,$Util,$Accestext,$Acceslien,$Tarifs,$Pub,$Res1,$Legm4,$Res3,$Date,$Password,$skipthisfield)=split (/$delimiter/,$linetokeep);
     
    #O7. Show validation HTML
    print "<form method=POST action=\"$thisurl\">\n";
    print "<table>\n";
    print "<tr valign=top><td>Ref: </td><td>$Ref</td></tr>\n";
    print "<tr valign=top><td>Pays: </td><td>$Pays</td></tr>\n";
    print "<tr valign=top><td>Code: </td><td>$Code</td></tr>\n";
    print "<tr valign=top><td>Nom: </td><td>$Nom</td></tr>\n";
    print "<tr valign=top><td>Propri: </td><td>$Propri</td></tr>\n";
    print "<tr valign=top><td>Rue: </td><td>$Rue</td></tr>\n";
    print "<tr valign=top><td>Loca: </td><td>$Loca</td></tr>\n";
    print "<tr valign=top><td>Entite: </td><td>$Entite</td></tr>\n";
    print "<tr valign=top><td>Prov: </td><td>$Prov</td></tr>\n";
    print "<tr valign=top><td>Tel: </td><td>$Tel</td></tr>\n";
    print "<tr valign=top><td>Fax: </td><td>$Fax</td></tr>\n";
    print "<tr valign=top><td>Mail: </td><td>$Mail</td></tr>\n";
    print "<tr valign=top><td>Web: </td><td>$Web</td></tr>\n";
    print "<tr valign=top><td>Chapeau: </td><td>$Chapeau</td></tr>\n";
    print "<tr valign=top><td>Descrip: </td><td>$Descrip</td></tr>\n";
    print "<tr valign=top><td>Nbmini: </td><td>$Nbmini</td></tr>\n";
    print "<tr valign=top><td>Agmini: </td><td>$Agmini</td></tr>\n";
    print "<tr valign=top><td>Leggr: </td><td>$Leggr</td></tr>\n";
    print "<tr valign=top><td>Legm1: </td><td>$Legm1</td></tr>\n";
    print "<tr valign=top><td>Legm2: </td><td>$Legm2</td></tr>\n";
    print "<tr valign=top><td>Legm3: </td><td>$Legm3</td></tr>\n";
    print "<tr valign=top><td>Detail: </td><td>$Detail</td></tr>\n";
    print "<tr valign=top><td>Video: </td><td>$Video</td></tr>\n";
    print "<tr valign=top><td>Categ: </td><td>$Categ</td></tr>\n";
    print "<tr valign=top><td>Style: </td><td>$Style</td></tr>\n";
    print "<tr valign=top><td>Util: </td><td>$Util</td></tr>\n";
    print "<tr valign=top><td>Accestext: </td><td>$Accestext</td></tr>\n";
    print "<tr valign=top><td>Acceslien: </td><td>$Acceslien</td></tr>\n";
    print "<tr valign=top><td>Tarifs: </td><td>$Tarifs</td></tr>\n";
    print "<tr valign=top><td>Pub: </td><td>$Pub</td></tr>\n";
    print "<tr valign=top><td>Res1: </td><td>$Res1</td></tr>\n";
    print "<tr valign=top><td>Legm4: </td><td>$Legm4</td></tr>\n";
    print "<tr valign=top><td>Res3: </td><td>$Res3</td></tr>\n";
    print "<tr valign=top><td>Date: </td><td>$Datejour</td></tr>\n";
    print "<tr valign=top><td>Password: </td><td>$Password</td></tr>\n";
    print "</table><BR>\n";
    print "<input type=hidden name=\"linenumberpass\" value=\"$linenumberpass\">\n";
    print "<input type=hidden name=\"checkpassword\" value=\"$checkpassword\">\n";
    print "<input type=submit name=\"actiontotake\" value=\"Delete Record\"></form><P>\n";
    #If opening.htm was not found, show default closing html codes
    print "$templateend\n";
    exit;
    }
    #STEP P================================
    sub makechange{
    #P1.  For each variable, translate it, remove any delimiters that
    #user may have accidentally included, replace hard returns with
    #HTML line breaks, and delete all carriage returns
    #Go to get variable subroutine and make sure add preferences apply
     if ($recordaction eq "Edited"){
    &getvariables;}
    #P2. This step either replaces or empties the existing line
    if ($recordaction eq "Deleted"){
      $replacementline="";}
    else{
      $replacementline="$Ref$delimiter$Pays$delimiter$Code$delimiter$Nom$delimiter$Propri$delimiter$Rue$delimiter$Loca$delimiter$Entite$delimiter$Prov$delimiter$Tel$delimiter$Fax$delimiter$Mail$delimiter$Web$delimiter$Chapeau$delimiter$Descrip$delimiter$Nbmini$delimiter$Agmini$delimiter$Leggr$delimiter$Legm1$delimiter$Legm2$delimiter$Legm3$delimiter$Detail$delimiter$Video$delimiter$Categ$delimiter$Style$delimiter$Util$delimiter$Accestext$delimiter$Acceslien$delimiter$Tarifs$delimiter$Pub$delimiter$Res1$delimiter$Legm4$delimiter$Res3$delimiter$Date$delimiter$Password";}
    $problem="Can't open data file to read from it";
    open (FILE,"$data") || &security;
    @all=<FILE>;
     
    close (FILE);
    $linenumberpass--;
    $all[$linenumberpass]=$replacementline;
    $problem="Can't open temporary file.  You need to chmod 777 the <B>directory</B> your data file is in.  See the help files under Permissions for Class B Scripts.";
    #P6. Write the entire changed file to a temporary file
    open (FILE2,">$data.tmp") || &security;
    foreach $line (@all){
    $line=~s/\n//g;
    print FILE2 "$line\n";}
     
    close(FILE2);
     
    #P7. Rename the temp file to your master data file
    $problem="Can't rename file after making change";
    rename("$data.tmp", "$data") || &security;
    print "Content-type: text/html\n\n";
     
    #P8. If can't find opening html, display default header
    print "$templatestart\n";
     
    print "Your record has been $recordaction.  Please click <A href=\"$forwardingURL\">here</A> to continue.\n";
     
    close (FILE);
    #If opening.htm was not found, show default closing html codes
    print "$templateend\n";
    exit;
    }
    #STEP Q================================
    #This subroutine adds records to your database
    sub addrecord{
    &getvariables;
    $Date = $Datejour;
      $replacementline="$Ref$delimiter$Pays$delimiter$Code$delimiter$Nom$delimiter$Propri$delimiter$Rue$delimiter$Loca$delimiter$Entite$delimiter$Prov$delimiter$Tel$delimiter$Fax$delimiter$Mail$delimiter$Web$delimiter$Chapeau$delimiter$Descrip$delimiter$Nbmini$delimiter$Agmini$delimiter$Leggr$delimiter$Legm1$delimiter$Legm2$delimiter$Legm3$delimiter$Detail$delimiter$Video$delimiter$Categ$delimiter$Style$delimiter$Util$delimiter$Accestext$delimiter$Acceslien$delimiter$Tarifs$delimiter$Pub$delimiter$Res1$delimiter$Legm4$delimiter$Res3$delimiter$Date$delimiter$Password";
    #Q3. Write the new record to the bottom of the data file
    $problem="Can't write to the data file.  Please verify its location and change its permissions to 777.";
    open (FILE2,">>$data") || &security;
    print FILE2 "$replacementline\n";
    close(FILE2);
    print "Content-type: text/html\n\n";
     
    #Q4. If can't find opening html, display default header
    print "$templatestart\n";
    print "Your record has been added.  Please click <A href=\"$forwardingURL\">here</A> to continue.\n";
     
    #If opening.htm was not found, show default closing html codes
    print "$templateend\n";
    exit;
    }
    #STEP R================================
    sub getvariables{
    #R1. This step checks your variables before adding/editing them
      $Ref=$query->param('Ref');
      $Pays=$query->param('Pays');
      $Code=$query->param('Code');
      $Nom=$query->param('Nom');
      $Propri=$query->param('Propri');
      $Rue=$query->param('Rue');
      $Loca=$query->param('Loca');
      $Entite=$query->param('Entite');
      $Prov=$query->param('Prov');
      $Tel=$query->param('Tel');
      $Fax=$query->param('Fax');
      $Mail=$query->param('Mail');
      $Web=$query->param('Web');
      $Chapeau=$query->param('Chapeau');
      $Descrip=$query->param('Descrip');
      $Nbmini=$query->param('Nbmini');
      $Agmini=$query->param('Agmini');
      $Leggr=$query->param('Leggr');
      $Legm1=$query->param('Legm1');
      $Legm2=$query->param('Legm2');
      $Legm3=$query->param('Legm3');
      $Detail=$query->param('Detail');
      $Video=$query->param('Video');
      @Categ=$query->param('Categ');
      $Categ=join("\; ",@Categ);
      $Categ=~s/Select; //g;
      @Style=$query->param('Style');
      $Style=join("\; ",@Style);
      $Style=~s/Select; //g;
      @Util=$query->param('Util');
      $Util=join("\; ",@Util);
      $Util=~s/Select; //g;
      $Accestext=$query->param('Accestext');
      $Acceslien=$query->param('Acceslien');
      $Tarifs=$query->param('Tarifs');
      $Pub=$query->param('Pub');
      $Res1=$query->param('Res1');
      $Legm4=$query->param('Legm4');
      $Res3=$query->param('Res3');
      $Date=$query->param('Date');
      $Password=$query->param('Password');
     
    #R3. Replace hard returns with <BR>, cut carriage returns
    $Ref=~s/\n/<br>/g;
    $Ref=~s/\r//g;
    if ($Ref eq "Select"){
    $Ref="";}
    $Pays=~s/\n/<br>/g;
    $Pays=~s/\r//g;
    if ($Pays eq "Select"){
    $Pays="";}
    $Code=~s/\n/<br>/g;
    $Code=~s/\r//g;
    if ($Code eq "Select"){
    $Code="";}
    $Nom=~s/\n/<br>/g;
    $Nom=~s/\r//g;
    if ($Nom eq "Select"){
    $Nom="";}
    $Propri=~s/\n/<br>/g;
    $Propri=~s/\r//g;
    if ($Propri eq "Select"){
    $Propri="";}
    $Rue=~s/\n/<br>/g;
    $Rue=~s/\r//g;
    if ($Rue eq "Select"){
    $Rue="";}
    $Loca=~s/\n/<br>/g;
    $Loca=~s/\r//g;
    if ($Loca eq "Select"){
    $Loca="";}
    $Entite=~s/\n/<br>/g;
    $Entite=~s/\r//g;
    if ($Entite eq "Select"){
    $Entite="";}
    $Prov=~s/\n/<br>/g;
    $Prov=~s/\r//g;
    if ($Prov eq "Select"){
    $Prov="";}
    $Tel=~s/\n/<br>/g;
    $Tel=~s/\r//g;
    if ($Tel eq "Select"){
    $Tel="";}
    $Fax=~s/\n/<br>/g;
    $Fax=~s/\r//g;
    if ($Fax eq "Select"){
    $Fax="";}
    $Mail=~s/\n/<br>/g;
    $Mail=~s/\r//g;
    if ($Mail eq "Select"){
    $Mail="";}
    $Web=~s/\n/<br>/g;
    $Web=~s/\r//g;
    if ($Web eq "Select"){
    $Web="";}
    $Chapeau=~s/\n/<br>/g;
    $Chapeau=~s/\r//g;
    if ($Chapeau eq "Select"){
    $Chapeau="";}
    $Descrip=~s/\n/<br>/g;
    $Descrip=~s/\r//g;
    if ($Descrip eq "Select"){
    $Descrip="";}
    $Nbmini=~s/\n/<br>/g;
    $Nbmini=~s/\r//g;
    if ($Nbmini eq "Select"){
    $Nbmini="";}
    $Agmini=~s/\n/<br>/g;
    $Agmini=~s/\r//g;
    if ($Agmini eq "Select"){
    $Agmini="";}
    $Leggr=~s/\n/<br>/g;
    $Leggr=~s/\r//g;
    if ($Leggr eq "Select"){
    $Leggr="";}
    $Legm1=~s/\n/<br>/g;
    $Legm1=~s/\r//g;
    if ($Legm1 eq "Select"){
    $Legm1="";}
    $Legm2=~s/\n/<br>/g;
    $Legm2=~s/\r//g;
    if ($Legm2 eq "Select"){
    $Legm2="";}
    $Legm3=~s/\n/<br>/g;
    $Legm3=~s/\r//g;
    if ($Legm3 eq "Select"){
    $Legm3="";}
    $Detail=~s/\n/<br>/g;
    $Detail=~s/\r//g;
    if ($Detail eq "Select"){
    $Detail="";}
    $Video=~s/\n/<br>/g;
    $Video=~s/\r//g;
    if ($Video eq "Select"){
    $Video="";}
    $Categ=~s/\n/<br>/g;
    $Categ=~s/\r//g;
    if ($Categ eq "Select"){
    $Categ="";}
    $Style=~s/\n/<br>/g;
    $Style=~s/\r//g;
    if ($Style eq "Select"){
    $Style="";}
    $Util=~s/\n/<br>/g;
    $Util=~s/\r//g;
    if ($Util eq "Select"){
    $Util="";}
    $Accestext=~s/\n/<br>/g;
    $Accestext=~s/\r//g;
    if ($Accestext eq "Select"){
    $Accestext="";}
    $Acceslien=~s/\n/<br>/g;
    $Acceslien=~s/\r//g;
    if ($Acceslien eq "Select"){
    $Acceslien="";}
    $Tarifs=~s/\n/<br>/g;
    $Tarifs=~s/\r//g;
    if ($Tarifs eq "Select"){
    $Tarifs="";}
    $Pub=~s/\n/<br>/g;
    $Pub=~s/\r//g;
    if ($Pub eq "Select"){
    $Pub="";}
    $Res1=~s/\n/<br>/g;
    $Res1=~s/\r//g;
    if ($Res1 eq "Select"){
    $Res1="";}
    $Legm4=~s/\n/<br>/g;
    $Legm4=~s/\r//g;
    if ($Legm4 eq "Select"){
    $Legm4="";}
    $Res3=~s/\n/<br>/g;
    $Res3=~s/\r//g;
    if ($Res3 eq "Select"){
    $Res3="";}
    $Date=~s/\n/<br>/g;
    $Date=~s/\r//g;
    if ($Date eq "Select"){
    $Date="";}
    $Password=~s/\n/<br>/g;
    $Password=~s/\r//g;
    if ($Password eq "Select"){
    $Password="";}
     
    #R7. You have marked Ref as a field that must contain less than 4
    #non-blank characters before allowing the field to be added.  You can change the
    #requirement below, or comment out all 6 lines below step to skip validation
    $Refcheck=$Ref;
    $Refcheck=~s/ +/ /g;
    $Refcheck=length($Refcheck);
    if ($Refcheck>4){
    $problem="Please press back on your browser and provide more information for the Ref field.";
    &security;}
     
     
    #R4. You have marked Password as a field that must contain at least 6
    #non-blank characters before allowing the field to be added.  You can change the
    #requirement below, or comment out all 6 lines below step to skip validation
    $Passwordcheck=$Password;
    $Passwordcheck=~s/ +/ /g;
    $Passwordcheck=length($Passwordcheck);
    if ($Passwordcheck<4){
    $problem="Please press back on your browser and provide more information for the Password field.";
    &security;}
     
    }
     
    #This is the last line of the script
    et l'adresse de l'autre site: www.chateaude.be

    J'ai essayé de changer la ligne B1 data, mais je sais pas comment faire et je ne sais même pas si c'est là que je dois intervenir pour accéder à la base de données chateau.data.
    Voilà
    J'attends vos questions pour vous aider à comprendre.
    Merci à tous
    A bientôt
    V

  15. #15
    Futur Membre du Club
    Profil pro
    Inscrit en
    Février 2011
    Messages
    5
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Février 2011
    Messages : 5
    Points : 5
    Points
    5
    Par défaut
    Pour info et concernant le message précédent, la réponse de l'hébergeur qd à la restriction:

    Il ne sera malheureusement pas possible de faire grand chose avec tous les fichiers contenu dans le dossier "chateaude.be/cgi-bin" car comme notre agent vous l'avait dit, ce dossier a été protégé par une restriction. La seule possibilité que vous avez est de tout simplement supprimer ce dossier depuis votre ftp (filezilla par exemple).
    V.

  16. #16
    Futur Membre du Club
    Profil pro
    Inscrit en
    Février 2011
    Messages
    5
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Février 2011
    Messages : 5
    Points : 5
    Points
    5
    Par défaut
    Un petit UP?

Discussions similaires

  1. comment trouver le chemin de project?
    Par mechatikhaled dans le forum Débuter
    Réponses: 5
    Dernier message: 08/02/2006, 10h54
  2. CGI-BIN formulaire pl
    Par gregbart dans le forum Web
    Réponses: 6
    Dernier message: 19/12/2005, 07h44
  3. Trouver son chemin dans un labyrinthe
    Par APoLLoN1234 dans le forum Algorithmes et structures de données
    Réponses: 8
    Dernier message: 03/11/2005, 22h34
  4. Comment trouver le chemin du bureau ou desktop
    Par G.STEVENS dans le forum Windows
    Réponses: 2
    Dernier message: 29/08/2005, 18h21
  5. [web] Apache Cgi-Bin
    Par Tommy Jean dans le forum Web
    Réponses: 8
    Dernier message: 23/08/2004, 18h46

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo