APLY-ZONE
Bine ai venit vizitatorule, daca vrei sa ai acces la toate resursele forumului trebuie sa detii un cont. Daca nu detii unul deja iti poti face un cont nou aici : http://aply-zone.forumotion.com/register?agreed=true&step=2

[Tutorial] Setari Cookie Corecte

In jos

[Tutorial] Setari Cookie Corecte

Mesaj Scris de Castana xD la data de Mar Aug 13, 2013 9:27 pm

Sa zicem ca adresa forumului este: http://forum.adresa.com

Setarile cookie ar trebui sa fie asa:
Cookie domain: forum.adresa.com (Puneti si acel punct inainte de numele domeniului!)
Cookie name: cookiename_example (Poti pune si alt nume daca vrei).
Cookie path: / (Nu conteaza URL-ul forumului intodeauna sa fie un "slash")
Cookie Secure: Disabled daca nu folosesti SSH.(SSH wiki)

Schimbare COOKIE SETTINGS ,(The fast way) in caz ca nu stiti cum sa schimbati din ACP.

Copiati acest COD PHP intr-un fisier sa zicem cookies.php ,il incarcati in root-ul forumului alaturi de config.php si apoi il accesati.



Cod:
<?php

/**
*
* @package Cookie and script settings tool
* @copyright (c) 2008 ktuk.net
* @license GPL
*
*/

// Standard definitions/includes
$page_title = 'phpBB3 Cookies';
define('IN_PHPBB', true);
$root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($root_path . 'common.' . $phpEx);

$cookie_data = array();
$server_data = array();
$sent = request_var('sent', '');

$sql = ' SELECT config_value FROM ' . CONFIG_TABLE . "
WHERE config_name = 'cookie_domain'";
$result = $db->sql_query($sql);
$cookie_data[] = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

$sql = ' SELECT config_value FROM ' . CONFIG_TABLE . "
WHERE config_name = 'cookie_name'";
$result = $db->sql_query($sql);
$cookie_data[] = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

$sql = ' SELECT config_value FROM ' . CONFIG_TABLE . "
WHERE config_name = 'cookie_path'";
$result = $db->sql_query($sql);
$cookie_data[] = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

$sql = ' SELECT config_value FROM ' . CONFIG_TABLE . "
WHERE config_name = 'cookie_secure'";
$result = $db->sql_query($sql);
$cookie_data[] = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

$sql = ' SELECT config_value FROM ' . CONFIG_TABLE . "
WHERE config_name = 'force_server_vars'";
$result = $db->sql_query($sql);
$server_data[] = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

$sql = ' SELECT config_value FROM ' . CONFIG_TABLE . "
WHERE config_name = 'script_path'";
$result = $db->sql_query($sql);
$server_data[] = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

$sql = ' SELECT config_value FROM ' . CONFIG_TABLE . "
WHERE config_name = 'server_name'";
$result = $db->sql_query($sql);
$server_data[] = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

$sql = ' SELECT config_value FROM ' . CONFIG_TABLE . "
WHERE config_name = 'server_port'";
$result = $db->sql_query($sql);
$server_data[] = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

$sql = ' SELECT config_value FROM ' . CONFIG_TABLE . "
WHERE config_name = 'server_protocol'";
$result = $db->sql_query($sql);
$server_data[] = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

$cookie_checked = ($cookie_data[3]['config_value']) ? "checked = \"checked\"" : '';
$force_checked = ($server_data[0]['config_value']) ? "checked = \"checked\"" : '';

