Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
PHP-Chat
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
BA_SST
PHP-Chat
Commits
4ef8a40f
Commit
4ef8a40f
authored
Jul 13, 2016
by
Nico Schallehn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Neue Startseite als Standard gesetzt!
parent
4008fbb9
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
279 additions
and
279 deletions
+279
-279
index.php
index.php
+193
-85
index2.php
index2.php
+0
-194
indexOLD.php
indexOLD.php
+86
-0
No files found.
index.php
View file @
4ef8a40f
This diff is collapsed.
Click to expand it.
index2.php
deleted
100644 → 0
View file @
4008fbb9
<?php
if
(
empty
(
$_SERVER
[
'HTTPS'
])
||
$_SERVER
[
'HTTPS'
]
==
"off"
){
$redirect
=
'https://'
.
$_SERVER
[
'HTTP_HOST'
]
.
$_SERVER
[
'REQUEST_URI'
];
header
(
'HTTP/1.1 301 Moved Permanently'
);
header
(
'Location: '
.
$redirect
);
exit
();
}
include
(
"config.php"
);
$result
=
mysql_query
(
"SELECT * FROM user WHERE name = '
{
$_SESSION
[
'chatuserid'
]
}
'"
);
$users
=
mysql_fetch_array
(
$result
);
if
(
isset
(
$_POST
[
'ok'
]))
{
if
(
$_POST
[
'ok'
]
==
"Anmelden"
){
$username
=
htmlentities
(
$_POST
[
'username'
]);
$passwort
=
htmlentities
(
$_POST
[
'pass'
]);
if
(
$username
==
""
OR
$passwort
==
""
){
$meldung
=
"<font color=
\"
red
\"
>Name oder Password Fehlt!</font>"
;
$JqueryDo
=
"$('#showLogin').click();"
;
}
else
{
$result
=
mysql_query
(
"SELECT id, pass, name FROM user WHERE name = '
$username
'"
);
$user
=
mysql_fetch_array
(
$result
);
if
(
$user
[
'pass'
]
==
$passwort
)
{
$_SESSION
[
'chatuserid'
]
=
$user
[
'id'
];
$_SESSION
[
'name'
]
=
$user
[
'name'
];
mysql_query
(
"UPDATE user SET online = '1', refresh_time = "
.
time
()
.
" WHERE id = '
{
$_SESSION
[
'chatuserid'
]
}
'"
);
mysql_query
(
"INSERT INTO chat (nachricht, user_id, userchange, hideuser, chat_time) VALUES ('<b>
{
$user
[
'name'
]
}
</b> betritt den Chat', '
{
$_SESSION
[
'chatuserid'
]
}
', '1', '1', '"
.
time
()
.
"')"
);
//$text .= "Du hast dich erfolgreich eingeloggt!";//<script>parent.location.href = 'fr.php';</script>";
$meldung
.=
"<font color=
\"
green
\"
>Du hast dich erfolgreich angemeldet!</font>"
;
$JqueryDo
=
"$('#showLogin').click();"
.
PHP_EOL
.
"setTimeout(function(){ window.location =
\"
/fr.php
\"
; }, 700);"
;
}
else
{
$meldung
.=
"<font color=
\"
red
\"
>Name (
$username
) oder Passwort falsch!</font>"
;
$JqueryDo
=
"$('#showLogin').click();"
;
}
}
}
else
if
(
$_POST
[
'ok'
]
==
"Registrieren"
)
{
var_dump
(
$_POST
);
$result
=
mysql_query
(
"SELECT COUNT(*) AS anz FROM user WHERE name = '
{
$_POST
[
'username'
]
}
'"
);
$user
=
mysql_fetch_array
(
$result
);
if
(
$user
[
'anz'
]
==
0
AND
$_POST
[
'username'
]
!=
""
AND
$_POST
[
'pass'
]
!=
""
){
$_SESSION
[
'chatuserid'
]
=
$user
[
'id'
];
$_POST
[
'username'
]
=
htmlentities
(
$_POST
[
'username'
]);
$_POST
[
'pass'
]
=
htmlentities
(
$_POST
[
'pass'
]);
mysql_query
(
"INSERT INTO user (name, pass) VALUES ('
{
$_POST
[
'username'
]
}
', '
{
$_POST
[
'pass'
]
}
')"
);
mysql_query
(
"INSERT INTO chat (nachricht, user_id, userchange, hideuser, chat_time) VALUES ('<b>
{
$_POST
[
'username'
]
}
</b> hat sich registriert', '
{
$_SESSION
[
'chatuserid'
]
}
', '1', '1', '"
.
time
()
.
"')"
);
AdminLogAdd
(
"
{
$_POST
[
'username'
]
}
hat sich registiert!"
,
$_SESSION
[
'chatuserid'
],
0
);
//$text .= 'Du hast dich erfolgreich registriert! ';
$meldung
=
'<font color="green">Du hast dich erfolgreich registriert!</font><a href="#" id="showLogin"><span class="glyphicon glyphicon-log-in"></span> Anmelden</a><br>'
;
$JqueryDo
=
"$('#showRegis').click();"
.
PHP_EOL
.
"setTimeout(function(){ $('#showLogin').click(); }, 1000);"
;
}
else
{
if
(
$user
[
'anz'
]
!=
0
)
$meldung
=
'<font color="red">Name existiert bereits!</font><br>'
;
else
$meldung
=
'<font color="red">Name oder Passwort fehlt oder ist ungltig!</font><br>'
;
$JqueryDo
=
"$('#showRegis').click();"
;
}
}
}
?>
<!DOCTYPE html>
<html>
<head
lang=
"de"
>
<meta
charset=
"utf-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
PHP-Chat
</title>
<!-- Latest compiled and minified CSS -->
<link
rel=
"stylesheet"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"
integrity=
"sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7"
crossorigin=
"anonymous"
>
<!-- Optional theme -->
<link
rel=
"stylesheet"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css"
integrity=
"sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r"
crossorigin=
"anonymous"
>
<!--custrom css-->
<link
rel=
"stylesheet"
href=
"style.css"
>
</head>
<body>
<div
class=
"container-fluid"
>
<nav
class=
"navbar navbar-default navbar-fixed-top"
>
<div
class=
"container-fluid"
>
<div
class=
"navbar-header"
>
<button
type=
"button"
class=
"navbar-toggle collapsed"
data-toggle=
"collapse"
data-target=
"#mainnavbar"
aria-expanded=
"false"
>
<span
class=
"sr-only"
>
Toggle navigation
</span>
<span
class=
"icon-bar"
></span>
<span
class=
"icon-bar"
></span>
<span
class=
"icon-bar"
></span>
</button>
<a
class=
"navbar-brand"
href=
"index2.php"
>
PHP-Chat
</a>
</div>
<div
class=
"collapse navbar-collapse"
id=
"mainnavbar"
>
<ul
class=
"nav navbar-nav"
>
<li
class=
"active"
><a
href=
"
<?php
echo
$_SERVER
[
'REQUEST_URI'
];
?>
"
><span
class=
"glyphicon glyphicon-home"
/></a></li>
<li><a
href=
"#"
>
Link1
</a></li>
<li><a
href=
"#"
>
Link2
</a></li>
<li><a
href=
"#"
>
Link3
</a></li>
<li><a
href=
"#"
>
Link4
</a></li>
</ul>
<ul
class=
"nav navbar-nav navbar-right"
>
<li
id=
"LoginBtn"
><a
href=
"#"
id=
"showLogin"
><span
class=
"glyphicon glyphicon-log-in"
></span>
Anmelden
</a></li>
<li
id=
"RegisBtn"
><a
href=
"#"
id=
"showRegis"
><span
class=
"glyphicon glyphicon-plus-sign"
></span>
Registieren
</a></li>
</ul>
</div>
</div>
</nav>
<div
class=
"row"
>
<div
class=
"col-xs-10 col-xs-offset-1"
>
<div
class=
"row"
>
<div
class=
"col-xs-12"
id=
"loginCol"
style=
"display:none;"
>
<div
class=
"panel panel-info"
>
<div
class=
"panel-heading"
>
<h3
class=
"panel-title"
>
Anmeldung
</h3>
</div>
<div
class=
"panel-body"
>
<?php
echo
$meldung
;
?>
<form
method=
"post"
action=
"
<?php
echo
$_SERVER
[
'REQUEST_URI'
];
?>
"
>
<div
class=
"form-group"
>
<label
for=
"LoginUserId"
>
Benutzername
</label>
<input
type=
"text"
class=
"form-control"
id=
"LoginUserId"
name=
"username"
placeholder=
"Benutzername"
>
</div>
<div
class=
"form-group"
>
<label
for=
"LoginUserPwd"
>
Passwort
</label>
<input
type=
"password"
class=
"form-control"
id=
"LoginUserPwd"
name=
"pass"
placeholder=
"Passwort"
>
</div>
<button
type=
"submit"
class=
"btn btn-default"
name=
"ok"
value=
"Anmelden"
>
Anmelden
</button>
</form>
</div>
<!-- <div class="panel-footer">
<a href="#" id="showRegBtn" role="button" class="btn btn-info btn-xs">Zur Registrierung wechseln...</a>
</div> -->
</div>
</div>
<div
class=
"col-xs-12"
id=
"registerCol"
style=
"display:none;"
>
<div
class=
"panel panel-info"
>
<div
class=
"panel-heading"
>
<h3
class=
"panel-title"
>
Registrierung
</h3>
</div>
<div
class=
"panel-body"
>
<?php
echo
$meldung
;
?>
<form
method=
"post"
action=
"
<?php
echo
$_SERVER
[
'REQUEST_URI'
];
?>
"
>
<div
class=
"form-group"
>
<label
for=
"RegUserId"
>
Benutzername
</label>
<input
type=
"text"
class=
"form-control"
id=
"RegUserId"
name=
"username"
placeholder=
"Benutzername"
>
</div>
<div
class=
"form-group"
>
<label
for=
"RegUserPwd"
>
Passwort
</label>
<input
type=
"password"
class=
"form-control"
id=
"RegUserPwd"
name=
"pass"
placeholder=
"Passwort"
>
</div>
<button
type=
"submit"
class=
"btn btn-default"
name=
"ok"
value=
"Registrieren"
>
Registrieren
</button>
</form>
</div>
<!-- <div class="panel-footer">
<a href="#" id="showLoginBtn" role="button" class="btn btn-info btn-xs">Zur Anmeldung wechseln...</a>
</div> -->
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"page-header"
>
<h1>
Startseite
</h1>
</div>
<div
class=
"panel panel-default"
>
<div
class=
"panel-body"
>
<?php
echo
BBcode
(
file_get_contents
(
"
$yourFile
"
));
?>
<br>
<small>
<?php
echo
"Es sind schon "
.
$Useranzahl
.
" an Bord! Es sind "
.
$Useronline
.
" Online!"
;
?>
</small><br><br><br>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"
></script>
<!-- Latest compiled and minified JavaScript -->
<script
src=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"
integrity=
"sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS"
crossorigin=
"anonymous"
></script>
<script
src=
"customJS.js"
></script>
<script>
$
(
document
).
ready
(
function
()
{
<?php
echo
$JqueryDo
;
?>
});
</script>
</body>
</html>
\ No newline at end of file
indexOLD.php
0 → 100644
View file @
4ef8a40f
<?php
if
(
empty
(
$_SERVER
[
'HTTPS'
])
||
$_SERVER
[
'HTTPS'
]
==
"off"
){
$redirect
=
'https://'
.
$_SERVER
[
'HTTP_HOST'
]
.
$_SERVER
[
'REQUEST_URI'
];
header
(
'HTTP/1.1 301 Moved Permanently'
);
header
(
'Location: '
.
$redirect
);
exit
();
}
include
(
"config.php"
);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>
Chat - Login
</title>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"standard.css"
>
</head>
<body
id=
"body"
class=
"bodybg"
style=
"background-position: 0 -692;"
>
<?php
$result
=
mysql_query
(
"SELECT * FROM user WHERE name = '
{
$_SESSION
[
'chatuserid'
]
}
'"
);
$users
=
mysql_fetch_array
(
$result
);
echo
'<a href="index.php">Home</a> | <a href="index.php?action=register">Registieren</a>'
;
$text
=
""
;
if
(
$_GET
[
'action'
]
==
""
)
{
$text
.=
'<h1>Einloggen</h1>'
;
if
(
isset
(
$_POST
[
'ok'
]))
{
$username
=
htmlentities
(
$_POST
[
'username'
]);
$passwort
=
htmlentities
(
$_POST
[
'pass'
]);
if
(
$username
==
""
OR
$passwort
==
""
)
$text
.=
"<font color=
\"
red
\"
>Name oder Password Fehlt!</font>"
;
else
{
$result
=
mysql_query
(
"SELECT id, pass, name FROM user WHERE name = '
$username
'"
);
$user
=
mysql_fetch_array
(
$result
);
if
(
$user
[
'pass'
]
==
$passwort
)
{
$_SESSION
[
'chatuserid'
]
=
$user
[
'id'
];
$_SESSION
[
'name'
]
=
$user
[
'name'
];
mysql_query
(
"UPDATE user SET online = '1', refresh_time = "
.
time
()
.
" WHERE id = '
{
$_SESSION
[
'chatuserid'
]
}
'"
);
mysql_query
(
"INSERT INTO chat (nachricht, user_id, userchange, hideuser, chat_time) VALUES ('<b>
{
$user
[
'name'
]
}
</b> betritt den Chat', '
{
$_SESSION
[
'chatuserid'
]
}
', '1', '1', '"
.
time
()
.
"')"
);
$text
.=
"Du hast dich erfolgreich eingeloggt!<script>parent.location.href = 'fr.php';</script>"
;
}
else
$text
.=
"<font color=
\"
red
\"
>Name (
$username
) oder Passwort falsch!</font><br /><br />"
;
}
}
$text
.=
'<form method="post" action="index.php">
<table>
<tr><td>Name:</td> <td><input type="text" name="username" /></td></tr>
<tr><td>Passwort:</td> <td><input type="password" name="pass" /></td></tr>
<tr><td></td><td><input type="submit" name="ok" value="Anmelden" /></td></tr>
</table>
</form>'
;
}
else
if
(
$_GET
[
'action'
]
==
"register"
)
{
$text
.=
'<h1>Registieren</h1>'
;
if
(
isset
(
$_POST
[
'ok'
])){
$result
=
mysql_query
(
"SELECT COUNT(*) AS anz FROM user WHERE name = '
{
$_POST
[
'username'
]
}
'"
);
$user
=
mysql_fetch_array
(
$result
);
if
(
$user
[
'anz'
]
==
0
AND
$_POST
[
'username'
]
!=
""
AND
$_POST
[
'pass'
]
!=
""
){
$_SESSION
[
'chatuserid'
]
=
$user
[
'id'
];
$_POST
[
'username'
]
=
htmlentities
(
$_POST
[
'username'
]);
$_POST
[
'pass'
]
=
htmlentities
(
$_POST
[
'pass'
]);
mysql_query
(
"INSERT INTO user (name, pass) VALUES ('
{
$_POST
[
'username'
]
}
', '
{
$_POST
[
'pass'
]
}
')"
);
mysql_query
(
"INSERT INTO chat (nachricht, user_id, userchange, hideuser, chat_time) VALUES ('<b>
{
$_POST
[
'username'
]
}
</b> hat sich registriert', '
{
$_SESSION
[
'chatuserid'
]
}
', '1', '1', '"
.
time
()
.
"')"
);
AdminLogAdd
(
"
{
$_POST
[
'username'
]
}
hat sich registiert!"
,
$_SESSION
[
'chatuserid'
],
0
);
$text
.=
"Du hast dich erfolgreich registriert! <a href=
\"
index.php
\"
>Zum Login!</a><br><br>"
;
}
else
if
(
$user
[
'anz'
]
!=
0
)
$text
.=
"<font color=
\"
red
\"
>Name existiert Schon!</font><br><br>"
;
else
$text
.=
"<font color=
\"
red
\"
>Name oder Passwort fehlt oder ist ungltig!</font><br><br>"
;
}
$text
.=
'<form method="post" action="index.php?action=register">
<table><tr><td>Name:</td> <td><input type="text" name="username"><td></tr>
<tr><td>Passwort:</td> <td><input type="password" name="pass"><td></tr>
<tr><td></td> <td><input type="submit" name="ok" value="Registrieren"><td></tr></table></form>'
;
}
echo
$text
;
?>
<br><br>
<?php
echo
BBcode
(
file_get_contents
(
"
$yourFile
"
));
?>
<br><br>
<small>
<?php
echo
"Es sind schon "
.
$Useranzahl
.
" an Bord! Es sind "
.
$Useronline
.
" Online!"
;
?>
</small><br><br><br>
</body>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment