help me to code this... (post with file)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    help me to code this... (post with file)

    this is in genproc.php
    else if($action=="post3")
    {
    $uid = getuid_sid($sid);
    $descript = $_POST["descript"];
    $tid = $_POST["tid"];
    $tfid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$tid."'"));

    if(!canaccess(getuid_sid($sid), $tfid[0]))
    {
    echo xhtmlheadnotheme("$sitetitle");
    echo "<p align=\"center\">";
    echo "You Don't Have A Permission To View The Contents Of This Forum<br/><br/>";
    echo "<a href=\"index.php?action=main\">Home</a>";
    echo "</p>";
    echo xhtmlfoot();
    exit();
    }

    $reptxt = $_POST["reptxt"];
    $qut = $_POST["qut"];

    addonline(getuid_sid($sid),"Posted a Reply - xHTML:v3","");
    echo "<head>\n";
    echo "<title>$sitetitle</title>\n";
    echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"themes/$theme[0]\">";
    echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />\n";
    echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />\n";
    echo "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n";
    echo "</head>";
    echo "<body>";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"60\" width=\"159\">";
    echo "<tr>";
    echo "<td id=\"body\" width=\"159\">";
    echo "</td>";
    echo "</tr>";
    echo "</table>";

    echo "<table border=\"0\" width=\"99%\" cellspacing=\"0\" cellpadding=\"0\" class=\"boxed\" align=\"center\">";
    echo "<tr>";
    echo "<td class=\"boxedTitle\" height=\"20\">";
    echo "<h1 align=\"center\" class=\"boxedTitleText\">posted reply</h1></td>";
    echo "</tr>";
    echo "<p align=\"center\">";
    $crdate = time();
    $fid = getfid($tid);

    $res = false;
    $closed = mysql_fetch_array(mysql_query("SELECT closed FROM ibwf_topics WHERE id='".$tid."'"));

    if(($closed[0]!='1')||(ismod($uid)))
    {

    $lpost = mysql_fetch_array(mysql_query("SELECT dtpost FROM ibwf_posts WHERE uid='".$uid."' ORDER BY dtpost DESC LIMIT 1"));
    global $post_af;
    $antiflood = time()-$lpost[0];
    if($antiflood>$post_af)
    {
    if(trim($reptxt)!="")
    {
    $res = mysql_query("INSERT INTO ibwf_posts SET text='".$reptxt."', tid='".$tid."', uid='".$uid."', dtpost='".$crdate."', quote='".$qut."'");
    }
    if($res)
    {
    $usts = mysql_fetch_array(mysql_query("SELECT posts, plusses FROM ibwf_users WHERE id='".$uid."'"));
    $ups = $usts[0]+1;
    $upl = $usts[1]+10;
    mysql_query("UPDATE ibwf_users SET posts='".$ups."', plusses='".$upl."' WHERE id='".$uid."'");
    mysql_query("UPDATE ibwf_topics SET lastpost='".$crdate."' WHERE id='".$tid."'");
    echo "<img src=\"images/ok.gif\" alt=\"O\"/>Message Posted Successfully";
    echo "<br/><br/><a href=\"index.php?action=viewtpc&amp;tid=$tid&amp;g o=last\">";
    echo "View Topic</a>";
    }else{
    echo "<img src=\"images/notok.gif\" alt=\"X\"/>Error Posting Message";
    }
    }else{
    $af = $post_af -$antiflood;
    echo "<img src=\"images/notok.gif\" alt=\"X\"/>Antiflood Control: $af";
    }
    }else{
    echo "<img src=\"images/notok.gif\" alt=\"X\"/>Topic is closed for posting";
    }

    $size = $_FILES['attach']['size']/1024;
    $origname = $_FILES['attach']['name'];
    $ext = explode(".", strrev($origname));
    switch(strtolower($ext[0])){
    case "dim":
    $res = true;
    break;
    case "3pm":
    $res = true;
    break;
    case "mr":
    $res = true;
    break;
    case "fdp":
    $res = true;
    break;
    case "4pm":
    $res = true;
    break;
    case "iva":
    $res = true;
    break;
    case "rma":
    $res = true;
    break;
    case "vaw":
    $res = true;
    break;
    case "gpj":
    $res = true;
    break;
    case "gnp":
    $res = true;
    break;
    case "pmb":
    $res = true;
    break;
    case "fig":
    $res = true;
    break;
    case "pg3":
    $res = true;
    break;
    case "piz":
    $res = true;
    break;
    case "rar":
    $res = true;
    break;
    case "sis":
    $res = true;
    break;
    case "raj":
    $res = true;
    break;
    case "exe":
    $res = true;
    break;
    case "gepj":
    $res = true;
    break;
    }
    $tm = time();
    $uploaddir = $mmsdir; //can be configured in config.php
    $who = getuid_nick($pmtou);
    echo "<p align=\"center\">";
    if($size>804{
    echo "File is larger than 8MB";

    }
    else if ($res!=true){

    echo "File type not supported! Please attach only a JPG or JPEG or GIF or BMP or PNG or 3GP or MID or WAV or MP3 or MP4 or AVI or AMR or SIS or EXE or ZIP or JAR or RAR or PDF file";
    }
    $tid = $_POST["tid"];
    $name = mysql_fetch_array(mysql_query("SELECT (MAX(id)+1) FROM files"));
    $uploadfile = $name[0].".".strrev($ext[0]);
    move_uploaded_file($_FILES['attach']['tmp_name'], "$uploaddir/$uploadfile");
    $ext=strrev($ext[0]);
    $res1 = mysql_query("INSERT INTO files SET uid='".$uid."', origname='".$origname."', filename='".$uploadfile."', size='$size', extension='".$ext."'");

    if($res1){
    echo "Poruka je poslata..";
    }
    else {
    echo "Ne mozete upisati post...";
    }
    echo "</p>";

    echo "<br/>";

    echo "<a href=\"index.php?action=main\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
    echo "</p>";

    echo xhtmlfoot();
    }

    this is in index.php


    echo "<center><form enctype=\"multipart/form-data\" action=\"genproc.php?action=post3\" method=\"post\">";
    echo "Tekst:<input name=\"reptxt\" value=\"\" maxlength=\"500\"/><br/>";
    echo "<input type=\"hidden\" name=\"tid\" value=\"$tid\"/>";
    <br/><br/>File:<br/>";
    echo "<input id=\"inputText\" type=\"file\" name=\"attach\"/><br/>";
    echo "<input id=\"inputButton\" type=\"submit\" name=\"submit\" value=\"Send\"/>";
    echo "</form></center>";
    and this is tables.
    CREATE TABLE IF NOT EXISTS `files` (
    `id` int( 11 ) NOT NULL AUTO_INCREMENT ,
    `filename` varchar( 15 ) NOT NULL default '',
    `extension` varchar( 5 ) NOT NULL default '',
    `size` int( 11 ) NOT NULL default '0',
    `origname` varchar( 50 ) NOT NULL default '',
    PRIMARY KEY ( `id` )
    ) ENGINE = MYISAM DEFAULT CHARSET = latin1 AUTO_INCREMENT =268;


    but i don't know how to show this in index.php?action=viewtpc ... pls help
    .
    http://www.youtube.com/watch?v=vsLkpcFKbOk

    #2
    just add that code onto viewtpc
    PHP Code:
    echo "<center><form enctype=\"multipart/form-data\" action=\"genproc.php?action=post3\" method=\"post\">";
    echo 
    "Tekst:<input name=\"reptxt\" value=\"\" maxlength=\"500\"/><br/>";
    echo 
    "<input type=\"hidden\" name=\"tid\" value=\"$tid\"/>";
    <
    br/><br/>File:<br/>";
    echo "
    <input id=\"inputText\" type=\"file\" name=\"attach\"/><br/>";
    echo 
    "<input id=\"inputButton\" type=\"submit\" name=\"submit\" value=\"Send\"/>";
    echo 
    "</form></center>"
    where ever u want it to show

    Comment


      #3
      Originally posted by something else View Post
      just add that code onto viewtpc
      PHP Code:
      echo "<center><form enctype=\"multipart/form-data\" action=\"genproc.php?action=post3\" method=\"post\">";
      echo 
      "Tekst:<input name=\"reptxt\" value=\"\" maxlength=\"500\"/><br/>";
      echo 
      "<input type=\"hidden\" name=\"tid\" value=\"$tid\"/>";
      <
      br/><br/>File:<br/>";
      echo "
      <input id=\"inputText\" type=\"file\" name=\"attach\"/><br/>";
      echo 
      "<input id=\"inputButton\" type=\"submit\" name=\"submit\" value=\"Send\"/>";
      echo 
      "</form></center>"
      where ever u want it to show
      lol...not that ....i want to show file which is uploded in folder,in user's posts (index.php?action=viewtpc)
      Last edited by rap-4ever; 12.11.09, 19:34.
      http://www.youtube.com/watch?v=vsLkpcFKbOk

      Comment


        #4
        there is no update of topic number here:
        $res1 = mysql_query("INSERT INTO files SET uid='".$uid."', origname='".$origname."', filename='".$uploadfile."', size='$size', extension='".$ext."'");

        so how your going to request it in a topic or post ... i dont know

        Comment


          #5
          Originally posted by something else View Post
          there is no update of topic number here:
          $res1 = mysql_query("INSERT INTO files SET uid='".$uid."', origname='".$origname."', filename='".$uploadfile."', size='$size', extension='".$ext."'");

          so how your going to request it in a topic or post ... i dont know
          i need function post id.... like this: $info = mysql_fetch_array(mysql_query("SELECT filename, size, extension, origname FROM files WHERE id='".$fileid."'"));

          $fileid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_posts"));




          echo "$usl: $fli$pst $topt<br/>$info[4]";
          http://www.youtube.com/watch?v=vsLkpcFKbOk

          Comment


            #6
            yep i guess u could do it like that aslong as your sql field id is set to auto-increasement

            i would probably use a diifernt field like post_id or pid in files

            Comment


              #7
              $fileid = mysql_fetch_array(mysql_query("SELECT pid FROM files WHERE pid='".$pid."'"));

              but what is $pid... i am stupid for sql..
              http://www.youtube.com/watch?v=vsLkpcFKbOk

              Comment


                #8
                pid will be post id number .... without it how u going to know which post it belongs to

                so will need to add pid to your sql also

                Comment


                  #9
                  where i need add pid field? in ibwf_posts or files ?
                  Last edited by rap-4ever; 12.11.09, 23:42.
                  http://www.youtube.com/watch?v=vsLkpcFKbOk

                  Comment


                    #10
                    Originally posted by rap-4ever View Post
                    where i need add pid field? in ibwf_posts or files ?
                    Think about it... a little thinking gets you along way.! hes told you everything you need to know, you just got to work out how/where it all goes ;)

                    its not hard..

                    Comment


                      #11
                      i make filed pid,but i don`t know how to do this.... i think why i don't use this :
                      add fields:

                      `fileid` int( 11 ) NOT NULL default '',
                      `filename` varchar( 15 ) NOT NULL default '',
                      `extension` varchar( 5 ) NOT NULL default '',
                      `size` int( 11 ) NOT NULL default '0',
                      `origname` varchar( 50 ) NOT NULL default '',

                      in ibwf_post and edit genproc.php

                      or just edit auto-increasement 267 to 1 :D
                      http://www.youtube.com/watch?v=vsLkpcFKbOk

                      Comment


                        #12
                        or add field in ibwf_posts fileid and add field pid in files... :D
                        http://www.youtube.com/watch?v=vsLkpcFKbOk

                        Comment


                          #13
                          Originally posted by WhiteWarrior View Post
                          Think about it... a little thinking gets you along way.! hes told you everything you need to know, you just got to work out how/where it all goes ;)

                          its not hard..
                          lol I like ya avatar lol worry now lol
                          Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
                          Visit: WapMasterz Coming Back Soon!
                          _______
                          SCRIPTS FOR SALE BY SUBZERO
                          Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
                          FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
                          _______
                          Info & Tips
                          php.net
                          w3schools.com

                          Comment


                            #14
                            don't spam! :D you are mod :PP
                            http://www.youtube.com/watch?v=vsLkpcFKbOk

                            Comment


                              #15
                              i try to use this,but not working.... i don't know to create this...

                              $fileid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_posts"));
                              $ikkk = mysql_fetch_array(mysql_query("SELECT id FROM files"));
                              $info = mysql_fetch_array(mysql_query("SELECT filename, size, extension, origname FROM files"));
                              $tpk = mysql_fetch_array(mysql_query("SELECT tid FROM files"));
                              $tpg = mysql_fetch_array(mysql_query("SELECT tid FROM ibwf_posts"));



                              if($fileid=$ikkk && $tpk=$tpg[2]){


                              echo "$usl: $fli$pst $topt<br/>$info[3]";



                              $dtot = date("d-m-y - H:i:s",$post[3]);

                              echo $dtot;

                              echo "<br/>";
                              }else{
                              }
                              }
                              Last edited by rap-4ever; 13.11.09, 16:38.
                              http://www.youtube.com/watch?v=vsLkpcFKbOk

                              Comment

                              Working...
                              X