izanagi1995
AI Model Designer
2
MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1
300 XP
In this tutorial we will create a instagram status script post in PHP and Javascript. This project creates a post message that you can comment or reply in every statuses that the user posted. And their are features that you will like delete post or you can comment to the other people post and it is real time process of the data so the user will know what day and what time did the user posted or created the status. This project is related to all SNS system that creates and shows the data to other user of that system. I will show you the sample code and images below.
Sample Code
Database PHP Script
And for the Login Script
Sample Image
For more tutorials just visit this website @www.sourcecodester.com and don't forget to Like and Share. Enjoy Coding.
Download
Sample Code
Database PHP Script
- <?php
- require_once
(
LIB_PATH.
DS.
"config.php"
)
;
- class
Database {
- var
$data
;
- var
$sql_string
=
''
;
- var
$error_no
=
0
;
- var
$error_msg
=
''
;
- private
$conn
;
- public
$last_query
;
- private
$magic_quotes_active
;
- private
$real_escape_string_exists
;
- function
__construct(
)
{
- $this
->
open_connection
(
)
;
- $this
->
magic_quotes_active
=
get_magic_quotes_gpc
(
)
;
- $this
->
real_escape_string_exists
=
function_exists
(
"mysql_real_escape_string"
)
;
- }
- public
function
open_connection(
)
{
- $this
->
conn
=
mysql_connect
(
DB_SERVER,
DB_USER,
DB_PASS)
;
- if
(
!
$this
->
conn
)
{
- echo
"Problem in database connection! Contact administrator!"
;
- exit
(
)
;
- }
else
{
- $db_select
=
mysql_select_db
(
DB_NAME,
$this
->
conn
)
;
- if
(
!
$db_select
)
{
- echo
"Problem in selecting database! Contact administrator!"
;
- exit
(
)
;
- }
- }
- }
- function
setQuery(
$sql
=
''
)
{
- $this
->
sql_string
=
$sql
;
- }
- function
executeQuery(
)
{
- $result
=
mysql_query
(
$this
->
sql_string
,
$this
->
conn
)
;
- $this
->
confirm_query
(
$result
)
;
- return
$result
;
- }
- private
function
confirm_query(
$result
)
{
- if
(
!
$result
)
{
- $this
->
error_no
=
mysql_errno
(
$this
->
conn
)
;
- $this
->
error_msg
=
mysql_error
(
$this
->
conn
)
;
- return
false
;
- }
- return
$result
;
- }
- function
loadResultList(
$key
=
''
)
{
- $cur
=
$this
->
executeQuery
(
)
;
- $array
=
array
(
)
;
- while
(
$row
=
mysql_fetch_object
(
$cur
)
)
{
- if
(
$key
)
{
- $array
[
$row
->
$key
]
=
$row
;
- }
else
{
- $array
[
]
=
$row
;
- }
- }
- mysql_free_result
(
$cur
)
;
- return
$array
;
- }
- function
loadSingleResult(
)
{
- $cur
=
$this
->
executeQuery
(
)
;
- while
(
$row
=
mysql_fetch_object
(
$cur
)
)
{
- return
$data
=
$row
;
- }
- mysql_free_result
(
$cur
)
;
- }
- function
getFieldsOnOneTable(
$tbl_name
)
{
- $this
->
setQuery
(
"DESC "
.
$tbl_name
)
;
- $rows
=
$this
->
loadResultList
(
)
;
- $f
=
array
(
)
;
- for
(
$x
=
0
;
$x
<
count
(
$rows
)
;
$x
++
)
{
- $f
[
]
=
$rows
[
$x
]
->
Field
;
- }
- return
$f
;
- }
- public
function
fetch_array(
$result
)
{
- return
mysql_fetch_array
(
$result
)
;
- }
- public
function
num_rows(
$result_set
)
{
- return
mysql_num_rows
(
$result_set
)
;
- }
- public
function
insert_id(
)
{
- return
mysql_insert_id
(
$this
->
conn
)
;
- }
- public
function
affected_rows(
)
{
- return
mysql_affected_rows
(
$this
->
conn
)
;
- }
- public
function
escape_value(
$value
)
{
- if
(
$this
->
real_escape_string_exists
)
{
- if
(
$this
->
magic_quotes_active
)
{
$value
=
stripslashes
(
$value
)
;
}
- $value
=
mysql_real_escape_string
(
$value
)
;
- }
else
{
- if
(
!
$this
->
magic_quotes_active
)
{
$value
=
addslashes
(
$value
)
;
}
- }
- return
$value
;
- }
- public
function
close_connection(
)
{
- if
(
isset
(
$this
->
conn
)
)
{
- mysql_close
(
$this
->
conn
)
;
- unset
(
$this
->
conn
)
;
- }
- }
- }
- $mydb
=
new
Database(
)
;
- ?>
And for the Login Script
- <?php
- if
(
isset
(
$_POST
[
'btnlogin'
]
)
)
{
- $email
=
trim
(
$_POST
[
'log_email'
]
)
;
- $upass
=
trim
(
$_POST
[
'log_pword'
]
)
;
- $h_upass
=
sha1
(
$upass
)
;
- if
(
$email
==
''
)
{
- echo
'Username or Password Not Registered! Contact Your administrator...'
;
- }
elseif
(
$upass
==
''
)
{
- echo
'Username or Password Not Registered! Contact Your administrator...'
;
- }
else
{
- $sql
=
"SELECT * FROM `user_info` WHERE `email`='"
.
$email
.
"' and `pword`='"
.
$h_upass
.
"'"
;
- $result
=
mysql_query
(
$sql
)
or die
;
- echo
$numrows
=
mysql_num_rows
(
$result
)
;
- if
(
$numrows
==
1
)
{
- $found_user
=
mysql_fetch_array
(
$result
)
;
- $_SESSION
[
'member_id'
]
=
$found_user
[
'member_id'
]
;
- $_SESSION
[
'fName'
]
=
$found_user
[
'fName'
]
;
- $_SESSION
[
'lName'
]
=
$found_user
[
'lName'
]
;
- $_SESSION
[
'email'
]
=
$found_user
[
'email'
]
;
- $_SESSION
[
'pword'
]
=
$found_user
[
'pword'
]
;
- $_SESSION
[
'gender'
]
=
$found_user
[
'gender'
]
;
- ?>
<script type="text/javascript">
- window.location = "home.php";
- </script>
- <?php
- }
else
{
- ?>
<script type="text/javascript">
- alert("Username or Password Not Registered! Contact Your administrator.");
- window.location = "home.php";
- </script>
- <?php
- }
- }
- }
else
{
- $email
=
""
;
- $upass
=
""
;
- $utype
=
""
;
- }
- ?>
Sample Image

For more tutorials just visit this website @www.sourcecodester.com and don't forget to Like and Share. Enjoy Coding.
Download
You must upgrade your account or reply in the thread to view hidden text.