ankitjain28may /
openchat
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
|||||||||||
| 2 | ||||||||||||
| 3 | require_once (__DIR__ . '/vendor/autoload.php'); |
|||||||||||
| 4 | require_once (__DIR__ . '/config/database.php'); |
|||||||||||
| 5 | use ChatApp\User; |
|||||||||||
| 6 | use ChatApp\Profile; |
|||||||||||
| 7 | use ChatApp\Session; |
|||||||||||
| 8 | ||||||||||||
| 9 | $user = explode("/", $_SERVER['REQUEST_URI']); |
|||||||||||
| 10 | $user = $user[count($user)-1]; |
|||||||||||
| 11 | $userId = Session::get('start'); |
|||||||||||
| 12 | if($userId != null and $user == "account.php") |
|||||||||||
|
0 ignored issues
–
show
|
||||||||||||
| 13 | { |
|||||||||||
| 14 | $obUser = new User(); |
|||||||||||
| 15 | $row = $obUser->UserDetails($userId, True); |
|||||||||||
| 16 | ||||||||||||
| 17 | if($row != NULL) |
|||||||||||
| 18 | { |
|||||||||||
| 19 | $location = URL . "/account.php/". $row['username']; |
|||||||||||
| 20 | header("Location:".$location); |
|||||||||||
| 21 | } |
|||||||||||
| 22 | } |
|||||||||||
| 23 | elseif ($user != "account.php") |
|||||||||||
| 24 | { |
|||||||||||
| 25 | $obUser = new User(); |
|||||||||||
| 26 | $row = $obUser->UserDetails($user, False); |
|||||||||||
| 27 | if($row != NULL): |
|||||||||||
| 28 | $userId = $row['login_id']; |
|||||||||||
| 29 | $details = Profile::getProfile($userId); |
|||||||||||
| 30 | if($details != NULL) |
|||||||||||
| 31 | $row = array_merge($row, $details); |
|||||||||||
| 32 | else |
|||||||||||
| 33 | header("Location:".URL."/error.php"); |
|||||||||||
| 34 | ?> |
|||||||||||
| 35 | ||||||||||||
| 36 | <!Doctype html> |
|||||||||||
| 37 | <html> |
|||||||||||
| 38 | <head> |
|||||||||||
| 39 | <title>OpenChat || Profile</title> |
|||||||||||
| 40 | <link rel="stylesheet" href="../css/profile.css"> |
|||||||||||
| 41 | </head> |
|||||||||||
| 42 | <body> |
|||||||||||
| 43 | ||||||||||||
| 44 | <div class="header"> |
|||||||||||
| 45 | <a id="brand" href="">OpenChat</a> |
|||||||||||
| 46 | <ul class="nav-right"> |
|||||||||||
| 47 | <li><a href="../index.php">About</a></li> |
|||||||||||
| 48 | <?php if(Session::get('start') != null): ?> |
|||||||||||
| 49 | <li><a href="../message.php">Message</a></li> |
|||||||||||
| 50 | <li><a href="../logout.php">Log out</a></li> |
|||||||||||
| 51 | <?php else: ?> |
|||||||||||
| 52 | <li><a href="../login.php">Login</a></li> |
|||||||||||
| 53 | <li><a href="../register.php">Register</a></li> |
|||||||||||
| 54 | <?php endif; ?> |
|||||||||||
| 55 | </ul> |
|||||||||||
| 56 | </div> |
|||||||||||
| 57 | ||||||||||||
| 58 | <div class="main"> |
|||||||||||
| 59 | <div class="boxx" > |
|||||||||||
| 60 | ||||||||||||
| 61 | <div class="pic"> |
|||||||||||
| 62 | <img src="../assests/ankit.png"> |
|||||||||||
| 63 | </div> |
|||||||||||
| 64 | ||||||||||||
| 65 | <div class="brief"> |
|||||||||||
| 66 | <h1 id="name">Name: <?php echo $row['name']; ?></h1><br> |
|||||||||||
| 67 | <?php foreach ($row as $key => $value) { |
|||||||||||
| 68 | if($key =='username' and $value != null) |
|||||||||||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Using logical operators such as
and instead of && is generally not recommended.
PHP has two types of connecting operators (logical operators, and boolean operators):
The difference between these is the order in which they are executed. In most cases,
you would want to use a boolean operator like Let’s take a look at a few examples: // Logical operators have lower precedence:
$f = false or true;
// is executed like this:
($f = false) or true;
// Boolean operators have higher precedence:
$f = false || true;
// is executed like this:
$f = (false || true);
Logical Operators are used for Control-FlowOne case where you explicitly want to use logical operators is for control-flow such as this: $x === 5
or die('$x must be 5.');
// Instead of
if ($x !== 5) {
die('$x must be 5.');
}
Since // The following is currently a parse error.
$x === 5
or throw new RuntimeException('$x must be 5.');
These limitations lead to logical operators rarely being of use in current PHP code. Loading history...
|
||||||||||||
| 69 | echo '<p>Username: '.$row["username"] .'</p><br>'; |
|||||||||||
| 70 | if($key == 'email' and $value != null) |
|||||||||||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Using logical operators such as
and instead of && is generally not recommended.
PHP has two types of connecting operators (logical operators, and boolean operators):
The difference between these is the order in which they are executed. In most cases,
you would want to use a boolean operator like Let’s take a look at a few examples: // Logical operators have lower precedence:
$f = false or true;
// is executed like this:
($f = false) or true;
// Boolean operators have higher precedence:
$f = false || true;
// is executed like this:
$f = (false || true);
Logical Operators are used for Control-FlowOne case where you explicitly want to use logical operators is for control-flow such as this: $x === 5
or die('$x must be 5.');
// Instead of
if ($x !== 5) {
die('$x must be 5.');
}
Since // The following is currently a parse error.
$x === 5
or throw new RuntimeException('$x must be 5.');
These limitations lead to logical operators rarely being of use in current PHP code. Loading history...
|
||||||||||||
| 71 | echo '<p>Email Id: '.$row["email"] .'</p><br>'; |
|||||||||||
| 72 | if($key == 'status' and $value != null) |
|||||||||||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Using logical operators such as
and instead of && is generally not recommended.
PHP has two types of connecting operators (logical operators, and boolean operators):
The difference between these is the order in which they are executed. In most cases,
you would want to use a boolean operator like Let’s take a look at a few examples: // Logical operators have lower precedence:
$f = false or true;
// is executed like this:
($f = false) or true;
// Boolean operators have higher precedence:
$f = false || true;
// is executed like this:
$f = (false || true);
Logical Operators are used for Control-FlowOne case where you explicitly want to use logical operators is for control-flow such as this: $x === 5
or die('$x must be 5.');
// Instead of
if ($x !== 5) {
die('$x must be 5.');
}
Since // The following is currently a parse error.
$x === 5
or throw new RuntimeException('$x must be 5.');
These limitations lead to logical operators rarely being of use in current PHP code. Loading history...
|
||||||||||||
| 73 | echo '<p>Status: '.$row["status"] .'</p><br>'; |
|||||||||||
| 74 | if($key == 'education' and $value != null) |
|||||||||||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Using logical operators such as
and instead of && is generally not recommended.
PHP has two types of connecting operators (logical operators, and boolean operators):
The difference between these is the order in which they are executed. In most cases,
you would want to use a boolean operator like Let’s take a look at a few examples: // Logical operators have lower precedence:
$f = false or true;
// is executed like this:
($f = false) or true;
// Boolean operators have higher precedence:
$f = false || true;
// is executed like this:
$f = (false || true);
Logical Operators are used for Control-FlowOne case where you explicitly want to use logical operators is for control-flow such as this: $x === 5
or die('$x must be 5.');
// Instead of
if ($x !== 5) {
die('$x must be 5.');
}
Since // The following is currently a parse error.
$x === 5
or throw new RuntimeException('$x must be 5.');
These limitations lead to logical operators rarely being of use in current PHP code. Loading history...
|
||||||||||||
| 75 | echo '<p>Education: '.$row["education"] .'</p><br>'; |
|||||||||||
| 76 | if($key == 'gender' and $value != null) |
|||||||||||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Using logical operators such as
and instead of && is generally not recommended.
PHP has two types of connecting operators (logical operators, and boolean operators):
The difference between these is the order in which they are executed. In most cases,
you would want to use a boolean operator like Let’s take a look at a few examples: // Logical operators have lower precedence:
$f = false or true;
// is executed like this:
($f = false) or true;
// Boolean operators have higher precedence:
$f = false || true;
// is executed like this:
$f = (false || true);
Logical Operators are used for Control-FlowOne case where you explicitly want to use logical operators is for control-flow such as this: $x === 5
or die('$x must be 5.');
// Instead of
if ($x !== 5) {
die('$x must be 5.');
}
Since // The following is currently a parse error.
$x === 5
or throw new RuntimeException('$x must be 5.');
These limitations lead to logical operators rarely being of use in current PHP code. Loading history...
|
||||||||||||
| 77 | echo '<p>Gender: '.$row["gender"] .'</p><br>'; |
|||||||||||
| 78 | } |
|||||||||||
| 79 | ?> |
|||||||||||
| 80 | </div> |
|||||||||||
| 81 | <?php if(Session::get('start') == $row['login_id']): ?> |
|||||||||||
| 82 | <div class="edit"> |
|||||||||||
| 83 | <a href="#">Edit Profile</a> |
|||||||||||
| 84 | </div> |
|||||||||||
| 85 | <?php endif; ?> |
|||||||||||
| 86 | </div> |
|||||||||||
| 87 | ||||||||||||
| 88 | <?php |
|||||||||||
| 89 | if(Session::get('start') == $row['login_id']): |
|||||||||||
| 90 | ?> |
|||||||||||
| 91 | ||||||||||||
| 92 | <div class="boxx" id="profile"> |
|||||||||||
| 93 | <form method="post" action="../profile_generate.php"> |
|||||||||||
| 94 | <label>Status : </label> |
|||||||||||
| 95 | <textarea name="status" id="status"><?php echo $row['status']; ?></textarea> |
|||||||||||
| 96 | <label>Education : </label> |
|||||||||||
| 97 | <input type="text" name="education" id="education" value="<?php echo $row['education']; ?>"></input> |
|||||||||||
| 98 | <label>Gender : </label><br> |
|||||||||||
| 99 | <input type="radio" name="gender" id="gender" value="Male" <?php echo ($row['gender']=='Male')?'checked':'' ?>> Male<br> |
|||||||||||
| 100 | <input type="radio" name="gender" id="gender" value="Female" <?php echo ($row['gender']=='Female')?'checked':'' ?>> Female<br> |
|||||||||||
| 101 | <input type="submit" name="submit" value="Done" id="submit"> |
|||||||||||
| 102 | </form> |
|||||||||||
| 103 | </div> |
|||||||||||
| 104 | <?php |
|||||||||||
| 105 | endif; |
|||||||||||
| 106 | ?> |
|||||||||||
| 107 | </div> |
|||||||||||
| 108 | ||||||||||||
| 109 | <div class="footer"> |
|||||||||||
| 110 | <h3 class="footer_text">Made with love by <a href="#">Ankit Jain</a></h3> |
|||||||||||
| 111 | </div> |
|||||||||||
| 112 | ||||||||||||
| 113 | <script type="text/javascript" src="../js/jquery-3.0.0.min.js"></script> |
|||||||||||
| 114 | <script type="text/javascript" src="../js/profile.js"></script> |
|||||||||||
| 115 | <script type="text/javascript" src="../node_modules/place-holder.js/place-holder.min.js"></script> |
|||||||||||
| 116 | </body> |
|||||||||||
| 117 | </html> |
|||||||||||
| 118 | <?php |
|||||||||||
| 119 | else: |
|||||||||||
| 120 | header("Location:".URL."/error.php"); |
|||||||||||
| 121 | endif; |
|||||||||||
| 122 | } |
|||||||||||
| 123 | else |
|||||||||||
| 124 | { |
|||||||||||
| 125 | header("Location: ".URL); |
|||||||||||
| 126 | } |
|||||||||||
| 127 | ?> |
|||||||||||
| 128 | ||||||||||||
| 129 |
PHP has two types of connecting operators (logical operators, and boolean operators):
and&&or||The difference between these is the order in which they are executed. In most cases, you would want to use a boolean operator like
&&, or||.Let’s take a look at a few examples:
Logical Operators are used for Control-Flow
One case where you explicitly want to use logical operators is for control-flow such as this:
Since
dieintroduces problems of its own, f.e. it makes our code hardly testable, and prevents any kind of more sophisticated error handling; you probably do not want to use this in real-world code. Unfortunately, logical operators cannot be combined withthrowat this point:These limitations lead to logical operators rarely being of use in current PHP code.