|
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.
|
|
|
|
|
Thank you friend .Can it be integrated with xamp server and should any environmental variables need to be given for the same.
|
|
|
|
|
|
Thank you friend 
|
|
|
|
|
|
Hai Friends
good to see you all..
i am doing one webmail project using php..
for that i need to read mails from that particular email and show it in my inbox..
my question is how to read mails from Cpanel using PHP..
any help will be useful to me..
thank u in advance 
|
|
|
|
|
Do you know where the email actually resides? Is this a linux system or a Windows system? I know for Linux, there are several open source webmail projects, my favorite is Roundcube. If you have your mind set on actually writing it yourself, (again, assuming a Linux server), you would need to be able to parse the mbox files where postfix (I'm assuming you are using postfix) stores email at (/var/spool/mail). I've never done that, but I know you'll need to make sure your web browser (apache?) has permissions to read those files...
Does that help?
|
|
|
|