Pagina 1 di 9 1 2 3 ... ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 82

Discussione: login utente

  1. #1
    Utente di HTML.it
    Registrato dal
    May 2007
    Messaggi
    1,805

    login utente

    salve a tutti ho trovato questo script dalla rete per la registrazione utente pero non va non mi si collega al database perche?
    Codice PHP:
    <?PHP


    $newUser 
    $_POST['newUser'];
    $passOne $_POST['passOne'];
    $passTwo $_POST['passTwo'];


    if (
    $passOne == $passTwo) {
        
    $newPass $passOne;
        
    } else {
        print 
    "Passwords mismatched";
    }


    if ((
    $REQUEST_METHOD=='POST')) {
    for(
    reset($HTTP_POST_VARS);
                          
    $key=key($HTTP_POST_VARS);
                          
    next($HTTP_POST_VARS)) {
        
    $this addslashes($HTTP_POST_VARS[$key]);
        
    $this strtr($this">"" ");
        
    $this strtr($this"<"" ");
        
    $this strtr($this"|"" ");
        $
    $key $this;
      }
    if (
    $newUser && $newPass ) {
    $query "insert into auth (userid,username,userpassword) ";
    $query .= "VALUES(0000,'$newUser','$newPass')";
        
    mysql_connect("localhost","root","")
                       or die(
    "Unable to connect to SQL server");
        
    mysql_select_db("ccc") or die("Unable to select database");
        
    $result mysql_query($query) or die("Insert Failed!");
        }
    }

    if ( 
    $result ){
    print 
    "You have successfully entered ".$newUser." with the password of ".$newPass." to your database!!";
    }
    ?>

    <html>
    <head>
    <title>Database Insert Form for kirupa</title>
    </head>
    <body bgcolor="#FFFFFF">
    <h1>Insert Into Database • UCS</h1>


    <form action="usercheck.php" method="POST">
    New User Name: <input type="text" size="20" name="newUser" style="background-color: cyan;">

    New User Password: <input type="text" size="20" name="passOne" style="background-color: cyan;">

    Verify Password: <input type="text" size="20" name="passTwo" style="background-color: cyan;">

    <input type="submit" value="Add User" style="background-color: cyan;">
    </form>







    <hr>
    <?
    $queryb
    ="SELECT COUNT(*) FROM auth";
        
    mysql_connect("localhost","root","")
                       or die(
    "Unable to connect to SQL server");
        
    mysql_select_db("ccc") or die("Unable to select database");
    $numusers=mysql_query($queryb) or die ("Select Failed - count");
    $numuser=mysql_fetch_array($numusers);
    ?>
    <h3>Current Users in Database</h3>



    There are <? echo $numuser[0]; ?> current users in database.

    Listed in alphabetical order by user's name:




    <?
    $queryc
    ="SELECT * FROM auth ORDER BY username";
        
    $userlist=mysql_query($queryc) or die("Select Failed - users");

    ?>
    <center>
    <table border="1" bordercolor="#000000">
        <tr>
            <td width="20%" bgcolor="#000000">
            <font size="2" color="#FFFFFF"><center>
            USERS
            </font></center>
            </td>
            <td width="20%" bgcolor="#000000">
            <font size="2" color="#FFFFFF"><center>
            PASSWORDS
            </font></center>
            </td>
        </tr>
    <?
    while ($userinfo mysql_fetch_array($userlist)){
    ?>
        <tr>
            <td width="20%" bgcolor="#FFCC33">
            <center>
            <? echo $userinfo['username']; ?>
            </center>
            </td>
            <td width="20%" bgcolor="#FFCC33">
            <center>
            <? echo $userinfo['userpassword']; ?>
            </center>
            </td>
        </tr>
    <? ?>

    </table>

  2. #2
    solo per sicurezza:

    il tuo database è in locale, si chiama ccc e l'account root non ha nessuna passwrod?

    mysql_connect("localhost","root","")
    or die("Unable to connect to SQL server");
    mysql_select_db("ccc") or die("Unable to select database");

  3. #3
    Utente di HTML.it
    Registrato dal
    May 2003
    Messaggi
    591
    potrebbe essere questo.... ma anche altro , ma se non ci dici l'errore :master:

    $connection=mysql_connect("localhost","root","") or die("Unable to connect to SQL server");
    mysql_select_db("ccc",$connection) or die("Unable to select database");

  4. #4
    Si, concordo con stabi e pippuzzo. Al limite per vedere ke tipo di errore genera, potresti fare:

    $connection=mysql_connect("localhost","root","") or die(mysql_error());

  5. #5
    Utente di HTML.it
    Registrato dal
    May 2007
    Messaggi
    1,805
    ragazzi vorrei chiedervi un info devo salvare due dati nel database io tramite flash invio al php il php invia a mel email e al utente questo e il files

    Codice PHP:
    <?php 
    include_once("include/config.php");
    //include_once("include/auth.lib.php");
    $adminaddress "info@marikwebdesigner.com"
    $siteaddress ="http://www.marikwebdesigner.com"
    $sitename "marikwebdesigner"

    //No need to change anything below ... 
    // Gets the date and time from your server 
    $date date("d/m/Y H:i:s"); 

    // Gets the IP Address 
    if ($_SERVER['REMOTE_ADDR'] == ""$ip "no ip"
    else 
    $ip gethostbyaddr($_SERVER['REMOTE_ADDR']); 

    // Gets the POST Headers - the Flash variables 
    $action $_POST['action'] ; 
    $email $_POST['email'] ; 
    $name $_POST['name'] ; 
    $comments $_POST['comments'] ; 
    $telefono $_POST['telefono'] ; 
    $oggetto $_POST['oggetto'] ; 

    //Process the form data! 
    // and send the information collected in the Flash form to Your nominated email address 

    if ($action == "send") { 
        
    // 
        
    mail ("$adminaddress","informazioni"
        
    "L' utente:  $name  si è iscritto alla MailingList \n 
        ------------------------------ 
        Name Utente: 
    $name 
        EmailUtente: 
    $email\n 
        ------------------------------ 
         
        Logged Info : 
        ------------------------------ 
        Using: 
    {$_SERVER['HTTP_USER_AGENT']} 
        Hostname: 
    $ip 
        IP address: 
    {$_SERVER['REMOTE_ADDR']} 
        Date/Time:  
    $date","FROM:$email) ; 
         
        
    //This sends a confirmation to your visitor 
        
    mail ("$email","Re:"
        
    "Salve $name,\n 
        Per confermare l'iscizione alla Newsletter Le basta cliccare sul link sottostante 
    $siteaddress/homeita/mailinglist/conferma.php?email=$email&name=$name\">.\n 

         Saluti dallo Staff di 
    $sitename 
         

        
    $siteaddress","FROM:$adminaddress ") ; 
         
        
    //Confirmation is sent back to the Flash form that the process is complete 
        
    $sendresult "Thank you. You will receive a confirmation email shortly."
        
    $send_answer "answer="
        
    $send_answer .= rawurlencode($sendresult); 
        echo 
    $send_answer
    // 


    ?>
    e questo e il files di connessione al db

  6. #6
    Utente di HTML.it
    Registrato dal
    May 2007
    Messaggi
    1,805
    Codice PHP:
    <?php
    $_CONFIG
    ['host'] = "localhost";
    $_CONFIG['user'] = "chiolo";
    $_CONFIG['pass'] = "maurizio";
    $_CONFIG['dbname'] = "rocco";


    $_CONFIG['table_mailing'] = "mailing";

    $_CONFIG['expire'] = 60;
    $_CONFIG['regexpire'] = 24//in ore

    $_CONFIG['check_table'] = array(
        
    "name" => "check_global",
        
    "mail" => "check_global"
    );

    function 
    check_username($value){
        global 
    $_CONFIG;
        
        
    $value trim($value);
        if(
    $value == "")
            return 
    "Il campo non può essere lasciato vuoto";
        
    $query mysql_query("
        SELECT id
        FROM "
    .$_CONFIG['table_utenti']."
        WHERE username='"
    .$value."'");
        if(
    mysql_num_rows($query) != 0)
            return 
    "Nome utente già utilizzato";
        
        return 
    true;
    }

    function 
    check_global($value){
        global 
    $_CONFIG;
        
        
    $value trim($value);
        if(
    $value == "")
            return 
    "Il campo non può essere lasciato vuoto";
        
        return 
    true;
    }


    //--------------
    define('AUTH_LOGGED'99);
    define('AUTH_NOT_LOGGED'100);

    define('AUTH_USE_COOKIE'101);
    define('AUTH_USE_LINK'103);
    define('AUTH_INVALID_PARAMS'104);
    define('AUTH_LOGEDD_IN'105);
    define('AUTH_FAILED'106);

    define('REG_ERRORS'107);
    define('REG_SUCCESS'108);
    define('REG_FAILED'109);

    $conn mysql_connect($_CONFIG['host'], $_CONFIG['user'], $_CONFIG['pass']) or die('Impossibile stabilire una connessione');
    mysql_select_db($_CONFIG['dbname']);
    ?>

  7. #7
    Utente di HTML.it
    Registrato dal
    May 2007
    Messaggi
    1,805
    pero non mi salva niente sul database perche?

  8. #8
    Utente di HTML.it
    Registrato dal
    May 2003
    Messaggi
    591
    con
    mysql_select_db($_CONFIG['dbname'],$conn);
    ??

  9. #9
    Innanzitutto per convenzione è altamente SCONSIGLIATO usare nomi di varibili che iniziano con _ quindi al limite usa $CONFIG e non $_CONFIG

    Poi, mysql_select_db($_CONFIG['dbname']) or die("Errore nella connessione");

    così sappiamo se si è connesso o meno.

    infine, potresti farci capire in modo chiaro e con una punteggiatura decente (vedi ad es. ragazzi vorrei chiedervi un info devo salvare due dati nel database io tramite flash invio al php il php invia a mel email e al utente questo e il files - sinceramente confonde un pò) l'ordine con cui usi i 3 script che ci hai postato?

    Grazie, molto gentile.

  10. #10
    Utente di HTML.it
    Registrato dal
    May 2007
    Messaggi
    1,805
    scusate se non sono stato chiaro.
    vi spiego meglio il primo files in alto serve all invio delle mailinglist ,cioè se qualcuno si iscrive quel files manda a me un e-mail dicendo che un utente si e iscritto alla mailing list ,e ancora spedisce all utente un e-mail di conferma il secondo files lo ricavato da un altro script e serve per salvere i dati nel db ,pero non so perche non mi va mi dareste una mano?

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 © 2025 vBulletin Solutions, Inc. All rights reserved.