"ArcticWolf, post: 87357":.. no errors lol i tried your code on my dev site without changing an thing and it gave invalid pics...... so that is an error... .jpg LOL..... I love it when people have like 2 posts and they "think" they know more the an moderator of an place.............. anyway np tiloup nice to see someone saying thanks for all the stuff I do:)
And default things are used every time you add a new field or drop an existing field to re-add it................. and also when 1st creating an record aka when someone signup or gets an account created...


"flameche, post: 87329":http://devscorner.xyz/uploads/post-38138-0-18445700-1355145413.pnghi, here an alternative way of coding this, for both BROWSER & OS, just use array, its more clean ;) :
run this sql :
ALTER TABLE `users` ADD `browser` varchar(20) NOT NULL;
ALTER TABLE `users` ADD `os` varchar(30) NOT NULL;
in functions.php put this WHERE is the previous code, ... lol :
:) :
then in account.php place where you want to show those up :
$user_agent = $_SERVER['HTTP_USER_AGENT'];
// browser detection
$browser = "Unknown Browser";
$browser_array = array(
'/msie/i' => 'Internet Explorer',
'/firefox/i' => 'Firefox',
'/safari/i' => 'Safari',
'/chrome/i' => 'Chrome',
'/opera/i' => 'Opera',
'/netscape/i' => 'Netscape',
'/maxthon/i' => 'Maxthon',
'/konqueror/i' => 'Konqueror',
'/mobile/i' => 'Handheld Browser'
);
foreach ($browser_array as $regex => $value) {
if (preg_match($regex, $user_agent)) {
$browser = $value;
}
}
// OS detection
$os = "Unknown OS Platform";
$os_array = array(
'/windows nt 6.2/i' => 'Windows 8',
'/windows nt 6.1/i' => 'Windows 7',
'/windows nt 6.0/i' => 'Windows Vista',
'/windows nt 5.2/i' => 'Windows Server 2003/XP x64',
'/windows nt 5.1/i' => 'Windows XP',
'/windows xp/i' => 'Windows XP',
'/windows nt 5.0/i' => 'Windows 2000',
'/windows me/i' => 'Windows ME',
'/win98/i' => 'Windows 98',
'/win95/i' => 'Windows 95',
'/win16/i' => 'Windows 3.11',
'/macintosh|mac os x/i' => 'Mac OS X',
'/mac_powerpc/i' => 'Mac OS 9',
'/linux/i' => 'Linux',
'/ubuntu/i' => 'Ubuntu',
'/iphone/i' => 'iPhone',
'/ipod/i' => 'iPod',
'/ipad/i' => 'iPad',
'/android/i' => 'Android',
'/blackberry/i' => 'BlackBerry',
'/webos/i' => 'Mobile'
);
foreach ($os_array as $regex => $value) {
if (preg_match($regex, $user_agent)) {
$os = $value;
}
}
SQL_Query_exec("UPDATE users SET last_access='" . get_date_time() . "', ip=".sqlesc($ip).", browser=".sqlesc($browser).", os=".sqlesc($os).", page=".sqlesc($where)." WHERE id=" . $row["id"]);
<?php print("<b>".T_("BROWSER").":</b> " . $CURUSER["browser"] . "\n"); ?><br />
<?php print("<b>".T_("OS").":</b> " . $CURUSER["os"] . "\n"); ?><br />
and in account-details.php, place where you want to show those up :
<?php echo T_("BROWSER"); ?>: <?php echo htmlspecialchars($user["browser"]);?><br />
<?php echo T_("OS"); ?>: <?php echo htmlspecialchars($user["os"]);?><br />
EDIT ==> OR if you want to add some icons use this way ( lol coz u'r addicted to pictures ...
<?php echo T_("BROWSER"); ?>: <?php echo htmlspecialchars($user["browser"])." <img src='".$site_config['SITEURL']."/images/browsers/".$user["browser"].".png' width='40' height='40' alt='".$user["browser"]."' title='Detected Browser : ".$user["browser"]."'> ";?><br />
<?php echo T_("OS"); ?>: <?php echo htmlspecialchars($user["os"])." <img src='".$site_config['SITEURL']."/images/oss/".$user["os"].".png' width='40' height='40' alt='".$user["os"]."' title='Detected Operating System : ".$user["os"]."'> ";?><br />
Then, you just have to define the width and height to suits your desire, in my example i put 40 x 40 as you can see,
And google images thoses icons you need and put theme into the corresponding folders :
/images/browsers & /images/oss/
i give you those folders along with 1 pic in each to help you start on this :)
So THIS WAY you really dont need to run another sql request, neither another table in databse, alwasys think about saving your server ressources ...
-------
update your langages files. :)
"MicroMonkey, post: 87332":@Tiloup
my guess is. Because the orginal query didnt set a default browser, so just manually change it to 9 using phpmyadmin or something
ALTER TABLE `users` CHANGE `browser` `browser` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '9'
Quote:It should not even make an query unless its an # of an id:)in theory could use the above persons one also if not wanting an pic LOL, but people like pics hehehe
"ArcticWolf, post: 87315":[size=12px]If posting about "database error" or something along that lines,[/size]
[size=12px]does no good if you dont also add the info from your_siteurl/admincp.php?action=sqlerr[/size]
//$browsers
$res = SQL_Query_exec("SELECT name,browserpic FROM browsers WHERE id=$user[browser] LIMIT 1") or die(mysql_error());
if (mysql_num_rows($res) == 1) {
$arr = mysql_fetch_assoc($res);
$browser = "$arr[name] <img src=images/browser/$arr[browserpic] height=30 width=30 border=0>";
}
else
{
$browser = "<img src=images/browser/unknown.png height=30 width=30 border=0>";
}
"ArcticWolf, post: 87297":cool does $LANG["Q&A"] = "Q&A"; work ??LOL... you know php and & LOL
<a href="uptransfer.php"><b><?php echo T_("DONATE_UPLOAD_CREDITS"); ?></b></a><br />Quote:Sorry I forgot to mantionner who is also a ajoueter index.php (LATEST_TORRENTS) torrents.seedbox, ;)Hi,
All the code is written as.... however, there still does not appear on this icon.
If edit torrent details and there mark seedbox box it works and looks index page... The problem started with the exchange server, the old server, the same code worked perfectly. I do not understand what the problem is...?! Freeleech, silver, double_upload icons works perfectly :wacko:
#======================================================================#
# Add Gigs To Users
#======================================================================#
if($action == "addgigs")
{
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if ($_POST['doit'] == 'yes') {
mysql_query("UPDATE users SET uploaded = uploaded + 2147483648 WHERE status='confirmed'");
stderr("Upload", "2GB upload is sent to everyone...");
die;
}
if ($_POST["username"] == "" || $_POST["gigs"] == "" || $_POST["gigs"] == "")
show_error_msg("Error", "Missing form data.");
$username = sqlesc($_POST["username"]);
$uploaded = sqlesc($_POST["uploaded"]);
$userid = $CURUSER["id"];
$mb_basic=1024*1024;
if(isset($_POST['unit'])){
if ($_POST["unit"] =='1')
$nobits = $gigs*$mb_basic;
if ($_POST["unit"] =='2')
$nobits = $gigs*$mb_basic*1024;
}
$modcom = mysql_fetch_row(SQL_Query_exec("SELECT modcomment FROM users WHERE username=$username LIMIT 1"));
$modcomment = sqlesc(gmdate("Y-m-d") . " - ".$CURUSER['username']." has given ".mksize($nobits)." to this user.n " .$modcom[0]);
mysql_query("UPDATE users SET modcomment = $modcomment, uploaded=uploaded + $nobits WHERE username=$username") or sqlerr(__FILE__, __LINE__);
write_log("$CURUSER[username] has given ".mksize($nobits)." to ".$username."");
$res = SQL_Query_exec("SELECT id FROM users WHERE username=$username");
$arr = mysql_fetch_row($res);
if (!$arr) {
show_error_msg("Error", "Unable to update account.");
}else{
$msg ="$CURUSER[username] has given ".mksize($nobits)." to you";
mysql_query("INSERT INTO messages (sender, receiver, added, subject, msg) VALUES ('0', $arr[0], '" . get_date_time() . "','Add gigs', " . sqlesc($msg) .")");
}
header("Location: $site_config[sITEURL]/account-details.php?id=$arr[0]");
die;
}
stdhead("Update Users Upload Amounts");
navmenu();
begin_frame("Update Users Uploaded Amounts",false,10,false);
echo "<form method="post" action="admincp.php?action=addgigs">";
?>
<center><font color=red size=2><b>To add gigs put in the user's name and amount then choose MB for megabytes or GB for gigabytes.</b></font></center>
<p align=center><table border=0 width=100% cellspacing=0 cellpadding=0>
<?php
$res = SQL_Query_exec("SELECT username FROM users ORDER BY username");
$pseudo = "<select name="username">n";
while ($arr = mysql_fetch_assoc($res))
$pseudo .= "<option value="$arr[username]">$arr[username]</option>n";
$pseudo .= "</select>n";
?>
<tr>
<td class="rowhead"><b>User name</b></td>
<td class="row1"><?php echo $pseudo;?></td>
</tr>
<tr><td class="rowhead"><b>Amount</b></td><td class="row1"><input type="text" name="gigs" size="5"/><select name=unit><option value=1>MB</option><option value=2>GB</option></td></tr>
<tr><td colspan="2" class="row1" align="center"><input type="submit" value="Okay" class="btn"/></td></tr>
</table>
</form>
<?
end_frame();
stdfoot();
}
#======================================================================#
# End Add Gigs To Users
#======================================================================# $dispname .= "<img src='images/new_torrent.png' border='0' title='".T_("NEW")."' />";Add if ($row["seedbox"] == "yes")
$dispname .= " <img src='images/seedbox.png' title='Torrent flow raise!' border='0' alt='' />";
Open index.php
Search..
torrents.freeleech,
Add after
torrents.seedbox,
<td align="center"><a href="admincp.php?action=adduser"><img src="images/admin/adduser.png" border="0" width="32" height="32"><br/><?php echo T_("ADD_USER"); ?></a><br/></td>