|
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?
|
|
|
|
|
Hello frndz.
i am going to develop own web mail system for one of my client.
for that i need ideas to implement.....
any one can tell me the procedure or ideas about how to implement..?
I'll explain the procedure.
the mails want to store in database and when the user logging in the mails want to display like g-mail.
outbox folder to have unsent messages.
drafts folder to have saved messages
sent items folder to have sent messages.
archives folder to have archived items..
ADMIN:
admin can create email id.....the admin only can create email id like c panel.
thank in advance,,,,
any help will be useful to me.. 
modified 13-Dec-11 5:18am.
|
|
|
|
|
I have an admin page which user MUST enter user id and password to get in. The login.php is working fine, it's accepting correct user id and password and rejecting incorrect user id or password but the admin index.pho is not working properly..! it's accepting direct navigation even and not redirecting to the login.php
could you please help..
here is my index.php
<?php
if (isset($_SESSION["status"]) && $_SESSION["status"] != true)
{
header('Location:login.php');
}
?>
and this is my login.php:
<?php
session_start();
error_reporting(E_ALL);
$username = $_POST['username'];
$password = $_POST['password'];
$conn = mysql_connect('mysql.jassimrahma.com', 'jassimxxx', 'xxxxxxx');
$sql = "SELECT * FROM website_admin WHERE website_admin_user_name = '$username' and website_admin_password = '$password'";
mysql_select_db("jassimrahma", $conn) or die(mysql_error());
$result = mysql_query($sql, $conn) or die(mysql_error());
$count = mysql_num_rows($result);
if($count == 1)
{
$db_field = mysql_fetch_assoc($result);
$_SESSION['status'] = true;
$_SESSION['full_name'] = $db_field['website_admin_full_name'];
header("location:index.php");
}
else
{
header("location:login.php");
}
?>
modified 12-Dec-11 4:35am.
|
|
|
|
|
Your index page is checking if the session variable status has been set, and then redirecting only if it has been set to false (or anything except true to be precise).
If that is the whole of your index.php file then the status will never be true, because you haven't called session_start() .
More importantly, $_SESSION["status"] will not be set even if you have been through the login page, so it won't even get to the $_SESSION["status"] != true condition.
If you had not successfully gone through the login page, status would not be set even if you had started the session.
|
|
|
|
|
More importantly, $_SESSION["status"] will not be set even if you have been through the login page, so it won't even get to the $_SESSION["status"] != true condition.
why?
so let me see if I understood..
I changed to this but still the same result:
<?php
session_start();
if (isset($_SESSION["status"]) && $_SESSION["status"] != true)
{
header('Location:login.php');
}
?>
|
|
|
|