account settings without front message fix
This commit is contained in:
parent
4979901e3c
commit
9c181cc0fa
@ -1,13 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
if( !isset( $_SESSION ) ) session_start();
|
if( !isset( $_SESSION ) ) session_start();
|
||||||
$_SESSION['messagep']='';
|
$_SESSION['message']='';
|
||||||
$_SESSION['messagee']='';
|
|
||||||
$_SESSION['messagea']='';
|
|
||||||
$_SESSION['messageas']='';
|
|
||||||
$_SESSION['messageam']='';
|
|
||||||
$_SESSION['messageab']='';
|
|
||||||
$_SESSION['messagefb']='';
|
|
||||||
$_SESSION['messagetw']='';
|
|
||||||
if(empty($_SESSION['user'])){
|
if(empty($_SESSION['user'])){
|
||||||
header('Location: login.php');
|
header('Location: login.php');
|
||||||
}
|
}
|
||||||
@ -32,27 +25,27 @@ if(isset($_POST['password_change'])){
|
|||||||
$_SESSION['user']=$user;
|
$_SESSION['user']=$user;
|
||||||
$_SESSION['password']=$newpassword;
|
$_SESSION['password']=$newpassword;
|
||||||
$_SESSION['loggedIn']=1;
|
$_SESSION['loggedIn']=1;
|
||||||
$_SESSION['messagep'] = "Hasło zostało zmienione!";
|
$_SESSION['message'] = "Hasło zostało zmienione!";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$_SESSION['messagep'] = "Coś poszło nie tak, spróbuj ponownie później.";
|
$_SESSION['message'] = "Coś poszło nie tak, spróbuj ponownie później.";
|
||||||
}
|
}
|
||||||
mysqli_close($mysqli);
|
mysqli_close($mysqli);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$_SESSION['messagep'] = "Błędne hasło!";
|
$_SESSION['message'] = "Błędne hasło!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$_SESSION['messagep'] = "Potwierdź hasło ponownie";
|
$_SESSION['message'] = "Potwierdź hasło ponownie";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$_SESSION['messagep'] = "Nowe hasło nie może być takie samo jak obecne";
|
$_SESSION['message'] = "Nowe hasło nie może być takie samo jak obecne";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$_SESSION['messagep'] = "Należy wypełnić wszystkie wmagane pola";
|
$_SESSION['message'] = "Należy wypełnić wszystkie wmagane pola";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,27 +58,27 @@ if(isset($_POST['email_change'])){
|
|||||||
$newemail=$_POST['newemail'];
|
$newemail=$_POST['newemail'];
|
||||||
$sql = "UPDATE user SET email='$newemail' WHERE password='$password' AND username='$user'";
|
$sql = "UPDATE user SET email='$newemail' WHERE password='$password' AND username='$user'";
|
||||||
if($mysqli->query($sql) === true){
|
if($mysqli->query($sql) === true){
|
||||||
$_SESSION['messagee'] = "email został zmieniony!";
|
$_SESSION['message'] = "email został zmieniony!";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$_SESSION['messagee'] = "Coś poszło nie tak, spróbuj ponownie później.";
|
$_SESSION['message'] = "Coś poszło nie tak, spróbuj ponownie później.";
|
||||||
}
|
}
|
||||||
mysqli_close($mysqli);
|
mysqli_close($mysqli);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$_SESSION['messagee'] = "Błędne hasło!";
|
$_SESSION['message'] = "Błędne hasło!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$_SESSION['messagee'] = "Potwierdź email ponownie";
|
$_SESSION['message'] = "Potwierdź email ponownie";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$_SESSION['messagee'] = "Nowy email nie może być taki sam jak obecny";
|
$_SESSION['message'] = "Nowy email nie może być taki sam jak obecny";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$_SESSION['messagee'] = "Należy wypełnić wszystkie wmagane pola";
|
$_SESSION['message'] = "Należy wypełnić wszystkie wmagane pola";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,19 +92,19 @@ if(isset($_POST['avatar_change'])){
|
|||||||
if($currentavatar != $avatar_path){
|
if($currentavatar != $avatar_path){
|
||||||
unlink($currentavatar);
|
unlink($currentavatar);
|
||||||
}
|
}
|
||||||
$_SESSION['messagea'] = "avatar został zmieniony!";
|
$_SESSION['message'] = "avatar został zmieniony!";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$_SESSION['messagea'] = "Coś poszło nie tak, spróbuj ponownie później.";
|
$_SESSION['message'] = "Coś poszło nie tak, spróbuj ponownie później.";
|
||||||
}
|
}
|
||||||
mysqli_close($mysqli);
|
mysqli_close($mysqli);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$_SESSION['messagea'] = "Coś poszło nie tak, spróbuj ponownie później.";
|
$_SESSION['message'] = "Coś poszło nie tak, spróbuj ponownie później.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$_SESSION['messagea'] = "Plik musi byc graficzny\n";
|
$_SESSION['message'] = "Plik musi byc graficzny\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,16 +113,16 @@ if(isset($_POST['aboutshort_change'])){
|
|||||||
if($about_short != $newabout_short){
|
if($about_short != $newabout_short){
|
||||||
$sql = "UPDATE user SET about_short='$newabout_short' WHERE password='$password' AND username='$user'";
|
$sql = "UPDATE user SET about_short='$newabout_short' WHERE password='$password' AND username='$user'";
|
||||||
if($mysqli->query($sql) === true){
|
if($mysqli->query($sql) === true){
|
||||||
$_SESSION['messageas'] = "Zmiany zostały zatwierdzone!";
|
$_SESSION['message'] = "Zmiany zostały zatwierdzone!";
|
||||||
$about_short = $row['about_short'];
|
$about_short = $row['about_short'];
|
||||||
header('Location: account_settings.php');
|
header('Location: account_settings.php');
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$_SESSION['messageas'] = "Coś poszło nie tak, spróbuj ponownie później.";
|
$_SESSION['message'] = "Coś poszło nie tak, spróbuj ponownie później.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$_SESSION['messageas'] = "Brak zmian";
|
$_SESSION['message'] = "Brak zmian";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,16 +131,16 @@ if(isset($_POST['aboutme_change'])){
|
|||||||
if($about_me != $newabout_me){
|
if($about_me != $newabout_me){
|
||||||
$sql = "UPDATE user SET about_me='$newabout_me' WHERE password='$password' AND username='$user'";
|
$sql = "UPDATE user SET about_me='$newabout_me' WHERE password='$password' AND username='$user'";
|
||||||
if($mysqli->query($sql) === true){
|
if($mysqli->query($sql) === true){
|
||||||
$_SESSION['messageam'] = "Zmiany zostały zatwierdzone!";
|
$_SESSION['message'] = "Zmiany zostały zatwierdzone!";
|
||||||
$about_me = $row['about_me'];
|
$about_me = $row['about_me'];
|
||||||
header('Location: account_settings.php');
|
header('Location: account_settings.php');
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$_SESSION['messageam'] = "Coś poszło nie tak, spróbuj ponownie później.";
|
$_SESSION['message'] = "Coś poszło nie tak, spróbuj ponownie później.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$_SESSION['messageam'] = "Brak zmian";
|
$_SESSION['message'] = "Brak zmian";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,16 +149,16 @@ if(isset($_POST['aboutblog_change'])){
|
|||||||
if($about_blog != $newabout_blog){
|
if($about_blog != $newabout_blog){
|
||||||
$sql = "UPDATE user SET about_blog='$newabout_blog' WHERE password='$password' AND username='$user'";
|
$sql = "UPDATE user SET about_blog='$newabout_blog' WHERE password='$password' AND username='$user'";
|
||||||
if($mysqli->query($sql) === true){
|
if($mysqli->query($sql) === true){
|
||||||
$_SESSION['messageab'] = "Zmiany zostały zatwierdzone!";
|
$_SESSION['message'] = "Zmiany zostały zatwierdzone!";
|
||||||
$about_blog = $row['about_blog'];
|
$about_blog = $row['about_blog'];
|
||||||
header('Location: account_settings.php');
|
header('Location: account_settings.php');
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$_SESSION['messageab'] = "Coś poszło nie tak, spróbuj ponownie później.";
|
$_SESSION['message'] = "Coś poszło nie tak, spróbuj ponownie później.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$_SESSION['messageab'] = "Brak zmian";
|
$_SESSION['message'] = "Brak zmian";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,14 +169,14 @@ if(isset($_POST['face_change'])){
|
|||||||
if($face != $newface) {
|
if($face != $newface) {
|
||||||
$sql = "UPDATE user SET FB='$newface' WHERE password='$password' AND username='$user'";
|
$sql = "UPDATE user SET FB='$newface' WHERE password='$password' AND username='$user'";
|
||||||
if($mysqli->query($sql) === true){
|
if($mysqli->query($sql) === true){
|
||||||
$_SESSION['messagefb'] = "Zmiany zostały zatwierdzone!";
|
$_SESSION['message'] = "Zmiany zostały zatwierdzone!";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$_SESSION['messagefb'] = "Coś poszło nie tak, spróbuj ponownie później.";
|
$_SESSION['message'] = "Coś poszło nie tak, spróbuj ponownie później.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$_SESSION['messagefb'] = "Brak zmian";
|
$_SESSION['message'] = "Brak zmian";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -194,14 +187,14 @@ if(isset($_POST['twit_change'])){
|
|||||||
if($twit != $newtwit) {
|
if($twit != $newtwit) {
|
||||||
$sql = "UPDATE user SET TW='$newtwit' WHERE password='$password' AND username='$user'";
|
$sql = "UPDATE user SET TW='$newtwit' WHERE password='$password' AND username='$user'";
|
||||||
if($mysqli->query($sql) === true){
|
if($mysqli->query($sql) === true){
|
||||||
$_SESSION['messagetw'] = "Zmiany zostały zatwierdzone!";
|
$_SESSION['message'] = "Zmiany zostały zatwierdzone!";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$_SESSION['messagetw'] = "Coś poszło nie tak, spróbuj ponownie później.";
|
$_SESSION['message'] = "Coś poszło nie tak, spróbuj ponownie później.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$_SESSION['messagetw'] = "Brak zmian";
|
$_SESSION['message'] = "Brak zmian";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ include "acc_settings.php";
|
|||||||
<input type="password" class="form-control" placeholder="Hasło" id="password" name="password" required />
|
<input type="password" class="form-control" placeholder="Hasło" id="password" name="password" required />
|
||||||
<input type="password" class="form-control" placeholder="Nowe hasło" id="newpassword" name="newpassword" required />
|
<input type="password" class="form-control" placeholder="Nowe hasło" id="newpassword" name="newpassword" required />
|
||||||
<input type="password" class="form-control" placeholder="Potwierdź nowe hasło" id="confirmpassword" name="confirmpassword" required />
|
<input type="password" class="form-control" placeholder="Potwierdź nowe hasło" id="confirmpassword" name="confirmpassword" required />
|
||||||
<span><?php echo $_SESSION['messagep']; ?></span><br>
|
<span><?php echo $_SESSION['message']; ?></span><br>
|
||||||
<input type="submit" class="btn" value="Zmień Hasło" name="password_change" />
|
<input type="submit" class="btn" value="Zmień Hasło" name="password_change" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@ -57,7 +57,7 @@ include "acc_settings.php";
|
|||||||
<input type="password" class="form-control" placeholder="Hasło" id="password" name="password" required />
|
<input type="password" class="form-control" placeholder="Hasło" id="password" name="password" required />
|
||||||
<input type="email" class="form-control" placeholder="email" id="newemail" name="newemail" required />
|
<input type="email" class="form-control" placeholder="email" id="newemail" name="newemail" required />
|
||||||
<input type="email" class="form-control" placeholder="Potwierdź email" id="confirmemail" name="confirmemail" required />
|
<input type="email" class="form-control" placeholder="Potwierdź email" id="confirmemail" name="confirmemail" required />
|
||||||
<span><?php echo $_SESSION['messagee']; ?></span><br>
|
<span><?php echo $_SESSION['message']; ?></span><br>
|
||||||
<input type="submit" class="btn" value="Zmień email" name="email_change" />
|
<input type="submit" class="btn" value="Zmień email" name="email_change" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@ -68,7 +68,7 @@ include "acc_settings.php";
|
|||||||
<p>Zmiana avatara</p>
|
<p>Zmiana avatara</p>
|
||||||
<label>Wybierz nowy avatar: </label>
|
<label>Wybierz nowy avatar: </label>
|
||||||
<input type="file" name="avatar" accept="image/*" required />
|
<input type="file" name="avatar" accept="image/*" required />
|
||||||
<span><?php echo $_SESSION['messagea']; ?></span><br>
|
<span><?php echo $_SESSION['message']; ?></span><br>
|
||||||
<input type="submit" class="btn" value="Zmień avatar" name="avatar_change" />
|
<input type="submit" class="btn" value="Zmień avatar" name="avatar_change" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@ -78,7 +78,7 @@ include "acc_settings.php";
|
|||||||
<form class="form" action="" method="POST">
|
<form class="form" action="" method="POST">
|
||||||
<p>Krótko o mnie</p>
|
<p>Krótko o mnie</p>
|
||||||
<textarea name="aboutshort" rows="10" cols="80"><?php echo $about_short; ?></textarea><br>
|
<textarea name="aboutshort" rows="10" cols="80"><?php echo $about_short; ?></textarea><br>
|
||||||
<span><?php echo $_SESSION['messageas']; ?></span><br>
|
<span><?php echo $_SESSION['message']; ?></span><br>
|
||||||
<input type="submit" class="btn" value="Zatwierdź" name="aboutshort_change" />
|
<input type="submit" class="btn" value="Zatwierdź" name="aboutshort_change" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@ -88,7 +88,7 @@ include "acc_settings.php";
|
|||||||
<form class="form" action="" method="POST">
|
<form class="form" action="" method="POST">
|
||||||
<p>O mnie</p>
|
<p>O mnie</p>
|
||||||
<textarea name="aboutme" rows="10" cols="80"><?php echo $about_me; ?></textarea><br>
|
<textarea name="aboutme" rows="10" cols="80"><?php echo $about_me; ?></textarea><br>
|
||||||
<span><?php echo $_SESSION['messageam']; ?></span><br>
|
<span><?php echo $_SESSION['message']; ?></span><br>
|
||||||
<input type="submit" class="btn" value="Zatwierdź" name="aboutme_change" />
|
<input type="submit" class="btn" value="Zatwierdź" name="aboutme_change" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@ -98,7 +98,7 @@ include "acc_settings.php";
|
|||||||
<form class="form" action="" method="POST">
|
<form class="form" action="" method="POST">
|
||||||
<p>Opis Bloga</p>
|
<p>Opis Bloga</p>
|
||||||
<textarea name="aboutblog" maxlength="50" rows="10" cols="80"><?php echo $about_blog; ?></textarea><br>
|
<textarea name="aboutblog" maxlength="50" rows="10" cols="80"><?php echo $about_blog; ?></textarea><br>
|
||||||
<span><?php echo $_SESSION['messageab']; ?></span><br>
|
<span><?php echo $_SESSION['message']; ?></span><br>
|
||||||
<input type="submit" class="btn" value="Zatwierdź" name="aboutblog_change" />
|
<input type="submit" class="btn" value="Zatwierdź" name="aboutblog_change" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@ -108,12 +108,12 @@ include "acc_settings.php";
|
|||||||
<form class="form" action="" method="POST">
|
<form class="form" action="" method="POST">
|
||||||
<p>Social Media</p>
|
<p>Social Media</p>
|
||||||
<input type="text" class="form-control" placeholder="facebook" id="FB" name="FB" required />
|
<input type="text" class="form-control" placeholder="facebook" id="FB" name="FB" required />
|
||||||
<span><?php echo $_SESSION['messagefb']; ?></span><br>
|
<span><?php echo $_SESSION['message']; ?></span><br>
|
||||||
<input type="submit" class="btn" value="Zatwierdź" name="face_change" />
|
<input type="submit" class="btn" value="Zatwierdź" name="face_change" />
|
||||||
</form>
|
</form>
|
||||||
<form class="form" action="" method="POST">
|
<form class="form" action="" method="POST">
|
||||||
<input type="text" class="form-control" placeholder="twitter" id="TW" name="TW" required />
|
<input type="text" class="form-control" placeholder="twitter" id="TW" name="TW" required />
|
||||||
<span><?php echo $_SESSION['messagetw']; ?></span><br>
|
<span><?php echo $_SESSION['message']; ?></span><br>
|
||||||
<input type="submit" class="btn" value="Zatwierdź" name="twit_change" />
|
<input type="submit" class="btn" value="Zatwierdź" name="twit_change" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user