Creating Video Streaming site/Social Network - BlueCat - 06-09-2014
I am working on a Social network/Video streaming site from scratch.
This is what I have so far.
Code: <?php
$host = "localhost";
$user = "root";
$pass = "";
$db = "Testing";
mysql_connect($host, $user, $pass);
mysql_select_db($db);
if (isset($_POST['username'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$sql = "SELECT * FROM users WHERE username='".$username."' AND password='".$password."' LIMIT 1";
$res = mysql_query($sql);
if (mysql_num_rows($res) == 1) {
echo "You've successfully logged in";
exit();
} else {
echo "You have entered invalid details";
exit();
}
}
?>
<html>
<head>
<title>HitVideo!</title>
<link rel="stylesheet" type="text/css" href="css/head.css">
</head>
<body>
<div id="head">
<form method="post" action="Index.php">
Username: <input type="text" name="username" placeholder="Username">
Password: <input type="password" name="password" placeholder="Password">
<input type="submit" name="submit" value="Log-In">
</form>
<h1>HitVideo</h1>
</div>
</body>
</html>
I have a css, but am not going to post that. It looks likes this though.
![[Image: 3NvwiGN.png]](http://i.imgur.com/3NvwiGN.png)
Not really designed as Ive been working on the important bit.
Now if you look at the code it says.
Code: echo "You've successfully logged in";
exit();
Now, How would I make it as if when they are successfully it logs them into the Homepage? (Have not created it yet) because I am not sure how am suppose to make it as so when they look it directs them to that page.
RE: Creating Video Streaming site/Social Network - zomgwtfbbq - 06-09-2014
(06-09-2014, 06:34 PM)BlueCat Wrote: I am working on a Social network/Video streaming site from scratch.
This is what I have so far.
Code: <?php
$host = "localhost";
$user = "root";
$pass = "";
$db = "Testing";
mysql_connect($host, $user, $pass);
mysql_select_db($db);
if (isset($_POST['username'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$sql = "SELECT * FROM users WHERE username='".$username."' AND password='".$password."' LIMIT 1";
$res = mysql_query($sql);
if (mysql_num_rows($res) == 1) {
echo "You've successfully logged in";
exit();
} else {
echo "You have entered invalid details";
exit();
}
}
?>
<html>
<head>
<title>HitVideo!</title>
<link rel="stylesheet" type="text/css" href="css/head.css">
</head>
<body>
<div id="head">
<form method="post" action="Index.php">
Username: <input type="text" name="username" placeholder="Username">
Password: <input type="password" name="password" placeholder="Password">
<input type="submit" name="submit" value="Log-In">
</form>
<h1>HitVideo</h1>
</div>
</body>
</html>
I have a css, but am not going to post that. It looks likes this though.
![[Image: 3NvwiGN.png]](http://i.imgur.com/3NvwiGN.png)
Not really designed as Ive been working on the important bit.
Now if you look at the code it says.
Code: echo "You've successfully logged in";
exit();
Now, How would I make it as if when they are successfully it logs them into the Homepage? (Have not created it yet) because I am not sure how am suppose to make it as so when they look it directs them to that page. Uhm tbh that is the easiest part of creating a streaming and/or social site. I assume you want to learn by creating things. I'm like that too, but in this case, believe me look at very basic open source community tools and expand them and learn from that.
You even start with mysql_xxx functions which is a very bad thing as it maybe not supported anymore within a year. Switch to PDO/mysqli.
EDIT: even more bad is that you don't sanitize your user input with eg mysql_escape_real_string.
Spoiler:
RE: Creating Video Streaming site/Social Network - BlueCat - 06-09-2014
(06-09-2014, 06:41 PM)zomgwtfbbq Wrote: (06-09-2014, 06:34 PM)BlueCat Wrote: I am working on a Social network/Video streaming site from scratch.
This is what I have so far.
Code: <?php
$host = "localhost";
$user = "root";
$pass = "";
$db = "Testing";
mysql_connect($host, $user, $pass);
mysql_select_db($db);
if (isset($_POST['username'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$sql = "SELECT * FROM users WHERE username='".$username."' AND password='".$password."' LIMIT 1";
$res = mysql_query($sql);
if (mysql_num_rows($res) == 1) {
echo "You've successfully logged in";
exit();
} else {
echo "You have entered invalid details";
exit();
}
}
?>
<html>
<head>
<title>HitVideo!</title>
<link rel="stylesheet" type="text/css" href="css/head.css">
</head>
<body>
<div id="head">
<form method="post" action="Index.php">
Username: <input type="text" name="username" placeholder="Username">
Password: <input type="password" name="password" placeholder="Password">
<input type="submit" name="submit" value="Log-In">
</form>
<h1>HitVideo</h1>
</div>
</body>
</html>
I have a css, but am not going to post that. It looks likes this though.
![[Image: 3NvwiGN.png]](http://i.imgur.com/3NvwiGN.png)
Not really designed as Ive been working on the important bit.
Now if you look at the code it says.
Code: echo "You've successfully logged in";
exit();
Now, How would I make it as if when they are successfully it logs them into the Homepage? (Have not created it yet) because I am not sure how am suppose to make it as so when they look it directs them to that page. Uhm tbh that is the easiest part of creating a streaming and/or social site. I assume you want to learn by creating things. I'm like that too, but in this case, believe me look at very basic open source community tools and expand them and learn from that.
You even start with mysql_xxx functions which is a very bad thing as it maybe not supported anymore within a year. Switch to PDO/mysqli.
I was using mysqli earlier on, But I kept getting errors so I just done some Mysql to get started with
RE: Creating Video Streaming site/Social Network - zomgwtfbbq - 06-09-2014
(06-09-2014, 06:42 PM)BlueCat Wrote: (06-09-2014, 06:41 PM)zomgwtfbbq Wrote: (06-09-2014, 06:34 PM)BlueCat Wrote: I am working on a Social network/Video streaming site from scratch.
This is what I have so far.
Code: <?php
$host = "localhost";
$user = "root";
$pass = "";
$db = "Testing";
mysql_connect($host, $user, $pass);
mysql_select_db($db);
if (isset($_POST['username'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$sql = "SELECT * FROM users WHERE username='".$username."' AND password='".$password."' LIMIT 1";
$res = mysql_query($sql);
if (mysql_num_rows($res) == 1) {
echo "You've successfully logged in";
exit();
} else {
echo "You have entered invalid details";
exit();
}
}
?>
<html>
<head>
<title>HitVideo!</title>
<link rel="stylesheet" type="text/css" href="css/head.css">
</head>
<body>
<div id="head">
<form method="post" action="Index.php">
Username: <input type="text" name="username" placeholder="Username">
Password: <input type="password" name="password" placeholder="Password">
<input type="submit" name="submit" value="Log-In">
</form>
<h1>HitVideo</h1>
</div>
</body>
</html>
I have a css, but am not going to post that. It looks likes this though.
![[Image: 3NvwiGN.png]](http://i.imgur.com/3NvwiGN.png)
Not really designed as Ive been working on the important bit.
Now if you look at the code it says.
Code: echo "You've successfully logged in";
exit();
Now, How would I make it as if when they are successfully it logs them into the Homepage? (Have not created it yet) because I am not sure how am suppose to make it as so when they look it directs them to that page. Uhm tbh that is the easiest part of creating a streaming and/or social site. I assume you want to learn by creating things. I'm like that too, but in this case, believe me look at very basic open source community tools and expand them and learn from that.
You even start with mysql_xxx functions which is a very bad thing as it maybe not supported anymore within a year. Switch to PDO/mysqli.
I was using mysqli earlier on, But I kept getting errors so I just done some Mysql to get started with For now it's actually wasting your time, better post the error that you got from using mysqli.
RE: Creating Video Streaming site/Social Network - BlueCat - 06-09-2014
(06-09-2014, 06:48 PM)zomgwtfbbq Wrote: (06-09-2014, 06:42 PM)BlueCat Wrote: (06-09-2014, 06:41 PM)zomgwtfbbq Wrote: (06-09-2014, 06:34 PM)BlueCat Wrote: I am working on a Social network/Video streaming site from scratch.
This is what I have so far.
Code: <?php
$host = "localhost";
$user = "root";
$pass = "";
$db = "Testing";
mysql_connect($host, $user, $pass);
mysql_select_db($db);
if (isset($_POST['username'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$sql = "SELECT * FROM users WHERE username='".$username."' AND password='".$password."' LIMIT 1";
$res = mysql_query($sql);
if (mysql_num_rows($res) == 1) {
echo "You've successfully logged in";
exit();
} else {
echo "You have entered invalid details";
exit();
}
}
?>
<html>
<head>
<title>HitVideo!</title>
<link rel="stylesheet" type="text/css" href="css/head.css">
</head>
<body>
<div id="head">
<form method="post" action="Index.php">
Username: <input type="text" name="username" placeholder="Username">
Password: <input type="password" name="password" placeholder="Password">
<input type="submit" name="submit" value="Log-In">
</form>
<h1>HitVideo</h1>
</div>
</body>
</html>
I have a css, but am not going to post that. It looks likes this though.
![[Image: 3NvwiGN.png]](http://i.imgur.com/3NvwiGN.png)
Not really designed as Ive been working on the important bit.
Now if you look at the code it says.
Code: echo "You've successfully logged in";
exit();
Now, How would I make it as if when they are successfully it logs them into the Homepage? (Have not created it yet) because I am not sure how am suppose to make it as so when they look it directs them to that page. Uhm tbh that is the easiest part of creating a streaming and/or social site. I assume you want to learn by creating things. I'm like that too, but in this case, believe me look at very basic open source community tools and expand them and learn from that.
You even start with mysql_xxx functions which is a very bad thing as it maybe not supported anymore within a year. Switch to PDO/mysqli.
I was using mysqli earlier on, But I kept getting errors so I just done some Mysql to get started with For now it's actually wasting your time, better post the error that you got from using mysqli.
I actually do not see how I am wasting my time. Your not helping.
RE: Creating Video Streaming site/Social Network - zomgwtfbbq - 06-09-2014
(06-09-2014, 06:58 PM)BlueCat Wrote: I actually do not see how I am wasting my time. Your not helping. Like I say mysql_xxx functions are deprecated. In the end you will have to switch to mysqli/pdo anyway.
RE: Creating Video Streaming site/Social Network - 1llusion - 06-10-2014
I'd really suggest you first to do some smaller projects. Have a project just about log-in and user management. Then project just about video streaming etc. Divide it into smaller projects and once you are comfortable with these projects, you can merge them into one big (not copy/paste, but you can be inspired by them).
Have a look at sessions: http://www.w3schools.com/php/php_sessions.asp they should help you. After that, read some articles about secure log-in methods etc.
RE: Creating Video Streaming site/Social Network - BlueCat - 06-10-2014
(06-10-2014, 12:01 AM)1llusion Wrote: I'd really suggest you first to do some smaller projects. Have a project just about log-in and user management. Then project just about video streaming etc. Divide it into smaller projects and once you are comfortable with these projects, you can merge them into one big (not copy/paste, but you can be inspired by them).
Have a look at sessions: http://www.w3schools.com/php/php_sessions.asp they should help you. After that, read some articles about secure log-in methods etc.
Thankyou, I will try that. mile:
|