Visualizzazione risultati 1 fino 4 di 4

Discussione: vbulletin, modifiche script login!

  1. #1
    Guest

    Predefinito vbulletin, modifiche script login!

    Ciao a tutti!
    Ho creato una login box nel mio sito, dentro questa box ci devo inserire il form per il login, questo non è il problema! Il problema è che io voglio che se sono collegato mi dica Benvenuto etc etc...
    Allora provando e riprovando sono arrivato a questo
    Codice HTML:
    <?
    // Inizio codice: Se l'utente ha già effettuato il login
    if ($_SESSION['login'] == "yes")
     ?>
     <div class="Stile5">Hai già effettuato il login. <br /><br />
     <b>Username</b>: <?=$_SESSION['username'];?><br />
     <a href="<?=$urlsito;?>forum/usercp.php">Entra nel pannello di controllo</a><br />
     <a href="<?=$urlsito;?>forum/logout.php">Esegui il logout</a>
     </div><br /><br />
     <?
    //
    // Fine codice: Se l'utente ha già effettuato il login
    //
    
    //
    // Inizio codice: procedura di login
    //
    else {
    ?>
    
    <!-- login form -->
    		<form action="forum/login.php?do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)">
    		<script type="text/javascript" src="forum/clientscript/vbulletin_md5.js?v=373"></script>
    		<table cellpadding="0" cellspacing="3" border="0">
    		<tr>
    			<td class="smallfont" style="white-space: nowrap;"><label for="navbar_username">Username</label></td>
    			<td><input type="text" class="bginput" style="font-size: 11px" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="101" value="Username" onfocus="if (this.value == 'Username') this.value = '';" /></td>
    
    			<td class="smallfont" nowrap="nowrap"><label for="cb_cookieuser_navbar"><input type="checkbox" name="cookieuser" value="1" tabindex="103" id="cb_cookieuser_navbar" accesskey="c" />Ricordami?</label></td>
    		</tr>
    		<tr>
    			<td class="smallfont"><label for="navbar_password">Password</label></td>
    			<td><input type="password" class="bginput" style="font-size: 11px" name="vb_login_password" id="navbar_password" size="10" tabindex="102" /></td>
    			<td><input type="submit" class="button" value="Entra" tabindex="104" title="Inserisci il tuo nomeutente e la tua password negli appositi spazi. Se non possiedi un account clicca sul tasto 'registrazione' per creare un nuovo profilo." accesskey="s" /></td>
    		</tr>
    		</table>
    
    		<input type="hidden" name="s" value="" />
    		<input type="hidden" name="securitytoken" value="" />
    		<input type="hidden" name="do" value="login" />
    		<input type="hidden" name="vb_login_md5password" />
    		<input type="hidden" name="vb_login_md5password_utf" />
    		</form>
    		<!-- / login form -->
    Con questo codice mi da questo errore
    Codice:
    Parse error: syntax error, unexpected T_ELSE in /membri/nokiagames/login.php on line 18
    Non so più cosa fare! Grazie per il vostro aiuto
    Ultima modifica di nokiagames : 27-11-2008 alle ore 20.37.23

  2. #2
    Guest

    Predefinito

    Alla prima IF mancano le graffe.


    Ciao!

  3. #3
    Guest

    Predefinito

    Modifica così
    Codice PHP:
    <?
    // Inizio codice: Se l'utente ha già effettuato il login
    if ($_SESSION['login'] == "yes") {
    ?>
    <div class="Stile5">Hai già effettuato il login. <br /><br />
    <b>Username</b>: <?=$_SESSION['username'];?><br />
    <a href="<?=$urlsito;?>forum/usercp.php">Entra nel pannello di controllo</a><br />
    <a href="<?=$urlsito;?>forum/logout.php">Esegui il logout</a>
    </div><br /><br />
    <?
    //
    // Fine codice: Se l'utente ha già effettuato il login
    //

    //
    // Inizio codice: procedura di login
    //
    } else {
    ?>

    <!-- login form -->
    <form action="forum/login.php?do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)">
    <script type="text/javascript" src="forum/clientscript/vbulletin_md5.js?v=373"></script>
    <table cellpadding="0" cellspacing="3" border="0">
    <tr>
    <td class="smallfont" style="white-space: nowrap;"><label for="navbar_username">Username</label></td>
    <td><input type="text" class="bginput" style="font-size: 11px" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="101" value="Username" onfocus="if (this.value == 'Username') this.value = '';" /></td>

    <td class="smallfont" nowrap="nowrap"><label for="cb_cookieuser_navbar"><input type="checkbox" name="cookieuser" value="1" tabindex="103" id="cb_cookieuser_navbar" accesskey="c" />Ricordami?</label></td>
    </tr>
    <tr>
    <td class="smallfont"><label for="navbar_password">Password</label></td>
    <td><input type="password" class="bginput" style="font-size: 11px" name="vb_login_password" id="navbar_password" size="10" tabindex="102" /></td>
    <td><input type="submit" class="button" value="Entra" tabindex="104" title="Inserisci il tuo nomeutente e la tua password negli appositi spazi. Se non possiedi un account clicca sul tasto 'registrazione' per creare un nuovo profilo." accesskey="s" /></td>
    </tr>
    </table>

    <input type="hidden" name="s" value="" />
    <input type="hidden" name="securitytoken" value="" />
    <input type="hidden" name="do" value="login" />
    <input type="hidden" name="vb_login_md5password" />
    <input type="hidden" name="vb_login_md5password_utf" />
    </form>
    <!-- / login form -->
    <? } ?>

  4. #4
    Guest

    Predefinito

    Citazione Originalmente inviato da debug Visualizza messaggio
    Alla prima IF mancano le graffe.


    Ciao!
    Ho provato ma mi da
    Codice:
    Parse error: syntax error, unexpected '}' in /membri/nokiagames/login.php on line 3

    EDIT:

    stoner sei grande! Ora il probelma è che non mi funziona questo:
    Codice PHP:
    <?
    // Inizio codice: Se l'utente ha già effettuato il login
    if ($_SESSION['login'] == "yes") {
    ?>
    <div class="Stile5">Hai già effettuato il login. <br /><br />
    <b>Username</b>: <?=$_SESSION['username'];?><br />
    <a href="<?=$urlsito;?>forum/usercp.php">Entra nel pannello di controllo</a><br />
    <a href="<?=$urlsito;?>forum/logout.php">Esegui il logout</a>
    </div><br /><br />
    <?
    //
    // Fine codice: Se l'utente ha già effettuato il login
    //

    //
    // Inizio codice: procedura di login
    //
    } else {
    ?>

    EDIT2:
    Ho trovato uno script sul forum ufficiale di vbulletin...
    Ecco il codice dello script
    Codice PHP:
    <?php
    // Edit the lines below to show path to your forums
    $forumpath = "http://nokiagames.altervista.org/forum/";

    // Set the maximum display size for the avatar
    $maxw = 100; // Max thumbnail width
    $maxh = 100; // Max thumbnail height

    // ++++++++++++++++++++++++++++++++++
    // Deluxe vB User login and access control on non vB pages
    // Version 3.00 - March 21st 2008
    // For vB 3.7.x
    // By Bill bill@billspaintball.com
    // ++++++++++++++++++++++++++++++++++


    // ++++++++++++++++++++++++++++++++++
    // You dont have to edit anything underneath here,
    // but you can if you wish to style the login box
    // to match the style of your site.
    // ++++++++++++++++++++++++++++++++++



    // We check if user is logged in
    if ($vbulletin->userinfo['userid']!=0) {


    // ++++++++++++++++++++++++++++++++++
    // display avatar - resize if too big
    // ++++++++++++++++++++++++++++++++++

    $userid=$vbulletin->userinfo['userid'];
    $file = $forumpath."image.php?u=$userid";
    list(
    $width, $height, $type) = getimagesize($file);

    if (
    $width <= $maxw AND $height <= $maxh )// check width and height
    {// if width and height under size display unchanged
    echo "<img src=\"$file\" align=\"center\" border=\"0\">";
    }
    else
    {
    if (
    $width > $maxw)//check if width is too wide
    { // if it is, resize
    $ratio = $width / $maxw; //work out resize ratio
    $newwidth = $maxw; // new width
    $newheight = ($height / $ratio); // new height at this resize
    }
    else
    {
    $newheight = $height; // if width is ok, set this cos we need it later
    $newwidth = $width; // if width was ok, set this cos we ned it later
    }
    If (
    $newheight <= $maxh )
    {
    // if current height is ok, were done.
    }

    else
    // either origional or resized height is too big
    if( $newheight >= $maxh )
    {
    // if resized height is still too big we resize it
    $ratio2 = $newheight / $maxh; //work out resize ratio
    $newheight = $maxh; // give $newheight a new value
    $newwidth = ($newwidth / $ratio2); // new width at this resize
    } // the value of $newwidth has just been changed
    else
    {
    // if were here then origional height is too big so we resize it
    $ratio2 = $newheight / $maxh; //work out resize ratio
    $newheight = $maxh; // give $newheight a new value
    $newwidth = ($newwidth / $ratio2); // new width at this resize
    }

    // now we can finally display resized pic
    echo "<img src=\"$file\" border=\"0\" width = \"$newwidth\" height = \"$newheight\" align=\"center\">"; // display resized pic
    }
    // +++++++++++++++++++++++
    // end avatar display code
    // +++++++++++++++++++++++


    // +++++++++++++++++++++++++++++++++++++++++
    // As Logged in display welcome back message
    // +++++++++++++++++++++++++++++++++++++++++
    echo "Welcome Back, <b>";
    echo
    $vbulletin->userinfo['username'];
    echo
    " !</b><br />";

    // As were logged in display logout link
    echo "<a href=\"".$forumpath."login.php?$session[sessionurl]do=logout&amp;logouthash=$logouthash";
    echo
    $vbulletin->userinfo['logouthash'];
    echo
    "\">";
    echo
    "<font size=\"1\" face=\"verdana\">Log Out</font></a><br />";

    // Display last visit time and date
    echo "You last visited: $pmbox[lastvisitdate] at $pmbox[lastvisittime]";
    echo
    "<br />";

    // Display PM Details and generate link to PM box
    echo "<a href=\"".$forumpath."private.php?$session[sessionurl] \">Private Messages: </a> $vbphrase[unread_x_nav_compiled] $vbphrase[total_x_nav_compiled]";
    echo
    "<br />";

    } else {



    // ++++++++++++++++++++++++++++++++++++++++++
    // If user is not logged in, we do this stuff
    // ++++++++++++++++++++++++++++++++++++++++++

    // Display text and link to register.
    echo "
    You have to <a href=\""
    .$forumpath."register.php?s=$session[sessionhash]\"
    target=\"_parent\"><b>register</b></a> before you can post on our forums or use our advanced features.
    "
    ;

    // Display login boxes + button
    // You can style this with html or CSS as normal if desired.
    echo"
    <form action=\""
    .$forumpath."login.php\" method=post onsubmit=md5hash(vb_login_password,vb_login_md5password,vb_login_md5password_utf)>
    <script type=text/javascript src=\""
    .$forumpath."/clientscript/vbulletin_md5.js\"></script>
    User Name:<br />
    <input name=vb_login_username type=text id=navbar_username onfocus=\"if (this.value == '
    $vbphrase[username]') this.value = '';\" size=10 />

    <br />Password:<br />
    <input name=vb_login_password type=password size=10 />
    </br>

    <label for=cb_cookieuser_navbar><input name=cookieuser type=checkbox id=cb_cookieuser_navbar value=1 checked=checked />
    Remember Me?<br /></label>


    <input type=submit title=
    $vbphrase[enter_username_to_login_or_register] value=\"Log In\" />

    <input type=hidden name=s value=
    $session[sessionhash] />
    <input type=hidden name=do value=login />
    <input type=hidden name=vb_login_md5password />
    <input type=hidden name=vb_login_md5password_utf />

    </form>
    "
    ;
    // +++++++++++++++++++++++++++++++++++++++
    // End of login box for non logged in user
    // +++++++++++++++++++++++++++++++++++++++
    }

    // +++++++++++++++++++++++++++++++++++++++++++++++++++
    // we want do display stats either way so they go here
    // +++++++++++++++++++++++++++++++++++++++++++++++++++

    // get total number of threads and posts
    $getstats = $db->query_read('SELECT threadcount, replycount FROM ' . TABLE_PREFIX . 'forum');
    while (
    $forum = $db->fetch_array($getstats))
    {
    $totthreads += $forum['threadcount'];
    $totposts += $forum['replycount'];
    }
    $totthreads = vb_number_format($totthreads);
    $totposts = vb_number_format($totposts);

    // display total threads and total posts - Uses vB phrases, but change if you like
    echo"<br /> $vbphrase[threads]: $totthreads<br />$vbphrase[posts]: $totposts<br /> ";

    // Only display link and number of new posts if logged in
    if ($vbulletin->userinfo['userid']!=0) {

    // finds number of new posts
    $newposts = $db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "post AS post " . iif($vbulletin->options['threadmarking'], 'LEFT JOIN ' . TABLE_PREFIX . 'threadread AS threadread ON (threadread.threadid = post.threadid AND threadread.userid = ' . $vbulletin->userinfo['userid'] . ')') . " WHERE dateline >= " . $vbulletin->userinfo['lastvisit'] . iif($vbulletin->options['threadmarking'], ' AND dateline > IF(threadread.readtime IS NULL, ' . (TIMENOW - ($vbulletin->options['markinglimit'] * 86400)) . ', threadread.readtime)'));
    $newposts = vb_number_format($newposts['count']);

    echo
    "<a href=\"".$forumpath."search.php?$session[sessionurl]do=getnew\">$vbphrase[new_posts]</a>: $newposts<br />";}
    // end of number of new posts stuff
    ?>
    Mi da questo errore:
    Codice:
    Fatal error: Call to a member function on a non-object in /membri/nokiagames/login_inc.php on line 151
    Se sapete aiutarmi..grazie!
    Ultima modifica di seneca : 27-11-2008 alle ore 22.10.43

Regole di scrittura

  • Non puoi creare nuove discussioni
  • Non puoi rispondere ai messaggi
  • Non puoi inserire allegati.
  • Non puoi modificare i tuoi messaggi
  •