Jump to content

balkan7

Members
  • Posts

    234
  • Joined

  • Last visited

Posts posted by balkan7

  1. maybe this is solutions but i need real code.

    if i add in:

    echo "<input type='submit' name='post_rating".$rating_item_id."' value='".$locale['r103']."' class='button' />\n";
    echo "<form name='postrating".$rating_item_id."' method='post' action='".$rating_link."'>\n";
    

    now cooming post:

    if (isset($_POST['post_rating'])) {

    now we need post_rating along with rating_item_id convert to rating_item_id and place into datebase.

    Plz help i need this.

  2. code is:

    <?php 
    function showratings($rating_type, $rating_item_id, $rating_link) {
    
    global $locale, $userdata;
    
    if (iMEMBER) {
    	$d_rating = dbarray(dbquery("SELECT rating_vote,rating_datestamp FROM ".DB_RATINGS." WHERE rating_item_id='".$rating_item_id."' AND rating_type='".$rating_type."' AND rating_user='".$userdata['user_id']."'"));
    	if (isset($_POST['post_rating'])) {
    		if (isnum($_POST['rating']) && $_POST['rating'] > 0 && $_POST['rating'] < 6 && !isset($d_rating['rating_vote'])) {
    			$result = dbquery("INSERT INTO ".DB_RATINGS." (rating_item_id, rating_type, rating_user, rating_vote, rating_datestamp, rating_ip) VALUES ('$rating_item_id', '$rating_type', '".$userdata['user_id']."', '".$_POST['rating']."', '".time()."', '".USER_IP."')");
    		}
    		redirect($rating_link);
    	} elseif (isset($_POST['remove_rating'])) {
    		$result = dbquery("DELETE FROM ".DB_RATINGS." WHERE rating_item_id='$rating_item_id' AND rating_type='$rating_type' AND rating_user='".$userdata['user_id']."'");
    		redirect($rating_link);
    	}
    }
    $ratings = array(5 => $locale['r120'], 4 => $locale['r121'], 3 => $locale['r122'], 2 => $locale['r123'], 1 => $locale['r124']);
    
    opentable($locale['r100']);
    if (!iMEMBER) {
    	echo "<div style='text-align:center'>".$locale['r104']."</div>\n";
    } elseif (isset($d_rating['rating_vote'])) {
    	echo "<div style='text-align:center'>\n";
    	echo "<form name='removerating' method='post' action='".$rating_link."'>\n";
    	echo sprintf($locale['r105'], $ratings[$d_rating['rating_vote']], showdate("longdate", $d_rating['rating_datestamp']))."<br /><br />\n";
    	echo "<input type='submit' name='remove_rating' value='".$locale['r102']."' class='button' />\n";
    	echo "</form>\n</div>\n";
    } else {
    	echo "<div style='text-align:center'>\n";
    	echo "<form name='postrating' method='post' action='".$rating_link."'>\n";
    	echo $locale['r106'].": <select name='rating' class='textbox'>\n";
    	echo "<option value='0'>".$locale['r107']."</option>\n";
    	foreach($ratings as $rating=>$rating_info) {
    		echo "<option value='".$rating."'>$rating_info</option>\n";
    	}
    	echo "</select>\n";
    	echo "<input type='submit' name='post_rating' value='".$locale['r103']."' class='button' />\n";
    	echo "</form>\n</div>";
    }
    echo "<hr />";
    $tot_votes = dbcount("(rating_item_id)", DB_RATINGS, "rating_item_id='".$rating_item_id."' AND rating_type='".$rating_type."'");
    if($tot_votes){
    	echo "<table cellpadding='0' cellspacing='1' class='tbl-border center'>\n";
    	foreach($ratings as $rating=>$rating_info) {
    		$num_votes = dbcount("(rating_item_id)", DB_RATINGS, "rating_item_id='".$rating_item_id."' AND rating_type='".$rating_type."' AND rating_vote='".$rating."'");
    		$pct_rating = number_format(100 / $tot_votes * $num_votes);
    		if ($num_votes == 0) {
    			$votecount = "[".$locale['r108']."]";
    		} elseif ($num_votes == 1) {
    			$votecount = "[1 ".$locale['r109']."]";
    		} else {
    			$votecount = "[".$num_votes." ".$locale['r110']."]";
    		}
    		$class = ($rating % 2==0?"tbl1":"tbl2");
    		echo "<tr>\n";
    		echo "<td class='$class'>".$rating_info."</td>\n";
    		echo "<td width='250' class='$class'><img src='".get_image("pollbar")."' alt='".$rating_info."' height='12' width='".$pct_rating."%' class='poll' /></td>\n";
    		echo "<td class='$class'>".$pct_rating."%</td>\n";
    		echo "<td class='$class'>".$votecount."</td>\n";
    		echo "</tr>\n";
    	}
    	echo "</table>\n";
    }else{
    	echo "<div style='text-align:center'>".$locale['r101']."</div>\n";
    }
    closetable();
    }
    ?>

  3. change button whit this one: <input type='submit' name='save' value='Send now'>

     

    php code:

    <?php
    //first check if press submit button
    if (isset($_POST['save'])) {
    // ADD TO DATABASE
    
    $model_number=$_POST["model_number"];
    $bag_name=$_POST["bag_name"];
    $weight=$_POST["weight"];
    $max_lenses=$_POST["max_lenses"];
    $colour1=$_POST["colour1"];
    $colour2=$_POST["colour2"];
    $colour3=$_POST["colour3"];
    $colour4=$_POST["colour4"];
    $new_image1=$_POST["colour1url"];
    $new_image2=$_POST["colour2url"];
    $new_image3=$_POST["colour3url"];
    $new_image4=$_POST["colour4url"];
    
    $result = mysql_query("INSERT INTO bags (id, model_number, bag_name, weight, max_lenses, colour1, colour2, colour3, colour4, colour1url, colour2url, colour3url, colour4url) VALUES ('', '$model_number', '$bag_name', '$weight', '$max_lenses', '$colour1', '$colour2', '$colour3', '$colour4', '$new_image1', '$new_image2', '$new_image3', '$new_image4')");
    
    if ($result) { echo "Success!"; }
    
    }
    ?>

  4. try

    obj = document.getElementById(id+"_ratings");
    

     

    instead of

    obj = document.getElementById(id);
    

    Java script working perfectly, when i open div tag for show and hide show me real id of download so when i try to rate that download id in datebase inserting only first id (1)

    so this is function for call rating:

    showratings("D", $data['download_id'], FUSION_SELF."?cat_id=".$_GET['cat_id']);

     

    rating function:

    function showratings($rating_type, $rating_item_id, $rating_link)

     

  5. If i try to rate some of download list just rate id=1 you cannot rate other id.

    I need help for get id for show hide tag.

    code is:

    <?php
    echo "<script type='text/javascript' language='JavaScript'>
    function showhide(id){
    if (document.getElementById){
    obj = document.getElementById(id);
    if (obj.style.display == 'none'){
    obj.style.display = '';
    } else {
    obj.style.display = 'none';
    }
    }
    }
    </script>";
    echo "<a href='#' onclick=\"showhide('".$data['download_id']."_ratings'); return(false);\"><img src='".DLL."ratings.png' border='0' title='Ratings' alt='Ratings' /></a>";
    echo "<div id='".$data['download_id']."_ratings' style='display: none;'>";
    if($allow_ratings != false){
    showratings("D", $data['download_id'], FUSION_SELF."?cat_id=".$_GET['cat_id']);
    }
    echo "</div>";
    

  6. guys how can i get real id from open it for vote, if i vote only vote id=1, i need help to get id from show rating in div tag:

     

    <?php
    echo "<script type='text/javascript' language='JavaScript'>
    function showhide(id){
    if (document.getElementById){
    obj = document.getElementById(id);
    if (obj.style.display == 'none'){
    obj.style.display = '';
    } else {
    obj.style.display = 'none';
    }
    }
    }
    </script>";
    echo "<tr>\n<td width='30%' class='tbl2'><b>Ratings:</b> \n<a href='#' onClick='showhide('".$data['download_id']."_ratings')'><img src='".IMAGES."ratings.png' border='0' title='Ratings' alt='Ratings' /></a></td>\n</tr>";
    echo "<div id='".$data['download_id']."_ratings' style='display:none;'>
    				".showratings("D", $data['download_id'], FUSION_SELF."?cat_id=$cat_id&download_id=".$data['download_id'])."</div>";
    ?>

  7. Soryy Crayon Violent, yes i see data from onClick='showhide('".$data['download_id']."_ratings');

    i tryed whit many modifycation but nothing again, when i rate one from download rating all downloads.

    Exactly problem is not working link on image, this tag is opened not hidden -> <div id='".$data['download_id']."_ratings' style='display:none;'>.

    Exactly doesn't work, where i wrong ?

  8. maybe, now just show me ratings not hidding link in picture not working, and now when i try to rate one download rate everyone from that category, strange.

    i have set variable for show id to div tags and open from download id. 

    what wrong here i dont know :(

    Soryy for bad english

  9. Hi guys, i have created function for show and hide rating in downloads so code not working propertly.

     

    code is:

    <?php
    echo "<script type='text/javascript' language='JavaScript'>
    function showhide(id){
    if (document.getElementById){
    obj = document.getElementById(id);
    if (obj.style.display == 'none'){
    obj.style.display = '';
    } else {
    obj.style.display = 'none';
    }
    }
    }
    </script>";
    echo "<tr>\n<td width='30%' class='tbl2'><b>Ratings:</b> \n<a href='#' onClick='showhide('".$data['download_id']."_ratings'); return(false);'><img src='".IMAGES."ratings.png' border='0' title='Ratings' alt='Ratings' /></a></td>\n</tr>";
    echo "<div id='".$data['download_id']."_ratings' style='display:none;'>
    				".showratings("D", $data['download_id'], FUSION_SELF."?cat_id=$cat_id&download_id=".$data['download_id'])."</div>";
    ?>

  10. Hi guys

    i have created code when user send msg for new msg must wait 30 minuts, so i wanna show minuts for expire whiout refrshing browser, only that can be whit ajax, but im new whit ajax.

     

    code is:

    <?php if (isset($_POST['send'])){
    
    $user = $userdata['user_name'];
    $zelba = stripinput($_POST['muzicka_zelba']);
    $date = time() + 1800;
    
    if ($zelba != ""){
          $result = dbquery("INSERT INTO ".$db_prefix."zelbi VALUES ('', '$user', '$zelba', '12', '0', '$date')");
    if ($result) echo "<script type=\"text/javascript\">alert(\"".$locale['007']."\");</script>";
          } else {
    $error = $locale['005'];
    }
    }
    $result = dbquery("SELECT * FROM ".$db_prefix."zelbi WHERE korisnik='".$userdata['user_name']."'");
    $find = dbrows($result);
    //if ($find != 0){
      $row = dbarray($result);
      $date_now = time();
      $minus = $row['date'] - $date_now;
      $expire = date("i", $minus);
      $check_date = date("d-m-Y H:i:s", $row['date']);
    	$now = date("d-m-Y H:i:s");
    	if ($now < $check_date){
    		//$expire = $check_date - $now;
    		echo "<br><div align='center'>".$locale['040']."<b>".$expire."</b>".$locale['041']."</div><br>";
     } else {
    echo $locale['002']."<br /><form method='post' action='$PHP_SELF'>
    <input type='hidden' name='send'>
    <table align='center' cellpadding='0' cellspacing='0'>
    <tr>
    <td class='tbl'>".$locale['003']." <b>".$userdata['user_name']."</b></td>
    </tr>
    <tr>
    <td class='tbl'>".$locale['004']." ".$error."<br /><textarea name='muzicka_zelba' cols='50' rows='4' class='textbox'></textarea></td>
    </tr>
    <tr>
    <td align='center'>
    <br />
    <input type='submit' class='button' value='".$locale['008']."' onClick=\"this.disabled=true; this.form.submit; this.value='".$locale['009']."'\" /></td>
    </tr>
    </table>
    </form>\n";
      } ?>

  11. no no you not undestand me, everything working i just need select option for show ASC and DESC.

     

    echo "<div align='left'><select onChange=\"document.form.submit();\" name='sortiraj'><option>Select</option><option value='ASC'>ASC</option><option value='DESC'>DESC</option></select></div>";

     

    just need when select ASC get from datebase ASC first.

  12. i wanna for this get value:

     

    echo "<div align='left'><select onChange=\"document.form.submit();\" name='sortiraj'><option>Select</option><option value='ASC'>ASC</option><option value='DESC'>DESC</option></select></div>";

  13. Hi guys

    i need help whit select sorting, ASC or DSC.

     

    code:

    if (isset($_GET['mod']) && $_GET['mod']=='stored'){
    	if (isset($_POST['brisi_poraki'])){
    	$result = dbquery("DELETE FROM ".$db_prefix."zelbi WHERE id IN('" . implode("','", $_POST['add_check_mark']) . "')");
    	redirect(FUSION_SELF);
    }
    $sort = $_GET['sort'];
    if (empty($sort)){
    	$sort = "DESC";
    }
    $rows = dbcount("(id)", "zelbi", "status='1'");
       if (!isset($rowstart) || !isNum($rowstart)) $rowstart = 0;
         echo "<form name='brisi_poraki' method='post' action='".FUSION_SELF."?mod=stored'>\n";
         echo "<div align='center'><img src='".IMAGES."dj.png' border='0'></div>";
         echo "<div align='left'><select onChange=\"document.form.submit();\" name='sortiraj'><option>Select</option><option value='ASC'>ASC</option><option value='DESC'>DESC</option></select></div>";
         echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>";
         echo "<tr><td class='tbl1' align='center' colspan='5'><a href='dj.php?mod=objaveni'>".$locale['015']."</a> - <a href='#' onclick=\"window.location = 'JavaScript:window.location.reload()';\"/>Refresh</a> - <a href='dj.php'>".$locale['016']."</a></td></tr>";
         echo "<tr><td class='tbl1'>ID</td>\n<td class='tbl1'>".$locale['010']."</td>\n<td class='tbl1'>".$locale['011']."</td>\n<td class='tbl1'>".$locale['021']."</td>\n<td class='tbl1'>".$locale['012']."</td>\n<tr>";
       if ($rows != 0) {
       $result = dbquery("SELECT * FROM ".$db_prefix."zelbi WHERE status='1' ORDER BY id ".$sort." LIMIT $rowstart,$broj");
         while ($data = dbarray($result)) {
         	if (iSUPERADMIN){
         	echo "<tr><td width='1%' class='tbl2'>".$data['id']."</td>\n<td class='tbl2 width='10%'>".$data['korisnik']."</td>
            <td class='tbl2' width='85%'>".$data['muzicka_zelba']."</td>\n<td class='tbl2'>".date("d-m-Y", $data['date'])."</td>\n<td align='center' class='tbl2'><input type='checkbox' name='add_check_mark[]' value='".$data['id']."' /></td></tr>";
         	} else {
       echo "<tr><td width='1%' class='tbl2'>".$data['id']."</td>\n<td class='tbl2 width='10%'>".$data['korisnik']."</td>
            <td class='tbl2' width='85%'>".$data['muzicka_zelba']."</td>\n<td class='tbl2'><a href='#'>".$locale['014']."</a></td></tr>";
         }
        }
        echo "<script type='text/javascript'>"."\n"."function setChecked(frmName,chkName,val) {"."\n";
    	echo "dml=document.forms[frmName];"."\n"."len=dml.elements.length;"."\n"."for(i=0;i < len;i++) {"."\n";
    	echo "if(dml.elements[i].name == chkName) {"."\n"."dml.elements[i].checked = val;"."\n";
    	echo "}\n}\n}\n</script>\n";
      echo "<tr><td colspan='5' class='tbl1' align='right'><a href='#' onclick=\"javascript:setChecked('brisi_poraki','add_check_mark[]',1);return false;\">".$locale['019']."</a> |\n
      <a href='#' onclick=\"javascript:setChecked('brisi_poraki','add_check_mark[]',0);return false;\">".$locale['020']."</a> |\n <input type='submit' name='brisi_poraki' value='".$locale['014']."' class='button'></td>\n</tr>\n</table>";
      
     if ($rows > $broj) {echo "<div align='center' style='margin-top:5px;'>\n".makePageNav($rowstart,$broj,$rows,3,"$PHP_SELF?mod=stored&")."\n</div>\n";}
         } else {
     echo "<tr><td colspan='4' width='100%' class='tbl2'>".$locale['018']."</td>\n</tr>\n</table>";
     }
        }

  14. i find solution but now need write minuts for next avilable post.

    code:

    for inseting time in db i used $date = time() + 1800;

    $result = dbquery("SELECT * FROM ".$db_prefix."zelbi WHERE korisnik='".$userdata['user_name']."' ORDER BY id DESC LIMIT 0,1");
    $find = dbrows($result);
    if ($find != 0){
      $row = dbarray($result);
      $check_date = date("d-m-Y H:i:s", $row['date']);
    	$now = date("d-m-Y H:i:s");
    	if ($now < $check_date){
    		$expire = $check_date - $now;
    		echo "<div align='center'>".$locale['040'].$expire."</div>";
     }

  15. ok i got this one how to check date now?

     

    $result = dbquery("SELECT * FROM ".$db_prefix."zelbi WHERE korisnik='".$userdata['user_name']."'");
    $find = numrows($result);
    if ($find != 0){
    while ($row = dbarray($result)){
    	$date = date("d-m-Y", $row['date']);
    	$now = date("d-m-Y");
    }
    }

  16. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE banner_id = 30' at line 2

     

     

    code:

    $banner_expire_choice = isNum($_POST['banner_expire_choice']) ? $_POST['banner_expire_choice'] : "1";
    $expire = "NOW() + INTERVAL ".$banner_expire_choice." WEEK";
    $bquery = "banner_url = '$banner_url', banner_img = '$banner_data'";
    
    if ($banner_expire == "") {
    			$update_banner = dbquery("UPDATE ".$db_prefix."banners SET 
    			banner_type = '$banner_type', banner_status = '$banner_status', banner_plan_id = '$banner_plans', client_id = '$client_id', banner_name = '$banner_name', ".$bquery." WHERE banner_id = ".$banner_id);
    			echo "<center>".$locale['M_058']."</center><br /><br />";
    		} else {
    			$update_banner = dbquery("UPDATE ".$db_prefix."banners SET 
    			banner_type = '$banner_type', banner_status = '$banner_status', banner_plan_id = '$banner_plans', client_id = '$client_id', banner_name = '$banner_name', banner_end = ".$expire.", ".$bquery." WHERE banner_id = ".$banner_id);
    			echo "<center>".$locale['M_058']."</center><br /><br />";
    	    }

  17. i think i find solution, but i need more secure inside.

    plz help if you have better solution.

     

    code:

    <?php
    //Prepare Banners for display
    function displayBanners($place=1){
    global $db_prefix, $locale;
            $result = dbquery("SELECT * FROM ".$db_prefix."banners_plans");
            $numrows = dbrows($result);
            if ($numrows != ""){
            while ($data = dbarray($result)) {
            $plan_id = $data['plan_id'];
            $plan_array = array($plan_id);
            $plan_imp = implode(",",$plan_array);
            $plans = $plan_imp;
    	//if (in_array($place, $plans))
            }
    $bannersDb = dbquery("SELECT * FROM ".$db_prefix."banners WHERE banner_status = '1' and banner_plan_id = ".$place);
    if (dbrows($bannersDb)){
    	while ($tbData = dbarray($bannersDb)) $possRand[] = $tbData['banner_id'];
    	$prCount = count($possRand)-1;
    	$rand = mt_rand(0, $prCount);
    	$banData = dbarray(dbquery("SELECT * FROM ".$db_prefix."banners WHERE banner_status = '1' AND banner_id = ".$possRand[$rand]));
    	return showBanner($banData);
    } else {
    	return $locale['BB_001']; 
    }
       }
      }?>

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.