This topic is locked

Event driven page loading (mobile or desktop)

12/31/2019 11:04:40 AM
PHPRunner General questions
M
Mark Kramer author

In a table called " Calls" in the "List page:Before process" event I am trying to get the program to determine if it is mobile or not. If it s mobile then go to list page 1 (list1) if it is desktop go to list page (list).
I can't seem to figure out what is wrong.. No errors are being thrown, All syntax seems correct.. It has me stumpped. Any suggestions would be greatly appreciated. Thank you in advance

Code below:
[size="1"][size="2"]); //clears listpage session var
$isMobile = (bool)pregmatch('#\b(ip(hone|od|ad)|android|opera m(ob|in)i|windows (phone|ce)|blackberry|tablet'.

'|s(ymbian|eries60|amsung)|p(laybook|alm|rofile/midp|laystation portable)|nokia|fennec|htc[\-
]'.

'|mobile|up\.browser|[1-4][0-9]{2}x[1-4][0-9]{2})\b#i', $_SERVER['HTTP_USER_AGENT'] );
if(isMobile())
{

header("http://mypage.com/calls/calls_list.php?page=list1";);

}

else

{

header("http://mypage.com/calls/calls_list.php?page=list";);

}[/size][/size][/size][/size]

S
Steve Seymour 12/31/2019

but should the calls be....
if(isMobile())
{

header("Location: http://mypage.com/calls/calls_list.php?page=list1";);

}

else

{

header("Location: http://mypage.com/calls/calls_list.php?page=list";);

}
https://xlinesoft.com/phprunner/docs/redirect_to_another_page.htm
however, when I call a page I use
....
var page = "the page I want to jump to";

Location.href = page;

M
Mark Kramer author 1/7/2020



but should the calls be....
if(isMobile())
{

header("Location: http://mypage.com/calls/calls_list.php?page=list1";);

}

else

{

header("Location: http://mypage.com/calls/calls_list.php?page=list";);

}
https://xlinesoft.com/phprunner/docs/redirect_to_another_page.htm
however, when I call a page I use
....
var page = "the page I want to jump to";

Location.href = page;



Well I tried again and again using different variations but never could get it to work.. I think I need to look at the isMobile var again, for some reason the code is not executing . Thank you for your suggestion just the same <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=89886&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />

W
wpl 1/8/2020

Mark,
you are assigning the result of your regex to the variable "$isMobile". But then you call the function "isMobile()", which actually is the built-in function "IsMobile()" defined in commonfunctions.php. It throws no error because, in PHP, function names are case-insensitive.
So I think this should read
if($isMobile)
{

header("Location: http://mypage.com/calls/calls_list.php?page=list1";);

}

else

{

header("Location: http://mypage.com/calls/calls_list.php?page=list";);

}