Jump to content

ababba2

Members
  • Posts

    34
  • Joined

  • Last visited

ababba2's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 1. Even if is based on Joomla, this is a custom code, so it's nothing related to joomla. 2. The fact I'm using joomla doesn't matter in my problem. I just made a question about this custom code for check if the database column called "subtitle1" contains data. If contains data then it should run: JURI::base() . "components/com_contushdvideoshare/$htmlVideoDetails->subtitle1" but if not contains data then it shouldn't do nothing. Connection to database, etc are already made. And data in that column could be checked using $htmlVideoDetails->subtitle1. Doesn't seem too hard to understand. Also, Joomla is not based on an alien programming language.
  2. I already tried. $ass = JURI::base() . "components/com_contushdvideoshare/$htmlVideoDetails->subtitle1"; In this way when I run $ass it execute that function. $htmlVideoDetails->subtitle1 grab the data from the database column. The problem is that if $htmlVideoDetails->subtitle1 have no data, then executing $ass I get http://example.com/components/com_contushdvideoshare/ And I have no idea what should I do for remove http://example.com/components/com_contushdvideoshare/ if and only if $htmlVideoDetails->subtitle1 is empty.
  3. Hi guys, I need a php script that check if the column of a database is written. If there is something witten, then the php should echo what is written in the column. If the column is empty, then it should echo a blank space. Is it possible? How?
  4. On the column: Subtile_lang1 of the database there is: /mytext.txt mytext.txt is a file located at /components/my_component/info Using javascript I need to call the table for get the file name of that file. So far I tried to do this: $TXT_file = JURI::base() . $current_path . $this->htmlVideoDetails->subtile_lang1; This should grab the current path: /components/my_component/info and then it should add to this path the /mytext.txt that is stored in the database. This is my Javascript script: <script>videojs('ID', { plugins: { ass: { src: '<?= $TXT_file; ?>', button: 'true' } } })</script> But for some reason using <?= $TXT_file; ?> I can't get anything. How should I do for get what I need?
  5. localhost was just an example... if you like you can call it mydomain0.com...
  6. For example. If an user have this url: localhost/image1.jpg Then he can open this url directly from localhost. I want to avoid this. In domain1.com I want to use my image ad [img=localhost/image1.jpg] So that this image will appear in domain1.com but if someone try to copy the URL and open it in another table trying to get access to localhost, this guy must not have access to this image.
  7. I need to deny hotlinking on my site. In this way I make hotlinking allowing blank refferer RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mydomain1.com [NC] RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L] In this way, localhost will be able to use all image uploaded. But even mydomain1.com will be able to use the image uploaded. All other domain won't be able to use images uploaded on localhost. But this is not what I want. I want that also localhost will be unable to use image hosted, and that only mydomain1.com will be able to use that image. This can be done denying blank refferer, like this RewriteEngine on RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mydomain1.com [NC] RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L] Anyway, this is not a good solution. Because some visitors uses a personal firewall or antivirus program, that deletes the page referer information sent by the web browser. So, denying blank refferer I'm blocking this users who visits mydomain1.com correctly. I can't find a solution to this. All I want to do is that the images will be used only by mydomain1.com, doesn't allowing anyone to download them from somewhere else. Do you have any solution for doesn't block users, but still blocking hotlinking in localhost?
  8. ^Because I'm using Ajax. If I remove select query then the counter begone. Even using INSERT seems to be useless
  9. So adding this should be fine? $idpos = intval(mysql_real_escape_string($_POST['id'])); and could you please code for me the last part, I didn't understood this: also, you don't need to SELECT data in order to UPDATE it and in fact there's a race condition present where you will loose counts when there are multiple concurrent instances of your code running. you should be using one INSERT ... ON DUPLICATE KEY UPDATE ... query to do this.
  10. Could you please help me understand if now the danger is fixed? <?php if ( $_POST['option'] == "com_content" && $_POST['view'] == "video" && is_numeric($_POST['id'])) { // connect to the database include_once("../configuration.php"); $cg = new JConfig; $con = mysqli_connect($cg->host,$cg->user,$cg->password,$cg->db); if (mysqli_connect_errno()){ die('n/a'); } $idpos = mysqli_real_escape_string($_POST['id']); // grab the new hit count $query = "SELECT times_viewed FROM ".$cg->dbprefix."hdflv_upload WHERE `id` = " . $idpos . " LIMIT 1; "; $new_hits = mysqli_fetch_assoc(mysqli_query($con,$query)); // add new hit $addone = $new_hits['times_viewed']+1; $queryadd = "UPDATE ".$cg->dbprefix."hdflv_upload SET times_viewed=".$addone." WHERE `id` = " . $idpos . "; "; mysqli_query($con,$queryadd); // close the connection to the database mysqli_close($con); echo $addone; } ?>
  11. Could someone please help me? <?php if ( $_POST['option'] == "com_content" && $_POST['view'] == "video" && is_numeric($_POST['id'])) { // connect to the database include_once("../configuration.php"); $cg = new JConfig; $con = mysqli_connect($cg->host,$cg->user,$cg->password,$cg->db); if (mysqli_connect_errno()){ die('n/a'); } // grab the new hit count $query = "SELECT times_viewed FROM ".$cg->dbprefix."hdflv_upload WHERE `id` = " . $_POST['id'] . " LIMIT 1; "; $new_hits = mysqli_fetch_assoc(mysqli_query($con,$query)); // add new hit $addone = $new_hits['times_viewed']+1; $queryadd = "UPDATE ".$cg->dbprefix."hdflv_upload SET times_viewed=".$addone." WHERE `id` = " . $_POST['id'] . "; "; mysqli_query($con,$queryadd); // close the connection to the database mysqli_close($con); echo $addone; } ?>
  12. Hi guys. I have a component installed on my joomla site. As any component, this have it's own controller.php . In this controller.php there is this function function videohitCount_function($vid) { $db = JFactory::getDBO (); $query = $db->getQuery ( true ); /** Execute query to update hitcount */ $query->clear ()->update ( $db->quoteName ( '#__hdflv_upload' ) )->set ( $db->quoteName ( 'times_viewed' ) . ' = 1+times_viewed' )->where ( $db->quoteName ( 'id' ) . ' = ' . $db->quote ( $vid ) ); $db->setQuery ( $query ); $db->query (); } Now I need, in a custom php page inside the same component, make an Ajax call to this function. I tried with this, taken by an already existing answer on this forum <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script> function videohitCount_function { // using jquery ajax method for calling the php script $.ajax({ // set this to the url of your php script for calling the LSC function url: '../controller.php', // if the result of the ajax request is ok then this function is called success: function(response) { // the variable 'response' will contain the output from your php script // as an example we'll use a javascript alert to show the output of the response alert(response); } }); } </script> But doesn't work. What should i do for perform this ajax call?
  13. This kind of cache is useful because increase the page load speed
  14. Already done days ago. They don't answer. http://forum.joomla.org/viewtopic.php?f=706&t=902816&p=3351790
×
×
  • 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.