how can I forbid a browser from registering ? i have a stupid mother &%%#$$# who is bugging me with annoying nicks....I want to deny his browser from registering or even entering my lavalair chat...how can i do that ?
Browser
Collapse
X
-
GuestTags: None
-
/*CREATE TABLE `browsers` (
`id` int(11) NOT NULL auto_increment,
`agent` varchar(220) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `agent` (`agent`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
*/
<?php
$link = mysql_connect("localhost", "root", "");
if(!$link)
{ echo "Nu ma pot conecta la serverul SQL" .mysql_error();
}
$_SERVER["HTTP_USER_AGENT"];
$browser = $_SERVER['HTTP_USER_AGENT'];
$select_db = mysql_select_db('bann', $link);
if(!$select_db)
{
echo "nu ma pot conecta la baza de date" .mysql_error();
}
$insert = "INSERT INTO browsers
(agent)
VALUES ('$browser')";
@mysql_query($insert);
$id = mysql_insert_id();
$id_for_delete = $id - 1;
if($id%10 == 0)
{
$query = " DELETE FROM browsers WHERE id < '".$id_for_delete."' ";
@mysql_query($query);
// echo mysql_error();
}
$select_accept = " SELECT * FROM `browsers` WHERE `agent` LIKE '%Nokia6030/2.0 (y4.10) Profile/MIDP-2.0 Configuration/CLDC-1.1%' AND id = '".$id."' ";
$result_accept = mysql_query($select_accept);
if(mysql_num_rows($result_accept))
{
echo 'sometext';
}
else
{
echo "some code";
}
mysql_close();
?>
Comment
-
Code://BLOCK this 1 his SAMSUNG-SGH-X700/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Browser/6.2.3.3.c.1.101 (GUI) MMP/2.0. if(strstr($_SERVER['HTTP_USER_AGENT'], "this 1 his SAMSUNG-SGH-X700/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Browser/6.2.3.3.c.1.101 (GUI) MMP/2.0")) { die("Following recent high abuse of the system, your access has been blocked."); }hope this helpsCode:$sqlthing = mysql_query("SELECT * FROM phdetails WHERE banned='1'"); $browser=(mysql_result($sqlthing,0,"browser")); $ip=(mysql_result($sqlthing,0,"ip")); $host=(mysql_result($sqlthing,0,"host")); $mimetypes=(mysql_result($sqlthing,0,"mimetypes")); $language=(mysql_result($sqlthing,0,"language")); $charset=(mysql_result($sqlthing,0,"charset")); if(($browser=="$HTTP_USER_AGENT") && ($ip=="$REMOTE_ADDR") && ($host=="$hostsnames") && ($mimetypes=="$HTTP_ACCEPT") && ($language=="$HTTP_ACCEPT_LANGUAGE") && ($charset=="$HTTP_ACCEPT_CHARSET")) { echo "Your Device is banned"; } else {
Comment
-
Guest
I think this one work's/*CREATE TABLE `browsers` (
`id` int(11) NOT NULL auto_increment,
`agent` varchar(220) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `agent` (`agent`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
*/
<?php
$link = mysql_connect("localhost", "root", "");
if(!$link)
{ echo "Nu ma pot conecta la serverul SQL" .mysql_error();
}
$_SERVER["HTTP_USER_AGENT"];
$browser = $_SERVER['HTTP_USER_AGENT'];
$select_db = mysql_select_db('bann', $link);
if(!$select_db)
{
echo "nu ma pot conecta la baza de date" .mysql_error();
}
$insert = "INSERT INTO browsers
(agent)
VALUES ('$browser')";
@mysql_query($insert);
$id = mysql_insert_id();
$id_for_delete = $id - 1;
if($id%10 == 0)
{
$query = " DELETE FROM browsers WHERE id < '".$id_for_delete."' ";
@mysql_query($query);
// echo mysql_error();
}
$select_accept = " SELECT * FROM `browsers` WHERE `agent` LIKE '%Nokia6030/2.0 (y4.10) Profile/MIDP-2.0 Configuration/CLDC-1.1%' AND id = '".$id."' ";
$result_accept = mysql_query($select_accept);
if(mysql_num_rows($result_accept))
{
echo 'sometext';
}
else
{
echo "some code";
}
mysql_close();
?>
[/b]
i've created x.php with the php code posted by blackhowk and i've added a link in index.php a link to x.php...when i access it it sais some code...what do i do next ? how do I stop a browser from accessing my chat ?
Comment
-
make this file as bann.php
1. include this page bann.php into chat.php or else (or put the code first on page)
2. edit the bann.php or edit the code in browser zone with your nasty...browser
3.
edit:
{
echo 'sometext'; // or erase.
die ();
}
else
{
echo "some code"; // you dont have access here.
die ();
}
Comment
Comment