SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2011
    Location
    zziapex.com
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    help in multipal posting at a time

    Hello
    i have a problem in my post section.problem is like this
    Example:
    Suppose you wanna make ten posts in this forum and you open ten threads and click on "reply this post" and then you write your reply and press submit and post submit in correct thread.and you leave the forum

    But
    in my case when i open my ten threads and click "reply this post" and then i write reply and press submit then all reply appears in 10th threads

    please help me in this case

    and 2nd
    i wanna get the value of movie_id from this url on submit

    http://localhost/php/3rd-page-1.3.php?movie_id=5

    how can do this both please help me

  2. #2
    Foozle Reducer ServerStorm's Avatar
    Join Date
    Feb 2005
    Location
    Burlington, Canada
    Posts
    2,699
    Mentioned
    89 Post(s)
    Tagged
    6 Thread(s)
    @12345qwer

    It would help if you post your code as PHP is obviously not shown when we visit a php site. We also can't use the link you provided as it points to your locahost (which is your own machine); you need to have a public IP and port 80 open in your firewall, and your local host NATTED to the public I.P.

    Too little to go on at this point.
    ictus==""

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2011
    Location
    zziapex.com
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    my php code is this


    <?php
    session_start();
    error_reporting(~E_NOTICE);
    $_SESSION['user_id'];
    $_SESSION['username'];
    include("connection.php");

    $user_links = "";
    if (isset($_SESSION['user_id']))
    {
    $user_id = $_SESSION['user_id'];
    $username = $_SESSION['username'];
    $user_links = '<a href="member_profile.php?user_id=' . $user_id . '">' . $username . '</a> &nbsp; <a href="member_account.php">Account</a> &nbsp;<a href="logout.php">Log Out</a>';
    }
    else
    {
    $user_links = '<a href="register.php">Register</a> &nbsp; <a href="login.php">Login</a>';
    }

    $movie_id = $_SESSION['$movie_id'];
    $username = $_SESSION['username'];

    if (isset($_SESSION['user_id']))
    {
    if (isset($_POST['submit']))
    {

    $hosting_service=$_POST['hostingservice'];
    $file_type=$_POST['filetype'];
    $size=$_POST['size'];
    $audio_language=$_POST['language'];
    $post_links=$_POST['links'];
    $images = count($_FILES['images']['name']);

    if (!empty($movie_id) && !empty($hosting_service) && !empty($file_type) && !empty($size) && !empty($audio_language) && !empty($post_links))
    {
    include("connection.php");
    $query="INSERT INTO movie_posts set movie_id='$movie_id', post_username='$username', post_hosting_service='$hosting_service', post_quality_type='$file_type', post_size='$size',
    Post_updation_date=now()";
    $query_run=mysql_query($query);

    if ($query_run==1)
    {
    $post_id = mysql_insert_id();

    for($i=0;$i<count($audio_language);$i++)
    {
    $query="INSERT INTO post_audio_language set post_id='$post_id', post_audio_language='$audio_language[$i]'";
    $query_run=mysql_query($query);
    }

    for ($i=0;$i<count($post_links);$i++)
    {
    $query="INSERT INTO post_links set post_id='$post_id', post_links='$post_links[$i]'";
    $query_run=mysql_query($query);
    }

    for ($i = 0; $i < count($_FILES['images']['name']); $i++)
    {
    if(is_uploaded_file($_FILES['images']['tmp_name'][$i]))
    {
    if ($_FILES['images']['name'][$i] != '')
    {
    $uploaded_files[] = $_FILES['images']['name'][$i];

    if (move_uploaded_file($_FILES['images']['tmp_name'][$i], "film_images/" . $_FILES['images']['name'][$i]))
    {
    $query="INSERT INTO post_screen_shot set post_id='$post_id', post_screen_shot='$uploaded_files[$i]'";
    $query_run_final=mysql_query($query);
    }
    }
    }
    }

    if($query_run == 1)
    {
    $query_movie="UPDATE movies set addition_date=now() WHERE movie_id=" . $movie_id;
    $query_movie_run=mysql_query($query_movie);
    header("Location: 3rd-page-1.3.php?movie_id= $movie_id");
    }
    }

    }
    }
    }else{
    header("Location: login.php");
    }


    this is form for post...user provide require data and post will be make..problem is when i open two pages of forms at a time
    then $movie_id = $_SESSION['$movie_id'] overwrite with new value
    i want both values
    how can i do this?

  4. #4
    Foozle Reducer ServerStorm's Avatar
    Join Date
    Feb 2005
    Location
    Burlington, Canada
    Posts
    2,699
    Mentioned
    89 Post(s)
    Tagged
    6 Thread(s)
    @12345qwer

    When using PHP sessions, only a single session is open with your browser. If you try for instance using firefox and chrome then two unique sessions with their own movie_id's would be created. If a single user is expected to have this functionality then SESSIONS won't work; Instead you can write the movie_id (and other data using serialize) to a database table that stores it linked to a unique_id (say the user or a token stored in the session. a user can then open as many tabs as they want and the database can keep track of. Then when you need to process all the posted data you query the unique value and process accordingly.

    Steve
    ictus==""


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •