|
when I check $_SERVER['HTTP_ACCEPT_LANGUAGE'] on Chrome it gives: "en-GB,en;q=0.8"
any idea what "q=0.8" means?
My logic is impeccable; my arithmetic lets me down.
|
|
|
|
|
It means Microsoft estimates your command of the English language is 80%, which is pretty good actually. More here[^]
|
|
|
|
|
Luc Pattyn wrote: It means Microsoft estimates your command of the English language is 80%
Microsoft? Surely it must be Google Chrome who made the estimate?
...and how does it (dare it!) make that estimate?!?
My logic is impeccable; my arithmetic lets me down.
|
|
|
|
|
You never have tried Google Translate, have you? Google knows zilch about languages.
|
|
|
|
|
You can redirect using user's timezone also..
|
|
|
|
|
Hi,
I am currentlly using this code to populate news from my database. I want to know how can I make the same paging the result with NEXT and PREVIOUS button?
<?php
$conn = mysql_connect('mysql.jassimrahma.com', 'jassimxxxxx', 'xxxxxxx');
mysql_select_db("jassimrahma", $conn);
$result = mysql_query("SELECT news_id, news_title, date_format(created_date, '%d %M %Y') as 'news_date' FROM news ORDER BY created_date DESC, news_id DESC", $conn);
$affected_rows = mysql_num_rows($result);
echo "<table width='100%' cellpadding='3' cellspacing='3'>";
while ($i < $affected_rows)
{
$news_id = mysql_result($result, $i ,"news_id");
$news_title = mysql_result($result, $i ,"news_title");
$created_date = mysql_result($result, $i ,"news_date");
echo "<tr>";
echo "<td align='center' valign='top'>";
echo "<img src='http://www.jassimrahma.com/images/news_arrow.jpg' alt='Jassim.com News' />";
echo "</td>";
echo "<td align='left' valign='top'>";
echo "<a href='http://www.JassimRahma.com/$news_id' target='_blank'>$news_title</a>";
echo "</td>";
echo "</tr>";
$i++;
}
echo "<tr><td align='center' valign='top'></td><td align='left' valign='top'><a href='http://www.JassimRahma.com/news' target='_self'><img src='images/more_news.jpg' alt='Technology News - JassimRahma.com' /></a></td></tr>";
echo "</table>";
?>
|
|
|
|
|
try the link. It might help you
|
|
|
|
|
Hi,
What's the best way to determine the mobile device then redirect to the /mobile?
Regards,
Jassim
|
|
|
|
|
|
|
Detecting if its a mobile device
Please follow the above link. It looks good
but how can I implement it? Do i have to put it in every page? is it possible to put it in one place for the entire application?
|
|
|
|
|
You could do either one of the two.
But I would suggest creating a generic php file with this piece of code in a method. Including that php file in every page and calling that method.
EG:
dection.php <-- contains the check + redirect
Sample index.php:
<?php include_once('detection.php');?>
<!-- rest of document -->
|
|
|
|
|
sorry but need more help plz
that mentioned code will be placed in a separet file.. that's file.. but it will be between tage? right? then followed by the if($mobile === true)?
so is the following code correct?:
<?php
function detect_mobile()
{
$_SERVER[
$mobile_browser =
$agent = strtolower($_SERVER[
if(preg_match(
$mobile_browser++;
if((isset($_SERVER[
$mobile_browser++;
if(isset($_SERVER[
$mobile_browser++;
if(isset($_SERVER[
$mobile_browser++;
$mobile_ua = substr($agent,0,4);
$mobile_agents = array(
);
if(in_array($mobile_ua, $mobile_agents))
$mobile_browser++;
if(strpos(strtolower($_SERVER[
$mobile_browser++;
// Pre-final check to reset everything if the user is on Windows
if(strpos($agent,
$mobile_browser=0;
// But WP7 is also Windows, with a slightly different characteristic
if(strpos($agent,
$mobile_browser++;
if($mobile_browser>0)
return true;
else
return false;
}
$mobile = detect_mobile();
if($mobile === true)
header(
?>
|
|
|
|
|
That would indeed work. If you put the entire function in the external php file and the code below in all files that need the check for mobile devices.
if (detect_mobile()) {
header('Location: blog');
}
Please note though that the redirect that you put in you code would not work as is. You would need to replace the 'blog' part with a URL to the mobile site.
|
|
|
|
|
I am now getting this error:
Parse error: syntax error, unexpected T_VARIABLE in /home/jassimrahma/JassimRahma.com/detection.php on line 4
this is what I put in my index.php 1st line:
<?php
include_once('detection.php');
if (detect_mobile()) {
header('Location: http://m.jassimrahma.com');
}
?>
and detection.php is here:
<?php
function detect_mobile()
{
$_SERVER[
$mobile_browser =
$agent = strtolower($_SERVER[
if(preg_match(
$mobile_browser++;
if((isset($_SERVER[
$mobile_browser++;
if(isset($_SERVER[
$mobile_browser++;
if(isset($_SERVER[
$mobile_browser++;
$mobile_ua = substr($agent,0,4);
$mobile_agents = array(
);
if(in_array($mobile_ua, $mobile_agents))
$mobile_browser++;
if(strpos(strtolower($_SERVER[
$mobile_browser++;
// Pre-final check to reset everything if the user is on Windows
if(strpos($agent,
$mobile_browser=0;
// But WP7 is also Windows, with a slightly different characteristic
if(strpos($agent,
$mobile_browser++;
if($mobile_browser>0)
return true;
else
return false;
}
?>
|
|
|
|
|
|
Put it in the initial page. That is the first page user would open. such as index page or login page.
If it figured out that the client device is mobile save that information to session. As a matter of fact its not a big deal. you dont even need to remember whether it is a mobile device or not. But If the set of functions are different for mobile and pc then you can use the session variable to determine about which function to call.
more over when it would redirect to page allocated for mobile do not put any link to those mobile page that redirect to pc pages
|
|
|
|
|
Please suggest best online resource to learn BackTrack 5's new functionality.
Thanks
|
|
|
|
|
This one[^].
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
How to configure mail in the xampp server. I am new to PHP and learning it . I wish to send emails where should I configure it in Xampp .Thanks in Advance
|
|
|
|
|
You need to configure Mercury Mail Transport System that comes with XAMPP
Loads of blogs available about how to go about doing it... one such blog article is here[^]
Imagination is the one weapon in the war against reality!!!
aniruddhaloya.blogspot.com
|
|
|
|
|
Thank you friend
|
|
|
|
|
Welcome
Hope your email server is up and running
P.S. Please accept the answer (if there is a provision to do so)... will help others to know that the solution works
Imagination is the one weapon in the war against reality!!!
aniruddhaloya.blogspot.com
|
|
|
|
|
Hi Friends,
I am new to php and i m using xampp server to run php .I am using notepad now .I would like to know is there any editor for php .Also I would like to know is it possible to integrate the editor or tool like netbeans with xamp server.Thanks in advance
|
|
|
|
|
There are plenty IDE's and editors out there. You have already said Netbeans. You can also take a look at (1) Notepad++, (2) Aptana, (3) Microsoft Expressions Web, (4) Adobe DreamWeaver, (5) Eclipse. This list is not exhaustive. With the exception of (3) and (4) in my list, the others are free to download and use.
modified 1-Aug-19 21:02pm.
|
|
|
|