Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 16
  1. #1
    Utente di HTML.it
    Registrato dal
    Mar 2009
    Messaggi
    95

    Script Gestione utenti PHP,MySql

    Salve foro!

    vorrei chiedere, avendo cercato e non avendo trovato, se esiste uno script per la registrazione e gestione degli utenti in php, mysql che dia la possibilità di inserire immagini nel profilo...grazie per l'attenzione e per le risposte che spero siano numerose

  2. #2
    Utente di HTML.it
    Registrato dal
    Mar 2009
    Messaggi
    95
    up

    pls help me

  3. #3
    Utente di HTML.it L'avatar di telegio
    Registrato dal
    Sep 2001
    Messaggi
    2,592
    gli script si fanno per uno scopo. probabilmente non lo hai trovato perchè una cosa di questo tipo un uso specifico: forum, blog, social network.. Ti conviene fartelo da solo, unendo i pezzi che trovi nelle pillole: in sostanza devi fare l'autenticazione e aggiungerci un upload "parametrizzato" all'utente loggato in quel momento..
    per aiutarti sul codice siamo sempre qua..

  4. #4
    Ciao, anche io mi stò avventurando nol mondo dei login, ti allego il link di html.it per la gestione degli utenti in aree riservate.
    php.html.it

    Inoltre ti posto il codice che stò utilizzando per fare esperimenti, magari ti torna utile (sempre trovato su google)

    index.php
    Codice PHP:
    <html
     <
    head>
         <
    title>Server2Go Selfconfigurating WAMP Stack</title>
         <
    link rel="stylesheet" href="format.css" type="text/css">
     </
    head>
     <
    body>
         <
    table width="200" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
             <
    tr>
                 <
    form name="form1" method="post" action="checklogin.php">             <td>             <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
                     <
    tr>
                         <
    td colspan="3">[b]Member Login [/b]</td>
                     </
    tr>
                     <
    tr>
                         <
    td width="78">Username</td>                     <td width="6">:</td>
                         <
    td width="294"><input name="myusername" type="text" id="myusername"></td>
                     </
    tr>
                     <
    tr>
                         <
    td width="78">Password</td>                     <td width="6">:</td>
                         <
    td width="294"><input name="mypassword" type="password" id="mypassword"></td>
                     </
    tr>
                     <
    tr>
                         <
    td></td>
                         <
    td></td>
                         <
    td><input type="submit" name="Submit" value="Login"></td>
                     </
    tr>
                 </
    table>
                 </
    td>
                 </
    form>
             </
    tr>
         </
    table>
     </
    body>
     </
    html

    connect.php
    Codice PHP:
    <?php
    $host
    ="localhost"// Host name 
    $username="root"// Mysql username 
    $password=""// Mysql password 
    $db_name="user"// Database name 
    $tbl_name="members"// Table name
    ?>
    checklogin.php
    Codice PHP:
    <?php
    include "connect.php";

    // Connect to server and select databse.
    mysql_connect("$host""$username""$password")or die("cannot connect"); 
    mysql_select_db("$db_name")or die("cannot select DB");

    // username and password sent from form 
    $myusername=$_POST['myusername']; 
    $mypassword=$_POST['mypassword'];

    // To protect MySQL injection (more detail about MySQL injection)
    $myusername stripslashes($myusername);
    $mypassword stripslashes($mypassword);
    $myusername mysql_real_escape_string($myusername);
    $mypassword mysql_real_escape_string($mypassword);

    $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
    $result=mysql_query($sql);

    // Mysql_num_row is counting table row
    $count=mysql_num_rows($result);
    // If result matched $myusername and $mypassword, table row must be 1 row

    if($count==1){
    // Register $myusername, $mypassword and redirect to file "login_success.php"
    session_register("myusername");
    session_register("mypassword"); 
    header("location:login_success.php");
    }
    else {
    echo 
    "Wrong Username or Password";
    }
    ?>
    login_success.php
    Codice PHP:
    <? 
    session_start
    ();
    if(!
    session_is_registered(myusername)){
    header("location:index.php");
    }
    ?>

    <html>
    <body>

    <form name="form2" method="post" action="logout.php">
    Login Successful 


    <?php
     
    echo "Benvenuto ".$_SESSION['myusername']." hai effettuato il login con successo

    Puoi effettuare il logout"
    ;
    ?>





    <input type="submit" name="Submit" value="Logout" action="logout.php">
    </form>
    </body>
    </html>

    logout.php
    Codice PHP:
    <? 
    session_start
    ();
    session_destroy();
    header("location:index.php");
    ?>

  5. #5
    Utente di HTML.it
    Registrato dal
    Mar 2009
    Messaggi
    95
    ho trovato uno script buono xò ho un problema ... non mi uploada le immagini....
    questo è il codice della pagina:

    Codice PHP:
    <?php
    include ('protect.php');
    //edit this
    $_max_file_size '1000000'//file size in bytes.
    $upload_dir "userdata/avatars/";  //upload folder..chmod to 777
    $_i "1";                //number of files to upload at one time
    $file_exists= array('.jpg','.gif');
    //end edit
    echo <<<html
    <body bgcolor="#EBEBEB">



    <p align="center">[b]<font size="5" color="#FF0000">[i]Picture Manager[/i]</font>[/b]</p>



    <div align="center">
      <table border="1" width="40%" cellspacing="0" cellpadding="0" height="107" bgcolor="#D1D1D1">
        <tr>
          <td width="100%" height="95" valign="middle">
    html;
    echo 
    "[b]<font size='1'>Maximum file size : " $_max_file_size/1000 "KB</font>

    "
    ;
    echo 
    "<form enctype='multipart/form-data' action='?do=upload' method='post'>";
    echo 
    "<input type='hidden' name='MAX_FILE_SIZE' value='" $_max_file_size "'>";
    echo 
    "<font color='#FF0000'><center>Please select a display picture: 
    "
    ;
    //show number of files to select
    For($i=0$i <= $_i-1;$i++)
    {
    echo 
    "<input name='file" $i "' type='file'>";
    }
    echo 
    "<input type='submit' value='Upload File'></center></font>";
    echo 
    "</form>[/b]<p align='center'>[b]<font size='3' color='#FF0000'>[url='main.php']Home[/url]</font>[/b]</p>";
    echo <<<html
       </td>
        </tr>
      </table>
    </div></body>
    html;
    if(
    $_GET['do'] == 'upload')
    {
    //upload all the fields until done
    For($i=0$i <= $_i-1$i++)
    {
    //create a random number
    $_random rand(11000000);
    //actual file name with the random number
    $_file_name =basename($_FILES['file' $i]['name']);
    $actualfilename=basename($_FILES['file' $i]['name']);
    $typeexplode('.',strrev($actualfilename));
    $typestrrev("$type[0].");
    $type=strtolower($type);
    //file with the upload folder
    $target_path $upload_dir.$actualuser."$type";
    if (
    in_array($type,$file_exists)) {
    }
    else {
    echo 
    "Invalid file format";
    exit();
    }
    $userjpg="userdata/avatars/$actualuser".".jpg";
    $usergif="userdata/avatars/$actualuser".".gif";
    if (
    $type='.jpg' and file_exists($usergif)) {
    unlink($usergif);
    }
    elseif (
    $type='.gif' and file_exists($userjpg)) {
    unlink($userjpg);
    }
    //do not upload the 'left blank' fields
    if(basename($_FILES['file' $i]['name']) != '')
    {

    if(
    move_uploaded_file($_FILES['file' $i]['tmp_name'], $target_path))
    {
         
    //uploaded successfuly
        
    $_uploaded=1;
    }
    else
    {
        
    //error uploading
        
    $_error=1;
    }
    }
    else
    {
    $_check=$_check+1;
    }

    }

    //file(s) did upload
    if($_uploaded == '1')
    {
    $_uploaded=0;
    echo 
    "[b]<center>Your picture has been uploaded.</center>[/b]";
    echo (
    "<META HTTP-EQUIV=Refresh CONTENT=\"3; URL=main.php\">");
    }
    //file uploaded?
    if($_error == '1')
    {
    $_error=0;
    echo 
    "[b]There was an error uploading some of the file(s), please try again! Maybe the file size. Maximum file size is " $_max_file_size/1000 "KB
    [/b]"
    ;
    }
    //user selected a file?
    if($_check == $_i)
    {
    $_check=0;
    echo 
    "[b]Select a file first than click 'Upload File'
    [/b]"
    ;
    }
    }
    ?>
    <p align="center">[b]© 2006 Ahsan Mahmood. [url="http://energon.ueuo.com"]Energon[/url][/b]</p>

  6. #6
    Utente di HTML.it L'avatar di telegio
    Registrato dal
    Sep 2001
    Messaggi
    2,592
    questo è il codice che usi?
    perchè tra
    Codice PHP:
    $_i "1"
    qui toglierei le virgolette, è un numero non una stringa, anche se funziona uguale..
    e
    Codice PHP:
    For($i=0$i <= $_i-1;$i++) { echo "<input name='file" $i "' type='file'>"; } 
    in teoria ne stampa solo uno cioè <input name='file0"' type='file'> quindi è pure inutile usarlo per uno solo.. con questo codice puoi fare il "multiupload", usalo..
    poi: che tipo di dominio usi? WIN o LNX? se hai win non puoi fare quello che stai facendo con quelle cartelle..
    poi: immagino tu sia loggato.. la variabile $actualuser è valorizzata?
    la cartella userdata/avatars/$actualuser esiste? ci puoi scrivere dentro..

    questo a una prima occhiata.. non sono andato a vedere se l'upload reale funziona..

  7. #7
    Utente di HTML.it
    Registrato dal
    Mar 2009
    Messaggi
    95
    grz mille per l'aiuto... problema risolto in quanto non avevo impostato il CHMOD 777 anche alle sottocartelle. Ancora grazie!

  8. #8
    Utente di HTML.it
    Registrato dal
    Mar 2009
    Messaggi
    95
    lol ho un altro problema ...quando includo il codice nella sidebar mi esce sto problema:

    Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/soonnets/public_html/sito1/header.php:25) in /home/soonnets/public_html/sito1/userv2/protect.php on line 2

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/soonnets/public_html/sito1/header.php:25) in /home/soonnets/public_html/sito1/userv2/protect.php on line 2

    http://soon92.netsons.org/sito1/index.php

  9. #9
    Utente di HTML.it L'avatar di telegio
    Registrato dal
    Sep 2001
    Messaggi
    2,592
    sicuramente nel file protect.php che includi ci sono degli header, che vanno messi IN ALTO COME PRIMA COSA. se prima di questi header metti del codice, ti da questo errore.

  10. #10
    Utente di HTML.it
    Registrato dal
    Mar 2009
    Messaggi
    95
    grazie lo stesso per la risposta ma ho risolto da solo... ora xò vorrei che mi aiutaste in qst...

    devo far in modo che dopo che una persona si è loggata nella sidebar esca il suo profilo e la parte principale ritorni alla index con le news...

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.