Visualizzazione risultati 1 fino 11 di 11

Discussione: Login del forum col sito

  1. #1
    Guest

    Predefinito Login del forum col sito

    ok ho un box login sul mio sito però quando logga port alla home del forum,mentre io voglio ke il login porti alla home del sito ecco il codice che ho usato ma non funziona codice:


    Codice:
    <?php
    $me= "http://www.skatekool.altervista.org".$PHP_SELF; //nome di questo file
    define('IN_PHPBB', true);
    $phpbb_root_path = 'community/'; // MODIFICARE IN ACCORDO ALLA PROPRIA INSTALLAZIONE
    include($phpbb_root_path . 'extension.inc');
    include($phpbb_root_path . 'common.'.$phpEx);

    //
    // Start session management
    //
    $userdata = session_pagestart($user_ip, PAGE_INDEX);
    init_userprefs($userdata);
    //
    // End session management
    //
    ?>
    <html>
    <head>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
    <META NAME="ROBOTS" CONTENT="follow,index">
    <META HTTP-EQUIV="Content-Language" CONTENT="it">
    <META NAME="Description" CONTENT="skatekool site il portale sullo skateboard calabrese,foto tryks,e community on line">
    <META NAME="Keywords"CONTENT="skatekool,skateboard,skate boarding,videogames,skating,foto skate,video skate,portale skateboard,reggio calabria,skate reggio calabria,mini,tryks,ollie,flip,grind,slide,yeah right,360°flip">
    <META NAME="Author" CONTENT="Dimitri Schiavone">
    <META HTTP-EQUIV="Reply-to" CONTENT="dimischiavone@hotmail.it">
    <META NAME="Cenerator" CONTENT="Dimitri Schiavone">
    <META NAME="Creation_Date" CONTENT="03/17/2005">
    <TITLE>skatekool site</TITLE></HEAD>
    <link rel="stylesheet" href="style.css">
    <style type="text/css">
    </style>
    <script language="JavaScript1.2">
    function high(which2){
    theobject=which2
    highlighting=setInterval("highlightit(theobject)", 50)
    }
    function low(which2){
    clearInterval(highlighting)
    if (which2.style.MozOpacity)
    which2.style.MozOpacity=0.3
    else if (which2.filters)
    which2.filters.alpha.opacity=30
    }
    function highlightit(cur2){
    if (cur2.style.MozOpacity<1)
    cur2.style.MozOpacity=parseFloat(cur2.style.MozOpa city)+0.1
    else if (cur2.filters&&cur2.filters.alpha.opacity<100)
    cur2.filters.alpha.opacity+=10
    else if (window.highlighting)
    clearInterval(highlighting)
    }
    </script>
    </head>
    <body bgcolor="#000000" topmargin="0" bottommargin="0">
    <table width="750" border="0" align="center" cellpadding="0" cellspacing="0" style="border: 1px solid #0000FF">
    <tr>
    <td width="12" background="images/02.gif"><img src="images/02.gif" width="12" height="3"></td>
    <td height="26" colspan="3" background="images/01.gif">&nbsp;</td>
    <td width="12" background="images/02.gif"><img src="images/02.gif" width="12" height="3"></td>
    </tr>
    <tr>
    <td background="images/02.gif">&nbsp;</td>
    <td height="26" colspan="3" background="images/headerbg.jpg"><img src="images/logo.jpg" width="270" height="80"></td>
    <td background="images/02.gif">&nbsp;</td>
    </tr>
    <tr>
    <td background="images/02.gif">&nbsp;</td>
    <td width="178"><img src="images/03.jpg" width="178" height="21"></td>
    <td width="453" background="images/07.jpg"><img src="images/05.jpg" width="453" height="21"></td>
    <td width="241" background="images/07.jpg"></td>
    <td background="images/02.gif">&nbsp;</td>
    </tr>
    <tr>
    <td background="images/02.gif">&nbsp;</td>
    <td><img src="images/04.jpg" width="178" height="20"></td>
    <td valign="top" background="images/06.jpg" style="background-repeat : no-repeat;
    background-position : left;"><a href="#">[.:Link:.]</a>|<a href="#">[.:Link:.]</a>|<a href="#">[.:Link:.]</a>|<a href="#">[.:Link:.]</a>|<a href="#">[.:Link:.]</a>|<a href="#">[.:Link:.]</a>|<a href="#">[.:Link:.]</a></td>
    <td></td>
    <td background="images/02.gif">&nbsp;</td>
    </tr>
    <tr>
    <td background="images/02.gif">&nbsp;</td>
    <td align="center" valign="top"><table width="165" height="101" border="0" cellpadding="0" cellspacing="0" style="border: 1px solid #0000FF">

    <tr>
    <td height="12" width="165" align="left" valign="top" background="images/03.gif" ><span class="style5">[.:Men&ugrave;:.]</span></td>
    </tr>
    <tr>
    <td width="165" height="68" align="left" valign="top">
    <ul>
    <li class="style5"><a href="#">.:Link</a> </li>
    <li class="style5"><a href="#">.:Link</a></li>
    <li class="style5"><a href="#">.:Link</a></li>
    <li class="style5"><a href="#">.:Link</a> </li>
    </ul></td>
    </tr>
    <tr>
    <td height="12" align="left" valign="top" background="images/03.gif"></td>
    </tr>
    </table>
    <br> <table width="165" height="142" border="0" cellpadding="0" cellspacing="0" style="border: 1px solid #999999">

    <tr>
    <tr>
    <td height="12" width="165" align="left" valign="top" background="images/03.gif" ><span class="style5">[.:Login:.]</span></td>
    </tr>
    <td width="165" height="68" align="left" valign="top">
    <font color="#000099"><form action="http://www.skatekool.altervista.org/community/login.php" method="post">
    Utente:<input type="text" name="username" size="12">
    Password:<input type="password" name="password" size="12">
    <?php
    print "<input type=\"hidden\" name=\"redirect\" value=\"$me\">";
    ?>
    <input type="submit"name="Login">
    </form>
    </font></td>
    </tr>
    <tr>
    <td width="165" height="115" align="left" valign="top">&nbsp;</td>
    </tr>
    <tr>
    <td height="12" align="left" valign="top" background="images/03.gif"></td>
    </tr>
    </table> <br>
    <table width="165" height="106" border="0" cellpadding="0" cellspacing="0" style="border: 1px solid #0000FF">

    <tr>
    <td height="12" width="165" align="left" valign="top" background="images/03.gif" ><span class="style5">[.:Credits:.]</span></td>
    </tr>
    <tr>
    <td width="165" height="77" align="center" valign="top"><a href="http://skatekool.altervista.org/index.htm" target="_blank"><img src="../../links/vnw.gif" width="88" height="31" border="0" style="filter:alpha(opacity=30);-moz-opacity:0.3" onMouseOver="high(this)" onMouseOut="low(this)"></a></td>
    </tr>
    <tr>
    <td height="12" align="left" valign="top" background="images/03.gif"></td>
    </tr>
    </table></td>
    <td colspan="2" align="center" valign="top"><table width="98%" height="237" border="0" cellpadding="0" cellspacing="0" style="border: 1px solid #999999">

    <tr>
    <td height="12" align="left" valign="top" background="images/03.gif" class="style5" >[.:Contenuti:.]</td>
    </tr>
    <tr>
    <td height="223" valign="top"><p>sito in costruzione</td>
    </tr>
    <tr>
    <td height="12" align="left" valign="top" background="images/03.gif"></td>
    </tr>
    </table><br><table width="98%" height="105" border="0" cellpadding="0" cellspacing="0" style="border: 1px solid #0000FF">

    <tr>
    <td height="12" align="left" valign="top" background="images/03.gif" ><div align="left"><span class="style5">[.:Contenuti:.]</span></div></td>
    </tr>
    <tr>
    <td height="79"><p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p></td>
    </tr>
    <tr>
    <td height="12" align="left" valign="top" background="images/03.gif"></td>
    </tr>
    </table></td>
    <td background="images/02.gif">&nbsp;</td>
    </tr>
    <tr>
    <td background="images/02.gif">&nbsp;</td>
    <td height="26" colspan="3">&nbsp;</td>
    <td background="images/02.gif">&nbsp;</td>
    </tr>
    <tr>
    <td background="images/02.gif">&nbsp;</td>
    <td height="26" background="images/footer01.gif">&nbsp;</td>
    <td height="26" colspan="2" background="images/footer01.gif"><div align="right"><a href="http://skatekool.altervista.org/index.htm"><img src="images/footer02.gif" width="277" height="29" border="0"></a></div></td>
    <td background="images/02.gif">&nbsp;</td>
    </tr>
    </table>
    </body>
    </html>



    come mai non funziona il redirect però i miei amici dicono che il codice pare giusto grazi e ciao a tutti http:/skatekool.altervista.org
    mi dice anke invia query al posto di login perke????
    grazie ciao

  2. #2
    Guest

    Predefinito

    Forse e' solo un'errore di digitazione qua nel tuo post, ma la riga:

    <input type="submit"name="Login">

    dovrebbe contenere uno spazio tra "submit" e name:

    <input type="submit" name="Login">

    Se invece ce l'hai anche nel tuo script, potrebbe essere la soluzione?

  3. #3
    Guest

    Predefinito

    allora... devi modificare il file login.php del forum, e sostituire tutti gli index.$ext (mi pare di ricordare che si chiami così la viariabile...) con nomepaginaacuivuoiindirizzare.ext

    todo chiaro ? :)

  4. #4
    Guest

    Predefinito

    ok grazie ci provo

  5. #5
    Guest

    Predefinito

    redirect(append_sid("index.$phpEx", true));

    questo dici?

  6. #6
    Guest

    Predefinito

    codice:
    <?php

    $db_hostname = "localhost";
    $db_username = "username";
    $db_password = "password";
    $db_name = "my_database";

    $dbcon = mysql_connect($db_hostname, $db_username, $db_password);
    mysql_select_db("$db_name");



    $login = " <p><span class=\"genmed\">
    <form action=\"forum/login.php\" method=\"post\">
    <input value=\"../index.php\" name=\"redirect\" type=\"hidden\">
    Username:<br /><input size=\"15\" name=\"username\" type=\"text\" class=\"post\"><br />
    Password:<br /><input size=\"15\" name=\"password\" type=\"password\" class=\"post\"><br />
    <br />
    <input value=\"ON\" name=\"autologin\" type=\"hidden\">
    <input value=\"Login\" name=\"login\" class=\"mainoption\" type=\"submit\"></form><br /><br />
    <a class=\"gensmall\" href=\"forum/profile.php?mode=sendpassword\">Ho dimenticato la password</a><br />
    <br />
    Non hai ancora un account?<br />
    Ti puoi <a href=\"forum/profile.php?mode=register\">registrare</a> gratuitamente</span>
    </span></p>\n";



    if (isset($HTTP_COOKIE_VARS[tfkbb2log_sid])) {

    $session_id = $HTTP_COOKIE_VARS[tfkbb2log_sid];


    $query = "SELECT session_id, session_user_id, session_logged_in FROM bb_sessions WHERE session_id='$session_id'";
    $result = mysql_query($query, $dbcon);
    $row = mysql_fetch_array($result);


    if ($session_id === $row[session_id]) {


    if ($row[session_logged_in] == "1") {
    $query2 = "SELECT username FROM bb_users WHERE user_id='$row[session_user_id]'";
    $result2 = mysql_query($query2, $dbcon);
    $row2 = mysql_fetch_array($result2);

    echo "Benvenuto $row2[username]";

    }
    else {
    echo $login;
    }
    }
    else {
    echo $login;
    }
    }
    else {
    echo $login;
    }
    ?>





    leggendo la guida su how to una cosa per l'autore mytolhogy
    dopo il login io torno in home del mio sito ma nn appare cio dimischiavon ecc....
    riappare il form di login


    un altra cosa l etabelle da me nn sono bb_users
    ma phpBB_

    lo provate e ca,mbiare ma nn af vedere come loggato sul sito ma mentre nel forum apapre loggato come faccio?

  7. #7
    Guest

    Predefinito

    quando l'ho fatto io per un sito, nel menù del mio sito, avevo inserito questo codice

    Codice:
    define('IN_PHPBB', true);
    $phpbb_root_path = './';
    include($phpbb_root_path . 'extension.inc');
    include($phpbb_root_path . 'common.'.$phpEx);
    //
    // Start session management
    //
    $userdata = session_pagestart($user_ip, PAGE_INDEX);
    init_userprefs($userdata);
    //
    // End session management
    //
    
    
    
    
    
    if ( !$userdata['session_logged_in'] )
    {
    	$template->assign_block_vars('switch_user_logged_out', array());
    }
    else
    {
    	$template->assign_block_vars('switch_user_logged_in', array());
    
    }
    define('SHOW_ONLINE', true);
    $template->set_filenames(array(
    	'body' => 'portal_body.tpl')
    );
    
    //
    // Avatar On Index MOD
    //
    $avatar_img = '';
    if ( $userdata['user_avatar_type'] && $userdata['user_allowavatar'] )
    {
    	switch( $userdata['user_avatar_type'] )
    	{
    		case USER_AVATAR_UPLOAD:
    			$avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
    			break;
    		case USER_AVATAR_REMOTE:
    			$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
    			break;
    		case USER_AVATAR_GALLERY:
    			$avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
    			break;
    	}
    }
    
    
    // Check For Anonymous User
    if ($userdata['user_id'] != '-1')
    {
    	$welcome = "Bentornato";
    	$name_link = "<b>".$userdata['username']."</b>";
    	$u_login_logout = 'login.'.$phpEx.'?logout=true&amp;sid=' . $userdata['session_id'];
    }
    else
    {
    		$welcome = "Benvenuto";
    	$name_link = $lang['Guest'];
    }
    //
    // END: Avatar On Index MOD
    //
    $uffa = $userdata['user_id'];
    $richesta = mysql_query("SELECT * FROM user WHERE id = $uffa ") or die(mysql_error());
    $poba = mysql_fetch_array($richesta);
    if ($poba[level] == 1) {
        $livello = "amministratore";
    }else {
    $livello = "";
    }
    
    
    $template->assign_vars(array(
    	'WELCOME_TEXT' => $welcome,
    	'U_NAME_LINK' => $name_link,
      'U_PORTAL' => append_sid("portal.$phpEx?g=main"),	
      'U_SEND_PASSWORD' => append_sid("profile.$phpEx?mode=sendpassword"),
      'U_LOGIN_LOGOUT' => append_sid($u_login_logout),
      'PROFILO_FORUM' => append_sid("profile.$phpEx?mode=editprofile&amp;" . $userdata['user_id']),
      'PROFILO' => "?g=profilo&id=$userdata[user_id]",
      'REGISTRATI' => "?g=registrati",
      'FOTO' => "?g=foto&id=$userdata[user_id]",
      'VIEW_PROFILO' => "?g=user&id=$userdata[user_id]",
    	'AVATAR_IMG' => $avatar_img,
    	'LIVELLO' => $livello)
    );
    
    if( $userdata['session_logged_in'] )
    {
    	$sql = "SELECT COUNT(post_id) as total
    			FROM " . POSTS_TABLE . "
    			WHERE post_time >= " . $userdata['user_lastvisit'];
    	$result = $db->sql_query($sql);
    	if( $result )
    	{
    		$row = $db->sql_fetchrow($result);
    		$lang['Search_new'] = $lang['Search_new'] . "&nbsp;(" . $row['total'] . ")";
    	}
    }
    
    $template->pparse('body');
    poi, nella dir /templates/nomedelthema/ ho iserito un file portalbody.tpl con questo codice

    Codice:
    <table width="100%" cellspacing="0" cellpadding="0" border="0" align="center">
    
    		   <tr>
    			<td class="catHead" height="25" align="center"><span class="genmed">{WELCOME_TEXT}&nbsp;{U_NAME_LINK}</span></td>
    		   </tr>
    
      <tr>
    	<td valign="top">
    <!-- BEGIN switch_user_logged_in -->
    		  <table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
    		   <tr><td>
    
    				<span class="gensmall"><center><br />{AVATAR_IMG}</center>
    		   </td>		   </tr>
    		   <tr>
    		   <td>&nbsp;</td>
    		   </tr>
    		   <tr>
    		   <td><a href="{PROFILO}" class="gensmall">Edita il Profilo</a><br>
    		   <a href="{VIEW_PROFILO}" class="gensmall">Guarda il Profilo</a><br>
    		   <a href="{PROFILO_FORUM}" class="gensmall">Dati del forum</a><br>
    		   <a href="{FOTO}" class="gensmall">Le mie foto</a><br>
    		   <a href="{U_LOGIN_LOGOUT}" class="gensmall">Logout</a><br>
    		   {LIVELLO}
    		   </td>
    		   </tr>
    		    </table>
    
    
    				<!-- END switch_user_logged_in -->
    
    		<!-- BEGIN switch_user_logged_out -->
    		<form method="post" action="login.php">
    		  <table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
    		   <tr> 
    			<td class="row1"><span class="gensmall" style="line-height=150%">
    			<input type="hidden" name="redirect" value="{U_PORTAL}" />
    			Utente:<br /><input class="unnamed1" type="text" name="username" size="20" /><br />
    			Password:<br /><input class="unnamed1" type="password" name="password" size="20" /><br />
    			<input class="text" type="checkbox" name="autologin" />&nbsp;Ricordami<br/>
    			<input type="submit" class="unnamed1" name="login" value="Login" /><br /><br /><a href="{U_SEND_PASSWORD}" class="gensmall">Hai perso la password?</a><br /><a href="{REGISTRATI}" class="gensmall">Registrati ora!!</A><br />&nbsp;</span></td>
    		   </tr>
    
    		  </table>
    		</form>
    		<!-- END switch_user_logged_out -->
    
    </td></tr></table>
    ed infine, ho aperto il file login.php e seguito questa procedura

    Codice:
    #
    #-----[ OPEN ]------------------------------------------
    #
    login.php
    
    #
    #-----[ FIND ]-----------------------------------
    #
    redirect(append_sid("index.$phpEx", true));
    
    #
    #-----[ REPLACE WITH ]---------------------------
    #
    redirect(append_sid("portal.$phpEx", true));
    
    #
    #-----[ FIND ]-----------------------------------
    #
    $url = ( !empty($HTTP_POST_VARS['redirect']) ) ? $HTTP_POST_VARS['redirect'] : "index.$phpEx";
    
    #
    #-----[ REPLACE WITH ]---------------------------
    #
    $url = ( !empty($HTTP_POST_VARS['redirect']) ) ? $HTTP_POST_VARS['redirect'] : "portal.$phpEx";
    
    #
    #-----[ FIND ]-----------------------------------
    #
    redirect(append_sid("index.$phpEx", true));
    
    #
    #-----[ REPLACE WITH ]---------------------------
    #
    redirect(append_sid("portal.$phpEx", true));
    
    #
    #-----[ FIND ]-----------------------------------
    #
    $url = ( !empty($HTTP_POST_VARS['redirect']) ) ? $HTTP_POST_VARS['redirect'] : "index.$phpEx";
    
    #
    #-----[ REPLACE WITH ]---------------------------
    #
    $url = ( !empty($HTTP_POST_VARS['redirect']) ) ? $HTTP_POST_VARS['redirect'] : "portal.$phpEx";
    
    #
    #-----[ FIND ]-----------------------------------
    #
    redirect(append_sid("index.$phpEx", true));
    
    #
    #-----[ REPLACE WITH ]---------------------------
    #
    redirect(append_sid("portal.$phpEx", true));
    ovvero ho sostituito tutti gli index.$phpEx con portal.$phpEx (che è la pagina a cui volevo venissero reindirizzati dopo il login)

    spero di esserti stato d'aiuto

  8. #8
    Guest

    Predefinito

    ok ci sono riuscito con l'aiuto di un amoco am come si fa a redirezionare alla home anke dopo il log out?

  9. #9
    Guest

    Predefinito

    sempre dal file login.php :P

    devi modificare tutti i campi sopraddetti..

  10. #10
    Guest

    Predefinito

    si ma io la home del sito non l'ho messa come file index.tpl perciò se modifico gli index.$phpEx non cambia niente giusto però dopo il login il redirezionamento lo fa

  11. #11
    Guest

    Predefinito

    la pagina a cui vuoi reindirizzare ...come si chiama ? nel mio caso era portal.php , quindi ho sostituito tutti i index.$phpEx con portal.$phpEx

    todo chiaro ? ;)

Regole di scrittura

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