if (!$sent)
{
print "<html>
<head><title>$page_title</title></head>
<body>
<form action=\"" . $_SERVER['SCRIPT_NAME'] . "\" method=\"post\"
<fieldset>
<table>
<tr><h2>Cookie Settings</h2></tr>
<tr><td>Cookie Domain:</td><td><input type=\"text\" name=\"cookie_domain\" value=\"" . $cookie_data[0]['config_value'] . "\"></td></tr>
<tr><td>Cookie Name:</td><td><input type=\"text\" name=\"cookie_name\" value=\"" . $cookie_data[1]['config_value'] . "\"></td></tr>
<tr><td>Cookie Path:</td><td><input type=\"text\" name=\"cookie_path\" value=\"" . $cookie_data[2]['config_value'] . "\"></td></tr>
<tr><td>Cookie Secure:</td><td><input type=\"checkbox\" name=\"cookie_secure\" value=\"1\" $cookie_checked ></td></tr>
</table>

<table>
<tr><h2>Server Settings</h2></tr>
<tr><td>Force Server Vars:</td><td><input type=\"checkbox\" name=\"force_server_vars\" value=\"1\" $force_checked ></td></tr>
<tr><td>Script Path:</td><td><input type=\"text\" name=\"script_path\" value=\"" . $server_data[1]['config_value'] . "\"></td></tr>
<tr><td>Server Name:</td><td><input type=\"text\" name=\"server_name\" value=\"" . $server_data[2]['config_value'] . "\"></td></tr>
<tr><td>Server Port:</td><td><input type=\"text\" name=\"server_port\" value=\"" . $server_data[3]['config_value'] . "\"></td></tr>
<tr><td>Server Protocol:</td><td><input type=\"text\" name=\"server_protocol\" value=\"" . $server_data[4]['config_value'] . "\"></td></tr>
<tr><td>Submit:</td><td><input type=\"submit\" name=\"sent\" value=\"submit\"></td></tr>
</table>
</fieldset>
</body>
<html>
";
}

if ($sent)
{
$cookie_domain = request_var('cookie_domain', '');
$cookie_name = request_var('cookie_name', '');
$cookie_path = request_var('cookie_path', '');
$cookie_secure = request_var('cookie_secure', 0);
$force_server_vars = request_var('force_server_vars', 0);
$script_path = request_var('script_path', '');
$server_name = request_var('server_name', '');
$server_port = request_var('server_port', 80);
$server_protocol = request_var('server_protocol', 'http://');

$sql = ' UPDATE ' . CONFIG_TABLE . " SET `config_value` = '$cookie_domain' WHERE `config_name` = 'cookie_domain'";
$db->sql_query($sql);
$sql = ' UPDATE ' . CONFIG_TABLE . " SET `config_value` = '$cookie_name' WHERE `config_name` = 'cookie_name'";
$db->sql_query($sql);
$sql = ' UPDATE ' . CONFIG_TABLE . " SET `config_value` = '$cookie_path' WHERE `config_name` = 'cookie_path'";
$db->sql_query($sql);
$sql = ' UPDATE ' . CONFIG_TABLE . " SET `config_value` = '$cookie_secure' WHERE `config_name` = 'cookie_secure'";
$db->sql_query($sql);
$sql = ' UPDATE ' . CONFIG_TABLE . " SET `config_value` = '$force_server_vars' WHERE `config_name` = 'force_server_vars'";
$db->sql_query($sql);
$sql = ' UPDATE ' . CONFIG_TABLE . " SET `config_value` = '$script_path' WHERE `config_name` = 'script_path'";
$db->sql_query($sql);
$sql = ' UPDATE ' . CONFIG_TABLE . " SET `config_value` = '$server_name' WHERE `config_name` = 'server_name'";
$db->sql_query($sql);
$sql = ' UPDATE ' . CONFIG_TABLE . " SET `config_value` = '$server_port' WHERE `config_name` = 'server_port'";
$db->sql_query($sql);
$sql = ' UPDATE ' . CONFIG_TABLE . " SET `config_value` = '$server_protocol' WHERE `config_name` = 'server_protocol'";
$db->sql_query($sql);

print "Settings updated!";
print "<meta http-equiv=\"refresh\" content=\"2;./cookie.php\">";
}

?>



Dupa ce configurati cum trebuie ,da-ti submit si apoi stergeti fisierul din FTP.


Cod:
Sau ACP ==> Tab "General" ==> Server configuration ==> Cookie settings
avatar
Castana xD
Membru
Membru

Mesaje : 54
Puncte : 160
Reputatie : 0
Data de inscriere : 13/08/2013

Vezi profilul utilizatorului

Sus In jos

Re: [Tutorial] Setari Cookie Corecte

Mesaj Scris de SPeeDStriKe la data de Mier Aug 14, 2013 1:07 pm

Multumim !
avatar
SPeeDStriKe
Membru
Membru

Mesaje : 913
Puncte : 994
Reputatie : 13
Data de inscriere : 12/08/2013
Varsta : 23
Localizare : Bucuresti

Vezi profilul utilizatorului http://aply-zone.myfreeforum.ro/profile?mode=editprofile

Sus In jos

Sus


 
Permisiunile acestui forum:
Nu puteti raspunde la subiectele acestui forum