Poems

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

    Poems

    usage
    Code:
     echo "<img src=\"images/new.gif\" alt=\"\"/><a href=\"lists.php?action=allpo&amp;sid=$sid\">Members Poems!!</a><br/>";
    index.php
    Code:
    ////////////////////////////////////////////////////////////////ADD POEMS ///////////////////////
    else if($action=="addpoem")
    {
    addonline(getuid_sid($sid),"XHTML - Adding a Poem","");
     
        boxstart("Add A New Poem!");
    	
        echo "<form action=\"index.php?action=addpoem2&amp;sid=$sid\" method=\"post\">";
        echo "Title:<br/><input id=\"inputText\" name=\"btitle\" maxlength=\"255\"><br/>";
        echo "Text:<br/><textarea id=\"inputText\" name=\"msgtxt\" rows=\"8\"></textarea><br/>";
        echo "<input type=\"Submit\" id=\"inputText\" name=\"Add\" Value=\"Add\"></form>";
                  
     
        
    boxend();
    getfooter($sid);
    }
    //////////////////////////////////////////////
    else if($action=="viewpoem")
    {
      $bid = $_GET["bid"];
      addonline(getuid_sid($sid),"XHTML - Viewing A Users Poem","");
    
        	    boxstart("View Poems!");
    	  
      
    
      $pminfo = mysql_fetch_array(mysql_query("SELECT btext, bname, bgdate,bowner, id FROM ibwf_poems WHERE id='".$bid."'"));
        $bttl = htmlspecialchars($pminfo[1]);
        $btxt = parsemsg($pminfo[0], $sid);
    	$btxt2=nl2br($btxt);
      $tmstamp = $pminfo[2];
      $tmdt = date("d/m/y @ h:i:s", $tmstamp);
        $bnick = getnick_uid($pminfo[3]);
      $vbbl = "<a href=\"index.php?action=viewuser&amp;who=$pminfo[3]&amp;sid=$sid\">$bnick</a><br/>Posted: $tmdt<br/>";
      echo "Poem ID: <b>$bid</b><br/>";
        echo "<b>$bttl</b> by: $vbbl<br/>";
      echo "$btxt2<br/><br/>";
    
    
      $vb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_prate WHERE uid='".$uid."' AND blogid='".$bid."'"));
      if($vb[0]==0)
      {
      echo "<form action=\"genproc.php?action=ratep&amp;bid=$pminfo[4]&amp;sid=$sid\" method=\"post\">";
      echo "<select id=\"inputText\" name=\"brate\">";
      echo "<option id=\"inputText\" value=\"1\">1</option>";
      echo "<option id=\"inputText\" value=\"2\">2</option>";
      echo "<option id=\"inputText\" value=\"3\">3</option>";
      echo "<option id=\"inputText\" value=\"4\">4</option>";
      echo "<option id=\"inputText\" value=\"5\">5</option>";
      echo "</select><br/>";
      echo "<br/><input type=\"Submit\" id=\"inputText\" Name=\"Rate\" Value=\"Rate\"></form>";
      
      }else{
        $rinfo = mysql_fetch_array(mysql_query("SELECT COUNT(*) as nofr, SUM(brate) as nofp FROM ibwf_prate WHERE blogid='".$bid."'"));
        $ther = $rinfo[1]/$rinfo[0];
        echo "Rate: $ther - Points: $rinfo[1]";
      }
      
      echo "<a href=\"lists.php?action=allpo&amp;sid=$sid\">Back to Poems</a><br/>";
      $bnick = getnick_uid($pminfo[3]);
      echo "<a href=\"index.php?action=poems&amp;who=$pminfo[3]&amp;sid=$sid\">Back to $bnick's Poems</a><br/>";
      
      
      
        boxend();
    getfooter($sid);
    
    }
    //////////////////////////
    else if($action=="addpoem2")
    {
    
    if(!getplusses(getuid_sid($sid))>50)
        {
          boxstart("Add Poem!");
    	
                
          echo "You Can Only Create Poems If You Have 50+ Plusses<br/><br/>";
          
          boxend();
    getfooter($sid);
    
          exit();
        }
      $msgtxt = $_POST["btitle"];
      $msgtxt = $_POST["msgtxt"];
      //$qut = $_POST["qut"];
      addonline(getuid_sid($sid),"XHTML - Adding a Poem","");
          boxstart("Add Poem!");
          $crdate = time();
          //$uid = getuid_sid($sid);
          $res = false;
    
          if((trim($msgtxt)!="")&&(trim($btitle)!=""))
          {
          $res = mysql_query("INSERT INTO ibwf_poems SET bowner='".$uid."', bname='".$btitle."', bgdate='".$crdate."', btext='".$msgtxt."'");
          }
          if($res)
          {
            echo "<img src=\"images/ok.gif\" alt=\"O\"/>Message Posted Successfully";
    		
          }else{
            echo "<img src=\"images/notok.gif\" alt=\"X\"/>Error Posting Message";
          }
    
          echo "<br/><br/>";
          boxend();
    getfooter($sid);
    
    }
    //////////////////////////////////////////////////////////////////////////////////////
    else if($action=="poems")
    {
        addonline(getuid_sid($sid),"XHTML - Viewing A Users Poem","");
    
                  boxstart("Poems List!");
    	
        $uid = getuid_sid($sid);
        $who = $_GET["who"];
        $tnick = getnick_uid($who);
        
        echo "<b>$tnick's Poems</b>";
    
        
        //////ALL LISTS SCRIPT <<
    
        if($page=="" || $page<=0)$page=1;
        $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_poems WHERE bowner='".$who."'"));
        $num_items = $noi[0]; //changable
        $items_per_page= 10;
        $num_pages = ceil($num_items/$items_per_page);
        if(($page>$num_pages)&&$page!=1)$page= $num_pages;
        $limit_start = ($page-1)*$items_per_page;
    
            $sql = "SELECT id, bname FROM ibwf_poems WHERE bowner='".$who."' ORDER BY bgdate DESC LIMIT $limit_start, $items_per_page";
    
    
        echo "<p>";
        $items = mysql_query($sql);
        echo mysql_error();
        if(mysql_num_rows($items)>0)
        {
        while ($item = mysql_fetch_array($items))
        {
            $bname = htmlspecialchars($item[1]);
        if(candelbl($uid,$item[0]))
        {
          $dl = "<a href=\"genproc.php?action=delpo&amp;bid=$item[0]&amp;sid=$sid\">[X]</a>";
        }else{
          $dl = "";
        }
          $lnk = "<a href=\"index.php?action=viewpoem&amp;bid=$item[0]&amp;sid=$sid\">&#187;$bname</a>";
          echo "$lnk $dl<br/>";
        }
        }
        echo "</p>";
        echo "<p>";
        if($page>1)
        {
          $ppage = $page-1;
          echo "<a href=\"lists.php?action=$action&amp;page=$ppage&amp;who=$who&amp;sid=$sid\">&#171;PREV</a> ";
        }
        if($page<$num_pages)
        {
          $npage = $page+1;
          echo "<a href=\"lists.php?action=$action&amp;page=$npage&amp;who=$who&amp;sid=$sid\">Next&#187;</a>";
        }
        echo "<br/>$page/$num_pages<br/>";
    
        echo "</p>";
      ////// UNTILL HERE >>
        echo "<p>";
        if($who==$uid)
        {
            echo "<a href=\"index.php?action=addpoem&amp;sid=$sid\">";
    echo "Add a Poem</a><br/>";
    echo "<a href=\"index.php?action=cpanel&amp;sid=$sid\">";
    echo "User Settings</a><br/>";
        }
        echo "<a href=\"lists.php?action=allpo&amp;sid=$sid\">";
    echo "All Poems</a><br/>";
        boxend();
    getfooter($sid);
    
    }
    list.php
    Code:
    /////////////////////////////////////////////////////////// All Poems
    else if($action=="allpo")
    {
        addonline(getuid_sid($sid),"XHTML - Viewqing Poems list","");
    
                  boxstart("All Poems!");
    	
        $uid = getuid_sid($sid);
        $view = $_GET["view"];
        if($view =="")$view="time";
        echo "<small>";
        
        echo "</small></p>";
        //////ALL LISTS SCRIPT <<
        
        if($page=="" || $page<=0)$page=1;
        $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_poems"));
        $num_items = $noi[0]; //changable
        $items_per_page= 7;
        $num_pages = ceil($num_items/$items_per_page);
        if(($page>$num_pages)&&$page!=1)$page= $num_pages;
        $limit_start = ($page-1)*$items_per_page;
    if($view=="time")
    {
      $ord = "a.bgdate";
    }else if($view=="votes")
    {
      $ord = "nofv";
    }else if($view=="rate")
    {
      $ord = "avv";
    }else if($view=="points")
    {
      $ord = "nofp";
    }
    if ($view=="time"){
      $sql = "SELECT id, bname, bowner FROM ibwf_poems ORDER by bgdate DESC LIMIT $limit_start, $items_per_page";
    }else{
            $sql = "SELECT a.id, a.bname, a.bowner, COUNT(b.id) as nofv, SUM(b.brate) as nofp, AVG(b.brate) as avv FROM ibwf_poems a INNER JOIN ibwf_prate b ON a.id = b.blogid GROUP BY a.id ORDER BY $ord DESC LIMIT $limit_start, $items_per_page";
    }
        echo "<small>";
        $items = mysql_query($sql);
        echo mysql_error();
        if(mysql_num_rows($items)>0)
        {
        while ($item = mysql_fetch_array($items))
        {
          $bname = htmlspecialchars($item[1]);
          if($view=="time")
          {
          $bonick = getnick_uid($item[2]);
            
            $byview = "by <a href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$bonick</a>";
            }else if($view=="votes")
            {
              $byview = "Votes: $item[3]";
            }else if($view=="rate")
            {
              $byview = "Rate: $item[5]";
            }else if($view=="points")
            {
              $byview = "Points: $item[4]";
            }
          $lnk = "<a href=\"index.php?action=viewpoem&amp;bid=$item[0]&amp;sid=$sid\">&#187;$bname</a> $byview";
          echo "$lnk<br/>";
        }
        }
        echo "</small>";
        
        if($page>1)
        {
          $ppage = $page-1;
          echo "<a href=\"lists.php?action=$action&amp;page=$ppage&amp;view=$view&amp;sid=$sid\">&#171;PREV</a> ";
        }
        if($page<$num_pages)
        {
          $npage = $page+1;
          echo "<a href=\"lists.php?action=$action&amp;page=$npage&amp;view=$view&amp;sid=$sid\">Next&#187;</a>";
        }
        echo "<br/>$page/$num_pages<br/>";
            if($view!="time")
        {
          echo "<a href=\"lists.php?action=allpo&amp;view=time&amp;sid=$sid\">View Newest</a><br/>";
        }
        if($view!="points")
        {
          echo "<a href=\"lists.php?action=allpo&amp;view=points&amp;sid=$sid\">View by points</a><br/>";
        }
        if($view!="rate")
        {
          echo "<a href=\"lists.php?action=allpo&amp;view=rate&amp;sid=$sid\">View most rated</a><br/>";
        }
        if($view!="votes")
        {
          echo "<a href=\"lists.php?action=allpo&amp;view=votes&amp;sid=$sid\">View most voted</a>";
        }
    
      ////// UNTILL HERE >>
        echo "<p>";
    echo "<a href=\"index.php?action=addpoem&amp;sid=$sid\">";
    echo "Add a Poem</a><br/>";
          
        boxend();
    getfooter($sid);
    }
    sql
    Code:
    --
    -- Table structure for table `ibwf_poems`
    --
    
    DROP TABLE IF EXISTS `ibwf_poems`;
    SET @saved_cs_client     = @@character_set_client;
    SET character_set_client = utf8;
    CREATE TABLE `ibwf_poems` (
      `id` int(100) NOT NULL auto_increment,
      `bowner` int(100) NOT NULL default '0',
      `bname` varchar(255) NOT NULL default '',
      `btext` blob NOT NULL,
      `bgdate` int(100) NOT NULL default '0',
      PRIMARY KEY  (`id`),
      UNIQUE KEY `bname` (`bname`)
    ) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
    SET character_set_client = @saved_cs_client;
    
    --
    -- Dumping data for table `ibwf_poems`
    --
    
    LOCK TABLES `ibwf_poems` WRITE;
    /*!40000 ALTER TABLE `ibwf_poems` DISABLE KEYS */;
    INSERT INTO `ibwf_poems` (`id`, `bowner`, `bname`, `btext`, `bgdate`) VALUES (1,1,'dog','there once was a dog named bill',1237115639),(2,527,'cooolllllll','k\r\ne\r\na\r\nn\r\n\r\ni\r\nv\r\na\r\nn',1237118500),(3,565,'Jack n Jill','Jack and Jill went up the hill,to have a little fun,poor Jill forgot her pill,and now they have a son.',1237128126),(4,865,'Miiiiss You','I hide my tears when I say your name, but the pain in my heart is still the same,  Although I Smile & Seem Carefree, There is no one Who misses you more than Me Mmmwah',1240168429),(5,671,'Read and Rate...','The chains have been unlocked.It fell with a melancholic thud on the floor.Inch by inch you\'re moving away.Never looking back as I\'m begging you to stay.But from far away I can see.The paradise is waiting,you need to be free.',1240194580),(6,865,'Miine Msg 4u','If U delete this message thats bcoz u love me. .. If u save it thats bcoz u desire me .. & if u ignore it thats bcoz u miss me. So what u gonna do with It?',1240240518);
    /*!40000 ALTER TABLE `ibwf_poems` ENABLE KEYS */;
    UNLOCK TABLES;
    
    
    -- Table structure for table `ibwf_prate`
    --
    
    DROP TABLE IF EXISTS `ibwf_prate`;
    SET @saved_cs_client     = @@character_set_client;
    SET character_set_client = utf8;
    CREATE TABLE `ibwf_prate` (
      `id` int(100) NOT NULL auto_increment,
      `blogid` int(100) NOT NULL default '0',
      `uid` int(100) NOT NULL default '0',
      `brate` char(1) NOT NULL default '',
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    SET character_set_client = @saved_cs_client;
    
    --
    -- Dumping data for table `ibwf_prate`
    --
    
    LOCK TABLES `ibwf_prate` WRITE;
    /*!40000 ALTER TABLE `ibwf_prate` DISABLE KEYS */;
    /*!40000 ALTER TABLE `ibwf_prate` ENABLE KEYS */;
    UNLOCK TABLES;
    OZZIE can u please help im getting error when trying to add poems where did i make the falt in this code of urs did i miss anything out?

    #2
    whts the error?
    sigpiceeeeerrr....

    Comment


      #3
      error posting the poem

      i think the genproc not there didnt get the genproc files in the mobilezonez script

      Comment


        #4
        but whts the ERROR???
        wht browser says to you??

        is it sql error... parse error etc....


        btw as far i see u dont need genproc.php for adding the poem
        its just for deleting and rating poems lol

        but i also see its a blog script for lava, so u can just copy it from blogs....
        Last edited by alesh; 09.05.09, 11:04.
        sigpiceeeeerrr....

        Comment


          #5
          Im getting this error it cant post the message
          Attached Files

          Comment


            #6
            i cant see a **** from tht thumbnail lol
            and im 2 lazy 2 copy the code and 2 look lol

            but i saw this
            PHP Code:
              $msgtxt $_POST["btitle"];
              
            $msgtxt $_POST["msgtxt"]; 
            i think it shoul be
            PHP Code:
              $btitle $_POST["btitle"];
              
            $msgtxt $_POST["msgtxt"]; 
            look for it in else if($action=="addpoem2")
            sigpiceeeeerrr....

            Comment


              #7
              tanx it work 100% now

              here are a genproc.php file
              Code:
              else if($action=="ratep")
              {
                $brate = $_POST["brate"];
                $bid = $_GET["bid"];
                addonline(getuid_sid($sid),"Rating a Poem","");
                //$uid = getuid_sid($sid);
                
              $pstyle = gettheme($sid);
                    echo xhtmlhead("WapLive",$pstyle);
                echo "<p align=\"center\">";
                $vb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_prate WHERE uid='".$uid."' AND blogid='".$bid."'"));
                if($vb[0]==0)
                {
                  $res = mysql_query("INSERT INTO ibwf_prate SET uid='".$uid."', blogid='".$bid."', brate='".$brate."'");
                  if($res)
                  {
                      echo "<img src=\"images/ok.gif\" alt=\"o\"/>Poem rated successfully<br/>";
                  }else{
                      echo "<img src=\"images/notok.gif\" alt=\"x\"/>Database Error!<br/>";
                  }
                }else{
                  echo "<img src=\"images/notok.gif\" alt=\"x\"/>You have rated this Poem before<br/>";
                }
                echo "<br/><br/>";
                    $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
                  $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));  
                  echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
              echo "Home</a>";
                echo "</p>";
                echo xhtmlfoot();
                
              }
              Last edited by riderz; 09.05.09, 12:59.

              Comment


                #8
                i had error but i fixed it and what a nice script
                Last edited by brand; 19.05.09, 11:48. Reason: fixed error
                HELP THEM WHO HELPS YOU



                i only work on wapdesire v_2 coding only

                Comment

                Working...
                X