PHP - If condition not working [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
The if condition below is not working
if(!strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') && $task != "view"){
//do something
}
What I am trying to say here is that if not iPhone and if $task not equal to view, then do something.
Currently $task is equal to view but I am not on an iPhone, so I should see the (do something code) I have.
What's wrong with my condition?

Currently $task is equal to view but I am not on an iPhone, so I should see the (do something code) I have.
This means you want want prevent "iPhone" or "view" but what you implement is preventing "iPhone" and "view". Try this:
if(!strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') or $task != "view"){
//do something
}

Related

PHP form doesn't distinguish between a and ǎ [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have a form written in PHP. recently I found out that users can replace a with ǎ (letters with accented letters) and still login without problem, and the form can't distinguish. What is the problem?
( I've heard something about == and ===, but I'm not sure)
P.S: I'm very new to PHP!
This isn't PHP that is poorly doing the comparison:
<?php
echo ('a' == 'ǎ')?"Looks the same!":"Who you kidding?";
echo ('a' === 'ǎ')?"Looks the same!":"Who you kidding?";
?>
OUtput:
Who you kidding?
Who you kidding?
There is some additional work at play here. If the form is being submitted and then handling the information before it passes it back to the rest of your code - you need to look into it in detail. Who knows what else it is changing?
If you have the plugin on your site, you have the code already - just look into what it is doing.

How do I change the Default Design? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have two different web designs(Created in PHP, HTML, CSS and JavaScript) Can I upload both and just switch them from time to time?
How do I redirect so i can choose what design will show when i open my website?
Try with this code :
if(some condition here)
header('Location:design1.php');
else if(some condition here)
header('Location:design2.php');
or you can also use include function.
if(some condition here)
include("design1.php");
else if(some condition here)
include("design2.php");
Thanks.

Replace PHP with text [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have some PHP that displays the users session name in the HTML and if the user is not logged in, then I would like it to display "User" instead.
Can I have an if statement in this case? I tried it myself but I got header errors.
This is what I've tried so far but each practical attempt just spits out more errors at me.
This is a different approach I have tried.
<?=$_SESSION['sess_user'] or ("User");?>!
<?php echo (isset($_SESSION['sess_user']) ? $_SESSION['sess_user'] : "User"); ?>
This will check if the session is set, if it is then echo the session, if it isn't then it will echo "User".

How can i store and fetch.php page in mysql [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have a project in which i have to make a code in which when we click on menu bar and the option that we select in menu bar the page related to that option will display all this is to be done through my sql.Is there any way to do this task.
I don't understand exactly what you want and if there is a better way to do this, but don't put in your sql fields PHP code.
You can create a xml document instead, and use it better.PHP.net - XMLdocument

How to implement an event driven model in PHP? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
How could one build a system using PHP that tracks every event that occurs? Such as when someone comments on something, likes something or changes something.
The only thing that comes to mind right now is by the use of query strings when ever one invokes a command.
Try implementing the Observer pattern.

Categories