Smilies uploader

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

  • riderz
    replied
    i have added the code work nice except it dnt put the smilies code into the smilies list

    Leave a comment:


  • Guest
    Guest replied
    smilies upload tool for 2indi

    you need to add an extra field into the ibwf_smilies table called filename for this script to work right or delete the bit of coding that links to the filename field. Hope this helps.

    PHP Code:
    <?php
    include("config.php");
    include(
    "core.php");
    connectdb();
    $sid = $_GET["sid"];
    $page = $_GET["page"];
    $who = $_GET["who"];
    $uid = getuid_sid($sid);
    $desc = $_POST['desc'];
    $upload = $_POST['upload'];
    $superdat = $_FILES['superdat']['tmp_name'];
    $superdat_name=$_FILES['superdat']['name'];
    echo(
    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    echo 
    "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD XHTML Mobile 1.0//EN\"". " \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
    echo 
    "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
    ?>
    <head>
    <title>Uploader</title>
    <meta forua="true" http-equiv="Cache-Control" content="no-cache"/>
    <meta forua="true" http-equiv="Cache-Control" content="must-revalidate"/>
    <?php
    echo gettheme($sid);
    ?>
    </head>
    <body>
    <?php
    ////////this is my can use upload tools replace with your isadmin 
    //////////////////////
    if(!uploadtool(getuid_sid($sid)))
      {
          echo 
    "<p align=\"center\">";
          echo 
    "You are not an admin<br/>";
          echo 
    "<br/>";
          echo 
    "<a href=\"index.php$sid\">Home</a>";
          echo 
    "</p></div></div></font></body>";
          echo 
    "</html>";
          exit();
        }
    //////////////////////////

    if((islogged($sid)==false)||($uid==0))
        {
    boxstart("Error!");
        echo 
    "<center><img src=\"images/notok.gif\" alt=\"\"/><small>You are not logged in<br/>";
    echo 
    "or your session has expired.<br/><br/>";
    echo 
    "
                 
                  <form action=\"login.php\" method=\"get\">
                     <img src=\"images/user.gif\" alt=\"\"/>Enter username:<br/>
                       <input id=\"inputText\" name=\"loguid\" maxlength=\"30\"/><br/>
                                 <img src=\"images/pass.gif\" alt=\"\"/>Enter password:<br/>
                       <input id=\"inputText\" type=\"password\" format=\"*x\" name=\"logpwd\"  maxlength=\"30\"/><br/>
                                   <input id=\"inputButton\" type=\"submit\" value=\"Login\"/><br/>
                  </form>
                              <br/><br/><img src=\"images/register.gif\" alt=\"\"/><a href=\"register.php\">Register</a>
                                   <br/><img src=\"images/home.gif\" alt=\"\"/><a href=\"index.php\">Home</a>
                       </small></center></div></div></body></html>"
    ;
    exit();
        }
        if(
    isbanned($uid))
        {
            
    boxstart("Error!");


    echo 
    "<small><p align=\"center\"><img src=\"images/notok.gif\" alt=\"\"/>
    You have been <b>BANNED!</b><br/>"
    ;
    $banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1'"));
    $banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));
    $remain = $banto[0] - time();
    $rmsg = gettimemsg($remain);
    echo 
    "Ban Reason: ".$banres[0]." <br/>You can login again after ".$rmsg."
    </p></small></div></div>
    </body>
    </html>"
    ;
    exit();
        }
        
        
    boxstart("Upload Smilie");
    echo 
    "<small><p>";
    addonline(getuid_sid($sid),"Tools","");
    if (
    $upload="upload"&&$superdat_name)
    {
    if (!
    eregi("\.(gif|bmp|jpeg|jpg|png)$",$superdat_name))
    {
    print 
    "<b>Unsupported File Extention! Supported types are gif, bmp, jpeg, jpg, png</b>";
    }else
    {
    $superdat_name = preg_replace(
                 
    '/[^a-zA-Z0-9\.\$\%\'\`\-\@\{\}\~\!\#\(\)\&\_\^]/'
                 
    ,'',str_replace(array(' ','%20',"'"),array('_','_', ""),$superdat_name));
    if(
    strlen($superdat_name)>53){ print "<b>File Name Is Too Long!</b>";
    }
    else
    {
    if (empty(
    $superdat)) 
    {
    print 
    "<b>No input file specified!!!</b>";
    }
    if (empty(
    $desc)) 
    {
    print 
    "<b>No smilie code specified!!!</b>";
    }
    else
    {    
    $exi1 = mysql_query("SELECT COUNT FROM ibwf_smilies WHERE scode='$desc'");
    if(
    $exi1[0]>0){
        print 
    "<b>Smilie code already exists!!!</b>";
        exit();
    }
    else
    {
    $exi2 = mysql_fetch_array(mysql_query("SELECT COUNT(id), MAX(id) FROM ibwf_smilies WHERE filename='".$superdat_name."' "));
    if(
    $exi2[0]>0)
    {
    $superdat_name="1".$superdat_name;
    $flag1="<br/>Filename already existed but code didnt match so it was renamed and prefixed witha 1";
    }
    }
    echo 
    mysql_error();
    $ext = explode(".", strrev($superdat_name));
    switch(
    strtolower($ext[0]))
    {
        case 
    "fig":
             
    $type="image";
             break;
        case 
    "gnp":
             
    $type="image";
             break;
        case 
    "gpj":
             
    $type="image";
             break;
        case 
    "gepj":
             
    $type="image";
             break;
        case 
    "pmb":
             
    $type="image";
             break;
        case 
    "pmbw":
             
    $type="image";
             break;
    }
    $uploads_dir = './smilies';/

    ////////////// replace this with your smilies folder
    $ims = "http://domain.co.uk/smilies/$superdat_name";
    ///////////////////
    move_uploaded_file("$superdat", "$uploads_dir/$superdat_name") or
    die(
    "Couldn't copy file.");



    $result=mysql_query("INSERT INTO `web102-users-1`.`ibwf_smilies` (`id`, `scode`, `imgsrc`, `hidden`, `filename`) VALUES (NULL, '$desc', '$ims', '0', '$superdat_name')");

    echo 
    "<b>$superdat_name</b> has successfully been uploaded to the smilies place with the code $desc";
    }
    }
    }
    }
    ?>
    <?php
    echo "<form align=\"center\" action=\"adminsmilies.php?sid=$sid\" method=\"post\" enctype=\"multipart/form-data\">";
    ?>
    »Upload file size limit is 1MB<br/>
    <b>Enter Smilie BB Code(Maximum 25 chars):</b><br/>
    <input id="inputText" align="center" type="text" name="desc" maxlength="255"/><br/>
    <b>Select File To Be Uploaded :</b><br/>
    <input id="inputText" align="center" type="file" name="superdat"/><br/>
    <input id="inputText" align="center" type="hidden" name="upload" value="upload"/>
    <input id="inputButton" align="center" type="submit" name="submit" value="Upload File!"/><br/><br/> <b><u>You can upload smilies with folowing extentions:</u></b><br/>
    Image: gif, bmp, jpeg, jpg, png<br/>
    <hr/>
    <?php
    //////////Replace this with your admin tools link
    echo "<br/><a href=\"tools.php?action=tools&amp;sid=$sid\">Tools</a>"; 
    //////////////////////////////////////////////////

    ?>
    </form>
    </p></small>
    <?php
    boxend
    ();
    echo 
    getfooter($sid);
    ?>
    </body></html>
    Almost forgot there is a few things you need to change but I have showed them in the coding and save the file as adminsmilies.php

    Leave a comment:


  • Guest
    Guest replied
    im guessing that this is for 2indi site i have got sorted for that site inbox me and ill send you the script for it if you still need it

    Leave a comment:


  • riderz
    replied
    here are the one from wapesire i try to make my smilie uploader like this
    Code:
    addonline(getuid_sid($sid),"Upload Files","");
    echo head_tag(getnick_sid($sid)."@Upload Files",1,getnick_sid($sid));
    echo"<u><i><b>Upload Files</b></i></u><br/>";	
    echo"<p align=".align().">\n";
    $size_bytes=2097512;
    echo"Max <b>".round($size_bytes/1048576,1)."</b> Mb
    </p>
    <div class=".align().">
    <form method=\"post\" enctype=\"multipart/form-data\" action=\"./upload.php?upload=yes&amp;sid=$sid\">
    <b>Code:</b><br/>
    <input name=\"code\" maxlength=\"100\" value=\"\"/><br/>
    <b>Site Image:</b><br/>
    <select name=\"mood\">
    <option value=\"0\">No</option>
    <option value=\"1\">Yes</option>
    </select><br/>
    <b>Hidden:</b><br/>
    <select name=\"hidden\">
    <option value=\"0\">No</option>
    <option value=\"1\">Yes</option>
    </select><br/>
    <b>Smiley:</b><br/>
    <input type=\"file\" name=\"filetoupload\"/><br>
    <input type=\"submit\" name=\"uploadform\" value=\"Upload\"/>
    </form>
    </div>
    <p align=".align().">\n";
    $extlimit="yes";
    $limitedext=array(".jpg",".jpeg",".gif");
    $ext=strtolower(strrchr($_FILES['filetoupload'][name],'.'));
    $file_type=$_FILES['filetoupload']['type'];
    $file_name=$_FILES['filetoupload']['name'];
    $file_size=$_FILES['filetoupload']['size'];
    $file_tmp=$_FILES['filetoupload']['tmp_name'];
    if($upload=="yes"){
    if(!is_uploaded_file($_FILES['filetoupload']['tmp_name'])){
    echo"<img src=\"../images/error.gif\" alt=\"[x]\"/>No file selected!<br/>\n";
    }
    else if($extlimit=="yes" && !in_array($ext,$limitedext)){
    echo"<img src=\"../images/error.gif\" alt=\"[x]\"/>Invalid file type!<br/>\n";
    }
    else if($file_size>$size_bytes){
    echo"<img src=\"../images/error.gif\" alt=\"[x]\"/>Exceeded File size limit! Maximum <b>$kb</b> Kb.<br/>\n";
    }
    else if(file_exists("./$file_name")){
    echo"<img src=\"../images/error.gif\" alt=\"[x]\"/>Filename already exists!<br/>\n";
    }
    else if($file_size){
    $file_name=str_replace(" ","",$file_name);
    mysql_query("INSERT INTO smilies SET code='".$code."', path='smilies/".$file_name."', hidden='".$hidden."', mood='".$mood."', date='".time()."'"); 
    move_uploaded_file($file_tmp, "./".$file_name);
    echo"<img src=\"./$file_name\" alt=\"$file_name\"/><br/>
    successfully uploaded!<br/>\n";
    }
    else{
    echo"<img src=\"../images/error.gif\" alt=\"[x]\"/>Unknown error! Pls try again...<br/>\n";
    }
    }
    echo"<a href=\"../admin/tools.php?type=tools&amp;sid=$sid\">Back</a>";
    echo"</p>";

    Leave a comment:


  • riderz
    replied
    Ok i got a step further with my prob
    Code:
    /////////////////////////////upload//////////////////////////////
    
    else if($action=="upload")
    {
    if((isowner(getuid_sid($sid)))||(isadmin(getuid_sid($sid))))
    {
    $script2 = $_GET["prevscript"];
    addonline(getuid_sid($sid),"Uploading Smilies","");
    if($script=="wml"){
    echo "<card id=\"main\" title=\"Gallery Pics\">";
    }else{
    echo "<head>";
    echo "<title>Upload Smilie</title>";
    echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
    echo "</head>";
    echo "<body>";
    }
    echo "<p align=\"center\">";
    echo "<u><i><b>Upload</b></i></u><br/>";
    echo "Image Files<br/>";
    $size_bytes = 2048000;
    $kb = $size_bytes / 1024;
    $mb = $kb / 1024;
    echo "Max <b>$mb</b> Mb<br/>";
    if($script=="wml"){
    echo "<img src=\"../images/point.gif\" alt=\"!\"/>Browser not compatible wif xhtml uploader";
    }else{
    $pstyle = gettheme($sid);
      echo xhtmlhead("$stitle",$pstyle);
    boxstart("Upload");
       echo "<go href=\"ownerproc.php?action=addsml&amp;sid=$sid\" method=\"post\">";
      echo "Code:<input name=\"smlcde\" maxlength=\"30\"/><br/>";
    echo "<form method=\"post\" enctype=\"multipart/form-data\" action=\"index.php?action=upload&amp;sid=$sid&amp;upload=add&amp;script=$script&amp;prevscript=$script2\">";
    echo "<input type=\"file\" name=\"filetoupload\"><br>";
    echo "<input type=\"Submit\" name=\"uploadform\" value=\"Upload\">";
    echo "</form>";
    }boxend();
    $upload_dir = "./";
    $filename = $_FILES['filetoupload']['name'];
    $size = $_FILES['filetoupload']['size'];
    $extlimit = "yes";
    $limitedext = array(".jpeg",".jpg",".JPEG",".JPG",".gif",".GIF",".png",".PNG");
    $ext = strrchr($_FILES['filetoupload'][name],'.');
    
    if($upload=="add"){
    if (!is_uploaded_file($_FILES['filetoupload']['tmp_name']))
    {
    echo "<img src=\"../images/notok.gif\" alt=\"(error)\"/>No file selected!<br/>";
    echo "<br/>";
    echo "<a href=\"index.php?action=smilies&amp;sid=$sid&amp;script=$script2\">Back</a><br/>";
    if($script2=="wml"){
    echo "<a href=\"../index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
    }else{
    echo "<b>0 </b><a accesskey=\"0\" href=\"../index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
    }
    echo "</p>";
    if($script=="wml"){
    echo "</card>";
    }else{
    echo "</body>";
    }
    exit();
    }
    
    if (($extlimit == "yes") && (!in_array($ext,$limitedext)))
    {
    echo("<img src=\"../images/notok.gif\" alt=\"(error)\"/>Invalid file type!<br/>");
    echo "<br/>";
    echo "<a href=\"index.php?action=smilies&amp;sid=$sid&amp;script=$script2\">Back</a><br/>";
    if($script2=="wml"){
    echo "<a href=\"../index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
    }else{
    echo "<b>0 </b><a accesskey=\"0\" href=\"../index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
    }
    echo "</p>";
    if($script=="wml"){
    echo "</card>";
    }else{
    echo "</body>";
    }
    exit();
    }
    this is the upload part in my smilies list now the prob is the pic get uploaded to database but the file dnt get uploaded to the smilies folder

    there are a code that have to be placed in my ownercp but dnt know how
    Code:
    else if($action=="addusml")
    {$pstyle = gettheme($sid);
    	echo xhtmlhead("$stitle",$pstyle);
    boxstart("addsml");
      $smlcde = $_POST["smlcde"];
      $smlsrc = $_POST["smlsrc"];
    		echo "<p align=\"center\">";
    		echo "<br/>";
    		$res = mysql_query("INSERT INTO ibwf_usersmilies SET scode='".$smlcde."', imgsrc='".$smlsrc."', hidden='0'");
    
    		if($res)
    	  {
    		echo "<img src=\"images/ok.gif\" alt=\"O\"/>Smilie  added successfully";
    	  }else{
    		echo "<img src=\"images/notok.gif\" alt=\"X\"/>Error adding Smilie ";
    	  }
    	  echo "<br/><br/><a href=\"ownercp.php?action=addusml&amp;sid=$sid\">";
      echo "Add Another Smilie</a><br/>";
    	  echo "<a href=\"index.php?action=ownercp&amp;sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
      echo "owner CP</a><br/>";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
      echo "Home</a>";
    
    	  echo "</p></body>";
    }

    Leave a comment:


  • Vayne
    replied
    Originally posted by riderz View Post
    admincp
    Code:
    else if($action=="addsml")
    {
        
        echo "<p align=\"center\">";
        echo "<b>Add Smilies</b><br/><br/>";
    echo "<form action=\"admproc.php?action=addsml&amp;sid=$sid\" method=\"post\">";
        echo "Code:<input name=\"smlcde\" maxlength=\"30\"/><br/>";
        echo "Image Source:<input name=\"smlsrc\" maxlength=\"200\"/><br/>";
     echo "<input type=\"submit\" value=\"Add\"/>";
    echo "</form>";
        echo "<br/><br/><a href=\"index.php?action=admincp&amp;sid=$sid\"><img src=\"http://coding-talk.com/images/admn.gif\" alt=\"*\"/>";
      echo "Admin CP</a><br/>";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"http://coding-talk.com/images/home.gif\" alt=\"*\"/>";
      echo "Home</a>";
      echo "</p>";
        
    }
    adminproc
    Code:
    else if($action=="addsml")
    {
      $smlcde = $_POST["smlcde"];
      $smlsrc = $_POST["smlsrc"];
        
          echo "<p align=\"center\">";
            echo "<br/>";
            $res = mysql_query("INSERT INTO fun_smilies SET scode='".$smlcde."', imgsrc='".$smlsrc."', hidden='0'");
    
            if($res)
          {
            echo "<img src=\"http://coding-talk.com/images/ok.gif\" alt=\"O\"/>Smilie  added successfully";
          }else{
            echo "<img src=\"http://coding-talk.com/images/notok.gif\" alt=\"X\"/>Error adding Smilie ";
          }
    
          echo "<br/><br/><a href=\"admincp.php?action=addsml&amp;sid=$sid\">";
      echo "Add Another Smilie</a><br/>";
          echo "<a href=\"index.php?action=admincp&amp;sid=$sid\"><img src=\"http://coding-talk.com/images/admn.gif\" alt=\"*\"/>";
      echo "Admin CP</a><br/>";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"http://coding-talk.com/images/home.gif\" alt=\"*\"/>";
      echo "Home</a>";
    
          echo "</p>";
    }
    who can help me to make this code from url to device upload
    maybe take compile with good old lavalair /adminx/ upload?

    Leave a comment:


  • riderz
    started a topic Smilies uploader

    Smilies uploader

    admincp
    Code:
    else if($action=="addsml")
    {
        
        echo "<p align=\"center\">";
        echo "<b>Add Smilies</b><br/><br/>";
    echo "<form action=\"admproc.php?action=addsml&amp;sid=$sid\" method=\"post\">";
        echo "Code:<input name=\"smlcde\" maxlength=\"30\"/><br/>";
        echo "Image Source:<input name=\"smlsrc\" maxlength=\"200\"/><br/>";
     echo "<input type=\"submit\" value=\"Add\"/>";
    echo "</form>";
        echo "<br/><br/><a href=\"index.php?action=admincp&amp;sid=$sid\"><img src=\"http://coding-talk.com/images/admn.gif\" alt=\"*\"/>";
      echo "Admin CP</a><br/>";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"http://coding-talk.com/images/home.gif\" alt=\"*\"/>";
      echo "Home</a>";
      echo "</p>";
        
    }
    adminproc
    Code:
    else if($action=="addsml")
    {
      $smlcde = $_POST["smlcde"];
      $smlsrc = $_POST["smlsrc"];
        
          echo "<p align=\"center\">";
            echo "<br/>";
            $res = mysql_query("INSERT INTO fun_smilies SET scode='".$smlcde."', imgsrc='".$smlsrc."', hidden='0'");
    
            if($res)
          {
            echo "<img src=\"http://coding-talk.com/images/ok.gif\" alt=\"O\"/>Smilie  added successfully";
          }else{
            echo "<img src=\"http://coding-talk.com/images/notok.gif\" alt=\"X\"/>Error adding Smilie ";
          }
    
          echo "<br/><br/><a href=\"admincp.php?action=addsml&amp;sid=$sid\">";
      echo "Add Another Smilie</a><br/>";
          echo "<a href=\"index.php?action=admincp&amp;sid=$sid\"><img src=\"http://coding-talk.com/images/admn.gif\" alt=\"*\"/>";
      echo "Admin CP</a><br/>";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"http://coding-talk.com/images/home.gif\" alt=\"*\"/>";
      echo "Home</a>";
    
          echo "</p>";
    }
    who can help me to make this code from url to device upload
    Last edited by riderz; 24.07.09, 19:04.
Working...
X