• We just launched and are currently in beta. Join us as we build and grow the community.

Instagram Status Post

izanagi1995

AI Model Designer
I Rep
0
0
0
Rep
0
I Vouches
0
0
0
Vouches
0
Posts
159
Likes
21
Bits
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
  1. <?php
  2. require_once

    (

    LIB_PATH.

    DS.

    "config.php"

    )

    ;
  3. class

    Database {
  4. var

    $data

    ;
  5. var

    $sql_string

    =

    ''

    ;
  6. var

    $error_no

    =

    0

    ;
  7. var

    $error_msg

    =

    ''

    ;
  8. private

    $conn

    ;
  9. public

    $last_query

    ;
  10. private

    $magic_quotes_active

    ;
  11. private

    $real_escape_string_exists

    ;

  12. function

    __construct(

    )

    {
  13. $this

    ->

    open_connection

    (

    )

    ;
  14. $this

    ->

    magic_quotes_active

    =

    get_magic_quotes_gpc

    (

    )

    ;
  15. $this

    ->

    real_escape_string_exists

    =

    function_exists

    (

    "mysql_real_escape_string"

    )

    ;
  16. }
  17. public

    function

    open_connection(

    )

    {
  18. $this

    ->

    conn

    =

    mysql_connect

    (

    DB_SERVER,

    DB_USER,

    DB_PASS)

    ;
  19. if

    (

    !

    $this

    ->

    conn

    )

    {
  20. echo

    "Problem in database connection! Contact administrator!"

    ;
  21. exit

    (

    )

    ;
  22. }

    else

    {
  23. $db_select

    =

    mysql_select_db

    (

    DB_NAME,

    $this

    ->

    conn

    )

    ;
  24. if

    (

    !

    $db_select

    )

    {
  25. echo

    "Problem in selecting database! Contact administrator!"

    ;
  26. exit

    (

    )

    ;
  27. }
  28. }
  29. }
  30. function

    setQuery(

    $sql

    =

    ''

    )

    {
  31. $this

    ->

    sql_string

    =

    $sql

    ;
  32. }
  33. function

    executeQuery(

    )

    {
  34. $result

    =

    mysql_query

    (

    $this

    ->

    sql_string

    ,

    $this

    ->

    conn

    )

    ;
  35. $this

    ->

    confirm_query

    (

    $result

    )

    ;
  36. return

    $result

    ;
  37. }
  38. private

    function

    confirm_query(

    $result

    )

    {
  39. if

    (

    !

    $result

    )

    {
  40. $this

    ->

    error_no

    =

    mysql_errno

    (

    $this

    ->

    conn

    )

    ;
  41. $this

    ->

    error_msg

    =

    mysql_error

    (

    $this

    ->

    conn

    )

    ;
  42. return

    false

    ;
  43. }
  44. return

    $result

    ;
  45. }
  46. function

    loadResultList(

    $key

    =

    ''

    )

    {
  47. $cur

    =

    $this

    ->

    executeQuery

    (

    )

    ;
  48. $array

    =

    array

    (

    )

    ;
  49. while

    (

    $row

    =

    mysql_fetch_object

    (

    $cur

    )

    )

    {
  50. if

    (

    $key

    )

    {
  51. $array

    [

    $row

    ->

    $key

    ]

    =

    $row

    ;
  52. }

    else

    {
  53. $array

    [

    ]

    =

    $row

    ;
  54. }
  55. }
  56. mysql_free_result

    (

    $cur

    )

    ;
  57. return

    $array

    ;
  58. }
  59. function

    loadSingleResult(

    )

    {
  60. $cur

    =

    $this

    ->

    executeQuery

    (

    )

    ;
  61. while

    (

    $row

    =

    mysql_fetch_object

    (

    $cur

    )

    )

    {
  62. return

    $data

    =

    $row

    ;
  63. }
  64. mysql_free_result

    (

    $cur

    )

    ;
  65. }
  66. function

    getFieldsOnOneTable(

    $tbl_name

    )

    {
  67. $this

    ->

    setQuery

    (

    "DESC "

    .

    $tbl_name

    )

    ;
  68. $rows

    =

    $this

    ->

    loadResultList

    (

    )

    ;
  69. $f

    =

    array

    (

    )

    ;
  70. for

    (

    $x

    =

    0

    ;

    $x

    <

    count

    (

    $rows

    )

    ;

    $x

    ++

    )

    {
  71. $f

    [

    ]

    =

    $rows

    [

    $x

    ]

    ->

    Field

    ;
  72. }
  73. return

    $f

    ;
  74. }
  75. public

    function

    fetch_array(

    $result

    )

    {
  76. return

    mysql_fetch_array

    (

    $result

    )

    ;
  77. }
  78. public

    function

    num_rows(

    $result_set

    )

    {
  79. return

    mysql_num_rows

    (

    $result_set

    )

    ;
  80. }
  81. public

    function

    insert_id(

    )

    {
  82. return

    mysql_insert_id

    (

    $this

    ->

    conn

    )

    ;
  83. }
  84. public

    function

    affected_rows(

    )

    {
  85. return

    mysql_affected_rows

    (

    $this

    ->

    conn

    )

    ;
  86. }
  87. public

    function

    escape_value(

    $value

    )

    {
  88. if

    (

    $this

    ->

    real_escape_string_exists

    )

    {
  89. if

    (

    $this

    ->

    magic_quotes_active

    )

    {

    $value

    =

    stripslashes

    (

    $value

    )

    ;

    }
  90. $value

    =

    mysql_real_escape_string

    (

    $value

    )

    ;
  91. }

    else

    {
  92. if

    (

    !

    $this

    ->

    magic_quotes_active

    )

    {

    $value

    =

    addslashes

    (

    $value

    )

    ;

    }
  93. }
  94. return

    $value

    ;
  95. }
  96. public

    function

    close_connection(

    )

    {
  97. if

    (

    isset

    (

    $this

    ->

    conn

    )

    )

    {
  98. mysql_close

    (

    $this

    ->

    conn

    )

    ;
  99. unset

    (

    $this

    ->

    conn

    )

    ;
  100. }
  101. }
  102. }
  103. $mydb

    =

    new

    Database(

    )

    ;
  104. ?>

