Visualizzazione dei risultati da 1 a 7 su 7

Discussione: Password Php?

  1. #1

    Password Php?

    Ciao Ragazzi, qualcuno ha un codice da aggiungere ad una pagina PHP per far si che, quando ci vai, prima trovi un campo da compilare con una password che , se corretta ti fa vedere la pagina, altrimenti ti da errore..

    Grazie!

  2. #2
    dipende come lo vuoi realizzare, se ti basta che la pagina sia protetta da una singola password, oppure vuoi fare in modo che ogni utente abbia la sua. devi essere più preciso altrimenti non sappiamo come aiutarti.
    "Una volta che si saranno esaurite senza successo tutte le possibilita', ci sara' una soluzione, semplice e ovvia, che saltera' immediatamente all'occhio di chiunque altro."

    Guardate: Il Miracolo delle Noci!!

  3. #3
    me ne basta una sola.

    Grazie!!

  4. #4
    <?php
    if(isset($_POST['invia']) && $_POST['password']=="miapassword")
    {
    echo "loggato e riconosciuto";
    }
    else if(isset($_POST['invia']))
    {
    echo "password sbagliata";
    }
    else
    {
    ?>
    <form method = post action = "<?=$_SERVER['PHP_SELF'];?>">
    <input type = password name = password>
    <input type = submit name = "invia" value = "Invia">
    </form>
    <?
    }
    ?>
    http://www.perungiorno.it

  5. #5
    perdonami l'ignoranza...
    io inserisco questo codice all'inizio della pagina che per aprirsi deve richiedere la password?

  6. #6
    else
    {
    ?>
    <form method = post action = "<?=$_SERVER['PHP_SELF'];?>">
    <input type = password name = password>
    <input type = submit name = "invia" value = "Invia">
    </form>
    <?
    }
    nel codice sovrastante entra la prima volta

    ----------------------------------------------------
    else if(isset($_POST['invia']))
    {
    echo "password sbagliata";
    }
    nel codice sovrastante entra se ha cliccato invia inserendo la pasword, ma la password e sbagliata
    -----------------------------------------------------
    if(isset($_POST['invia']) && $_POST['password']=="miapassword")
    {
    echo "loggato e riconosciuto";
    }
    nel codice sovrastante entra se ha inserita la password ed e' corretta, la pagina caricata sara sempre la stessa ma visualizzerai parte di codice a seconda delle condizioni sopra elencate che si verificano

    spero di essermi spiegato, altrimenti mi ripeto no problem
    http://www.perungiorno.it

  7. #7
    allora...così siamo sicuri che va..
    il seguente codice è la pagina index.php principale.
    devo inserire qui dentro il tuo codice?
    ho provato io ma non mi funziona, riesci a mettermelo tu?
    Grazie, sei un BIG!!(non è tutto perchè noon ci stava..magari quello che aggiungi me lo metti in bold?)

    <?php
    /*
    $Id: index.php,v 1.19 2003/06/27 09:38:31 dgw_ Exp $

    osCommerce, Open Source E-Commerce Solutions
    http://www.oscommerce.com

    Copyright (c) 2003 osCommerce

    Released under the GNU General Public License
    */

    require('includes/application_top.php');

    $cat = array(array('title' => BOX_HEADING_CONFIGURATION,
    'image' => 'configuration.gif',
    'href' => tep_href_link(FILENAME_CONFIGURATION, 'selected_box=configuration&gID=1'),
    'children' => array(array('title' => BOX_CONFIGURATION_MYSTORE, 'link' => tep_href_link(FILENAME_CONFIGURATION, 'selected_box=configuration&gID=1')),
    array('title' => BOX_CONFIGURATION_LOGGING, 'link' => tep_href_link(FILENAME_CONFIGURATION, 'selected_box=configuration&gID=10')),
    array('title' => BOX_CONFIGURATION_CACHE, 'link' => tep_href_link(FILENAME_CONFIGURATION, 'selected_box=configuration&gID=11')))),
    array('title' => BOX_HEADING_MODULES,
    'image' => 'modules.gif',
    'href' => tep_href_link(FILENAME_MODULES, 'selected_box=modules&set=payment'),
    'children' => array(array('title' => BOX_MODULES_PAYMENT, 'link' => tep_href_link(FILENAME_MODULES, 'selected_box=modules&set=payment')),
    array('title' => BOX_MODULES_SHIPPING, 'link' => tep_href_link(FILENAME_MODULES, 'selected_box=modules&set=shipping')))),
    array('title' => BOX_HEADING_CATALOG,
    'image' => 'catalog.gif',
    'href' => tep_href_link(FILENAME_CATEGORIES, 'selected_box=catalog'),
    'children' => array(array('title' => CATALOG_CONTENTS, 'link' => tep_href_link(FILENAME_CATEGORIES, 'selected_box=catalog')),
    array('title' => BOX_CATALOG_MANUFACTURERS, 'link' => tep_href_link(FILENAME_MANUFACTURERS, 'selected_box=catalog')))),
    array('title' => BOX_HEADING_LOCATION_AND_TAXES,
    'image' => 'location.gif',
    'href' => tep_href_link(FILENAME_COUNTRIES, 'selected_box=taxes'),
    'children' => array(array('title' => BOX_TAXES_COUNTRIES, 'link' => tep_href_link(FILENAME_COUNTRIES, 'selected_box=taxes')),
    array('title' => BOX_TAXES_GEO_ZONES, 'link' => tep_href_link(FILENAME_GEO_ZONES, 'selected_box=taxes')))),
    array('title' => BOX_HEADING_CUSTOMERS,
    'image' => 'customers.gif',
    'href' => tep_href_link(FILENAME_CUSTOMERS, 'selected_box=customers'),
    'children' => array(array('title' => BOX_CUSTOMERS_CUSTOMERS, 'link' => tep_href_link(FILENAME_CUSTOMERS, 'selected_box=customers')),
    array('title' => BOX_CUSTOMERS_ORDERS, 'link' => tep_href_link(FILENAME_ORDERS, 'selected_box=customers')))),
    array('title' => BOX_HEADING_LOCALIZATION,
    'image' => 'localization.gif',
    'href' => tep_href_link(FILENAME_CURRENCIES, 'selected_box=localization'),
    'children' => array(array('title' => BOX_LOCALIZATION_CURRENCIES, 'link' => tep_href_link(FILENAME_CURRENCIES, 'selected_box=localization')),
    array('title' => BOX_LOCALIZATION_LANGUAGES, 'link' => tep_href_link(FILENAME_LANGUAGES, 'selected_box=localization')))),
    array('title' => BOX_HEADING_REPORTS,
    'image' => 'reports.gif',
    'href' => tep_href_link(FILENAME_STATS_PRODUCTS_PURCHASED, 'selected_box=reports'),
    'children' => array(array('title' => REPORTS_PRODUCTS, 'link' => tep_href_link(FILENAME_STATS_PRODUCTS_PURCHASED, 'selected_box=reports')),
    array('title' => REPORTS_ORDERS, 'link' => tep_href_link(FILENAME_STATS_CUSTOMERS, 'selected_box=reports')))),
    array('title' => BOX_HEADING_TOOLS,
    'image' => 'tools.gif',
    'href' => tep_href_link(FILENAME_BACKUP, 'selected_box=tools'),
    'children' => array(array('title' => TOOLS_BACKUP, 'link' => tep_href_link(FILENAME_BACKUP, 'selected_box=tools')),
    array('title' => TOOLS_BANNERS, 'link' => tep_href_link(FILENAME_BANNER_MANAGER, 'selected_box=tools')),
    array('title' => TOOLS_FILES, 'link' => tep_href_link(FILENAME_FILE_MANAGER, 'selected_box=tools')))));

    $languages = tep_get_languages();
    $languages_array = array();
    $languages_selected = DEFAULT_LANGUAGE;
    for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
    $languages_array[] = array('id' => $languages[$i]['code'],
    'text' => $languages[$i]['name']);
    if ($languages[$i]['directory'] == $language) {
    $languages_selected = $languages[$i]['code'];
    }
    }
    ?>
    <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html <?php echo HTML_PARAMS; ?>>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
    <title><?php echo TITLE; ?></title>
    <style type="text/css"><!--
    a { color:#080381; text-decoration:none; }
    a:hover { color:#aabbdd; text-decoration:underline; }
    a.text:link, a.text:visited { color: #000000; text-decoration: none; }
    a:text:hover { color: #000000; text-decoration: underline; }
    a.main:link, a.main:visited { color: #ffffff; text-decoration: none; }
    A.main:hover { color: #ffffff; text-decoration: underline; }
    a.sub:link, a.sub:visited { color: #dddddd; text-decoration: none; }
    A.sub:hover { color: #dddddd; text-decoration: underline; }
    .heading { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 20px; font-weight: bold; line-height: 1.5; color: #D3DBFF; }
    .main { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 17px; font-weight: bold; line-height: 1.5; color: #ffffff; }
    .sub { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; line-height: 1.5; color: #dddddd; }
    .text { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; line-height: 1.5; color: #000000; }
    .menuBoxHeading { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #ffffff; font-weight: bold; background-color: #7187bb; border-color: #7187bb; border-style: solid; border-width: 1px; }
    .infoBox { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #080381; background-color: #f2f4ff; border-color: #7187bb; border-style: solid; border-width: 1px; }
    .smallText { font-family: Verdana, Arial, sans-serif; font-size: 10px; }
    //--></style>
    </head>
    <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">

    <table border="0" width="600" height="100%" cellspacing="0" cellpadding="0" align="center" valign="middle">
    <tr>
    <td><table border="0" width="600" height="440" cellspacing="0" cellpadding="1" align="center" valign="middle">
    <tr bgcolor="#000000">
    <td><table border="0" width="600" height="440" cellspacing="0" cellpadding="0">
    <tr bgcolor="#ffffff" height="50">
    <td height="50"><?php echo tep_image(DIR_WS_IMAGES . 'oscommerce.gif', 'osCommerce', '204', '50'); ?></td>
    <td align="right" class="text" nowrap><?php echo '' . HEADER_TITLE_ADMINISTRATION . '|' . HEADER_TITLE_ONLINE_CATALOG . '|' . HEADER_TITLE_SUPPORT_SITE . ''; ?></td>
    </tr>
    <tr bgcolor="#080381">
    <td colspan="2"><table border="0" width="460" height="390" cellspacing="0" cellpadding="2">
    <tr valign="top">
    <td width="140" valign="top"><table border="0" width="140" height="390" cellspacing="0" cellpadding="2">
    <tr>
    <td valign="top">

    <?php
    $heading = array();
    $contents = array();

    $heading[] = array('params' => 'class="menuBoxHeading"',
    'text' => 'osCommerce');

    $contents[] = array('params' => 'class="infoBox"',
    'text' => '' . BOX_ENTRY_SUPPORT_SITE . '
    ' .
    '' . BOX_ENTRY_SUPPORT_FORUMS . '
    ' .
    '' . BOX_ENTRY_MAILING_LISTS . '
    ' .
    '' . BOX_ENTRY_BUG_REPORTS . '
    ' .
    '' . BOX_ENTRY_FAQ . '
    ' .
    '' . BOX_ENTRY_LIVE_DISCUSSIONS . '
    ' .
    '' . BOX_ENTRY_CVS_REPOSITORY . '
    ' .
    '' . BOX_ENTRY_INFORMATION_PORTAL . '');

    $box = new box;
    echo $box->menuBox($heading, $contents);

    echo '
    ';

    $orders_contents = '';
    $orders_status_query = tep_db_query("select orders_status_name, orders_status_id from " . TABLE_ORDERS_STATUS . " where language_id = '" . $languages_id . "'");
    while ($orders_status = tep_db_fetch_array($orders_status_query)) {
    $orders_pending_query = tep_db_query("select count(*) as count from " . TABLE_ORDERS . " where orders_status = '" . $orders_status['orders_status_id'] . "'");
    $orders_pending = tep_db_fetch_array($orders_pending_query);
    $orders_contents .= '' . $orders_status['orders_status_name'] . ': ' . $orders_pending['count'] . '
    ';
    }
    $orders_contents = substr($orders_contents, 0, -4);

    $heading = array();
    $contents = array();

    $heading[] = array('params' => 'class="menuBoxHeading"',
    'text' => BOX_TITLE_ORDERS);

    $contents[] = array('params' => 'class="infoBox"',
    'text' => $orders_contents);

    $box = new box;
    echo $box->menuBox($heading, $contents);

    echo '
    ';

    $customers_query = tep_db_query("select count(*) as count from " . TABLE_CUSTOMERS);
    $customers = tep_db_fetch_array($customers_query);
    $products_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS . " where products_status = '1'");
    $products = tep_db_fetch_array($products_query);
    $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS);
    $reviews = tep_db_fetch_array($reviews_query);

    $heading = array();
    $contents = array();

    $heading[] = array('params' => 'class="menuBoxHeading"',
    'text' => BOX_TITLE_STATISTICS);

    $contents[] = array('params' => 'class="infoBox"',
    'text' => BOX_ENTRY_CUSTOMERS . ' ' . $customers['count'] . '
    ' .
    BOX_ENTRY_PRODUCTS . ' ' . $products['count'] . '
    ' .
    BOX_ENTRY_REVIEWS . ' ' . $reviews['count']);

    $box = new box;
    echo $box->menuBox($heading, $contents);

    echo '
    ';

    $contents = array();

    if (getenv('HTTPS') == 'on') {
    $size = ((getenv('SSL_CIPHER_ALGKEYSIZE')) ? getenv('SSL_CIPHER_ALGKEYSIZE') . '-bit' : '' . BOX_CONNECTION_UNKNOWN . '');
    $contents[] = array('params' => 'class="infoBox"',
    'text' => tep_image(DIR_WS_ICONS . 'locked.gif', ICON_LOCKED, '', '', 'align="right"') . sprintf(BOX_CONNECTION_PROTECTED, $size));
    } else {
    $contents[] = array('params' => 'class="infoBox"',
    'text' => tep_image(DIR_WS_ICONS . 'unlocked.gif', ICON_UNLOCKED, '', '', 'align="right"') . BOX_CONNECTION_UNPROTECTED);
    }

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.