And for the Login Script
  1. <?php
  2. if

    (

    isset

    (

    $_POST

    [

    'btnlogin'

    ]

    )

    )

    {
  3. $email

    =

    trim

    (

    $_POST

    [

    'log_email'

    ]

    )

    ;
  4. $upass

    =

    trim

    (

    $_POST

    [

    'log_pword'

    ]

    )

    ;
  5. $h_upass

    =

    sha1

    (

    $upass

    )

    ;
  6. if

    (

    $email

    ==

    ''

    )

    {
  7. echo

    'Username or Password Not Registered! Contact Your administrator...'

    ;
  8. }

    elseif

    (

    $upass

    ==

    ''

    )

    {
  9. echo

    'Username or Password Not Registered! Contact Your administrator...'

    ;
  10. }

    else

    {
  11. $sql

    =

    "SELECT * FROM `user_info` WHERE `email`='"

    .

    $email

    .

    "' and `pword`='"

    .

    $h_upass

    .

    "'"

    ;
  12. $result

    =

    mysql_query

    (

    $sql

    )

    or die

    ;
  13. echo

    $numrows

    =

    mysql_num_rows

    (

    $result

    )

    ;
  14. if

    (

    $numrows

    ==

    1

    )

    {
  15. $found_user

    =

    mysql_fetch_array

    (

    $result

    )

    ;
  16. $_SESSION

    [

    'member_id'

    ]

    =

    $found_user

    [

    'member_id'

    ]

    ;
  17. $_SESSION

    [

    'fName'

    ]

    =

    $found_user

    [

    'fName'

    ]

    ;
  18. $_SESSION

    [

    'lName'

    ]

    =

    $found_user

    [

    'lName'

    ]

    ;
  19. $_SESSION

    [

    'email'

    ]

    =

    $found_user

    [

    'email'

    ]

    ;
  20. $_SESSION

    [

    'pword'

    ]

    =

    $found_user

    [

    'pword'

    ]

    ;
  21. $_SESSION

    [

    'gender'

    ]

    =

    $found_user

    [

    'gender'

    ]

    ;
  22. ?>

    <script type="text/javascript">
  23. window.location = "home.php";
  24. </script>
  25. <?php
  26. }

    else

    {
  27. ?>

    <script type="text/javascript">
  28. alert("Username or Password Not Registered! Contact Your administrator.");
  29. window.location = "home.php";
  30. </script>
  31. <?php
  32. }
  33. }
  34. }

    else

    {
  35. $email

    =

    ""

    ;
  36. $upass

    =

    ""

    ;
  37. $utype

    =

    ""

    ;
  38. }

  39. ?>

Sample Image

dasda.jpg


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.
 

452,292

323,341

323,350

Top