Jump to content

Glenskie

Members
  • Posts

    108
  • Joined

  • Last visited

Everything posted by Glenskie

  1. I have this button for my like system and for some reason i have to refresh after i click it again... i would like it to be that when i click it it changes the class and i can click it again and do the other function... please help thank you... JQUERY: <script type="text/javascript"> $(document).ready(function(){ $('[name="like"]').on("click", function(){ if($(this).attr('title')=='like'){ $.post('/like.php',{imid:$(this).attr('id'),action:'like'}); $(this).removeClass('like').addClass('unlike'); $(this).attr('title','unlike'); $(this).attr('name','unlike'); } }); $('[name="unlike"]').on("click", function(){ if($(this).attr('title')=='unlike'){ $.post('/like.php',{imid:$(this).attr('id'),action:'unlike'}); $(this).removeClass('unlike').addClass('like'); $(this).attr('title','like'); $(this).attr('name','like'); } }); }); </script> PHP: $likes = mysql_query("SELECT lid FROM likes WHERE uid='$id' AND imid='$photoid'"); if(mysql_num_rows($likes)==0){ $likethis = '<div class="like" title="like" id="'.$photoid.'" name="like"></div>'; }else{ $unlikethis = '<div class="unlike" title="unlike" id="'.$photoid.'" name="unlike"></div>'; }
  2. I have a php and jquery like system that doesn't work for some reason? When i click on the button to like it does nothing not even gives me an error please help thank you ! Here is my code that I am using and maybe you will see something that I didn't? The first part of the php code works it shows the like button so I know that's right but when you click it, it does nothing ... PHP: $likes = mysql_query("SELECT lid FROM likes WHERE uid='$id' AND imid='$photoid'"); if(mysql_num_rows($likes)==0){ $likethis = '<a href="#" id="'.$photoid.'" title="like"><div class="like"></div></a>'; }else{ $unlikethis = '<a href="#" id="'.$photoid.'" title="unlike"><div class="unlike"></div></a>'; } JQUERY: <script type="text/javascript"> $(document).ready(function(){ $(document).bind('click', '.like', function(){ if($(this).attr('title')=='like'){ $.post('like.php',{imid:$(this).attr('id'),action:'like'},function(){ $(this).text('unlike'); $(this).attr('title','Unlike'); }); }else{ if($(this).attr('title')=='unlike'){ $.post('like.php',{imid:$(this).attr('id'),action:'unlike'},function(){ $(this).text('like'); $(this).attr('title','like'); }); } } }); }); </script> like.php: $imid=$_POST['imid']; $action=$_POST['action']; if ($action=='like'){ $sql= mysql_query("SELECT * FROM likes WHERE imid=$imid and uid=$id"); $matches=$sql->rowCount(); if($matches==0){ $sql= mysql_query("INSERT INTO likes (imid, uid) VALUES($imid, $id)"); $sql= mysql_query("UPDATE photos SET likes=likes+1 WHERE id=$imid"); }else{ die("There is No Image With That ID"); } } if ($action=='unlike'){ $sql= mysql_query("SELECT * FROM likes WHERE imid=$imid and uid=$id"); $matches=$sql->rowCount(); if ($matches!=0){ $sql=mysql_query("DELETE FROM likes WHERE imid=$imid AND uid=$id"); $sql=mysql_query("UPDATE photos SET likes=likes-1 WHERE id=$imid"); } }
  3. im trying to check if the account is = to c but its erroring out and displays a blank page. $user = '<script type="text/javascript" src="'.$actual_link.'/js/submenu.js"></script><div class="dropdown"> <a class="account" > <span>'.$username.'</span> </a> <div class="submenu" style="display: none; "> <ul class="root"> '. if ($account == "c") { .' <li> <a href="/stats.php">Dashboard</a> </li> '. } .'
  4. Hi I am trying to create a grid like gallery and for some reason it does not look right? I want it to look like pinterest so I am trying to use wookmark jquery. Here is my code and an image to view. Thank you. Here is the css: #gallerycontainer { display: inline-block; background-color: #f0f0f0; padding: 0px; width:850px; /*border: 1px solid #DBDBDB; -webkit-box-shadow: #E4E4E4 0px 0px 5px; -moz-box-shadow: #E4E4E4 0px 0px 5px; box-shadow:#E4E4E4 0px 0px 5px;*/ position:relative; left:0px; bottom:13px; overflow:inherit; top:0px; float: left; padding-right: 0px; margin-left: 10px; overflow: auto; } #gallery{ } #gallery li img { float: left; border: 5px solid #fff; -webkit-transition: box-shadow 0.5s ease; -moz-transition: box-shadow 0.5s ease; -o-transition: box-shadow 0.5s ease; -ms-transition: box-shadow 0.5s ease; transition: box-shadow 0.5s ease; max-width:250px; max-height:200px; padding:0px; } .galleryinfo{ border: 2px solid #fff; padding-bottom: 40px; float: left; margin:9px; background: white; } #gallery li img:hover { -webkit-box-shadow: 0px 0px 7px rgba(255,255,255,0.9); box-shadow: 0px 0px 7px rgba(255,255,255,0.9); cursor: pointer; } .myaccounttitle{ text-align: center; } And here is the php and html. <script type="text/javascript" src="js/jquery.wookmark.js"></script> <script type="text/javascript">$('#gallery li').wookmark();</script> <div class="myaccounttitle">My Images</div> <div id="gallery"> <?php function pictures($query) { while($row = mysql_fetch_array($query)) { $id = $row['id']; $title = $row['title']; $author = $row['userid']; $date = date("F j, Y, g:i a", $row['date']); $picture = $row['picture']; // $likes = $row['likes']; // $favs = $row['favs']; $unique = mysql_num_rows(mysql_query("SELECT * FROM views WHERE picture='$id' GROUP BY ip")); ?> <div class="galleryinfo"> <li id="<?php print $id?>"> <a class="fancybox" rel="group" href="photos/<?php print $picture?>"><img src="photos/<?php print $picture?>"/></a> </li> Views : <?php print($unique) ?> </div> <?php }}} ?> <div id="gallerycontainer"> <?php if($account == "c") { pictures($query2); }else { pictures($query); } ?> </div> All of your help is greatly appreciated.
  5. I posted this on a forum and i got a response but it did not work for me ... What I'm trying to do is to get the category image to show instead of the product image. What I have done for the category product list which works is this. This only works if you are looking at all the products in a category but not if you search for a product? <a href="{$product.link|escape:'htmlall':'UTF-8'}" class="product_img_link" title="{$product.name|escape:'htmlall':'UTF-8'}"> <img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'large_default')}" style="width:140px!important;" alt="{$product.legend|escape:'htmlall':'UTF-8'}" /> </a> I was wondering how do I get this to work all of the site? How do I make it pull the category images? Like it is above but for the whole site? This was his response and i dont know what it means... You can do a multiple actions to create such an image, first of all you call for $category class in product page, so $category is not defined. best solution is to create a assigment for $category in productController in override directory. class ProductController extends ProductControllerCore { public function initContent() { parent::initContent(); $category = new Category($this->product->id_category_default); $this->context->smarty->assign('category', $category); } }
  6. its defined in header.php and so is $salt
  7. For some reason I can get it to find the data and check if you submitted the correct old password but it will not update the new one? I'm not sure what to do next I have tried everything... <?php include 'header.php'; if (isset ($_POST['passupdate'])){ $pass = $_POST['pass']; $opass = $_POST['opass']; $db_passwordcheck = md5($opass); $db_password = md5($salt.$pass); $sql = mysql_query("SELECT * FROM members WHERE username='$username' AND password='$db_passwordcheck'"); $login_check = mysql_num_rows($sql); if($login_check > 0){ $updatepass = "UPDATE members SET password='$db_password' WHERE username=$username"; $result = mysql_query($updatepass); $congrats = "password updated."; }else{ $congrats = "wrong password try again..."; } } ?> <form class="form-1" method="POST"> <label for="opassword">Old Password: </label> <input id="opass" type="password" name="opass" placeholder="old password" /> <label for="password">New Password: </label> <input id="pass" type="password" name="pass" placeholder="new password" /> <input type="submit" id="passupdate" name="passupdate" value="Update Password" class="btn right" /> <?php print($congrats);?> </form>
  8. Here is a script i wrote so i could refresh a div with content every 5 seconds but for some reason it doesnt work ... i wanted it to load it with the page then start the refresh i didnt want it to have to wait for the refresh to show up. <script type="text/javascript"> function page_load(){ $('#contentforads').load('<?php print $actual_link ?>/ads.php').fadeIn("slow"); } function refresh(){ page_load() var auto_refresh = setInterval(page_load(),5000); } </script>
  9. I am running this query and the only thing i want is the title and for some reason it is giving me this. Recourse id # 7 ? Here is my query that i am running. $photo = $_GET['image']; $retrievetitle = "SELECT title FROM photo_from_user WHERE picture = '$photo' limit 1"; $title = mysql_query($retrievetitle);
  10. thank you it works i apprecitate it so much !
  11. i really appreciate it but for some reason it just gives me a broken img ? and this is for a upload website so basically it will upload with a caption to both and then an admin aproves it or denys it
  12. is there anyway to do this with jquery ? and php?
  13. can you show me an example with the code ive given ? i have tried others but i just cant seem to get this to work
  14. Hello I have a script that puts text on a picture... i need help, i dont know to position these captions ? i need the topcaption to be center top and the bottom center bottom but i do not know how to achieve this. here is my code so far, any help is greatly appreciated. $picture = $_GET['image']; $topcaption = $_GET['topcaption']; $bottomcaption = $_GET['bottomcaption']; //Set the Content Type header('Content-type: image/jpeg'); if (isset($_GET['image'])){ // Create Image From Existing File $jpg_image = imagecreatefromjpeg("../useruploadedphotos/$picture"); // Allocate A Color For The Text $white = imagecolorallocate($jpg_image, 255, 255, 255); // Set Path to Font File $font_path = '../fonts/Timeless-Bold.ttf'; // Set Text to Be Printed On Image $text = $topcaption; // Print Text On Image imagettftext($jpg_image, 0, 0, 0, 0, $white, $font_path, $text); imagejpeg($jpg_image, "../photos/$picture"); imagejpeg($jpg_image, "../useruploadedphotos/$picture"); imagejpeg($jpg_image); // Clear Memory imagedestroy($jpg_image); // header("location: success.php"); }
  15. <?php error_reporting(E_ALL); ini_set('display_errors', '1'); //Set the Content Type header('Content-type: image/jpeg'); if (isset($_GET['image'])){ $picture = $_GET['image']; $topcaption = $_GET['topcaption']; $bottomcaption = $_GET['bottomcaption']; // Create Image From Existing File $jpg_image = imagecreatefromjpeg("../useruploadedphotos/$picture"); // Allocate A Color For The Text $white = imagecolorallocate($jpg_image, 255, 255, 255); // Set Path to Font File $font_path = 'fonts/Timeless-Bold.ttf'; // Set Text to Be Printed On Image $text = "$topcaption"; // Print Text On Image imagettftext($jpg_image, 25, 0, 75, 300, $white, $font_path, $text); imagejpeg($jpg_image, "../photos/$picture"); imagejpeg($jpg_image, "../useruploadedphotos/$picture"); imagejpeg($jpg_image); // Clear Memory imagedestroy($jpg_image); // header("location: success.php"); } else{ die('eror'); } ?>
  16. i just goes blank with a broken image... i think its because i set the content type as image/jpeg
  17. I am trying to set variables with $_GET from the url... caption.php?image=53348b3068f36.jpg&topcaption=sdfas&bottomcaption=asdfadf if (isset($_GET['image'])){ $picture = $_GET['image']; $topcaption = $_GET['topcaption']; $bottomcaption = $_GET['bottomcaption'];
  18. i just got it to work ! thank you !
  19. still nothing here is all of my code... <?php //Set the Content Type header('Content-type: image/jpeg'); if (isset($_GET['image'])){ $picture = $_GET['image']; // Create Image From Existing File $jpg_image = imagecreatefromjpeg("useruploadedphotos/$picture"); // Allocate A Color For The Text $white = imagecolorallocate($jpg_image, 255, 255, 255); // Set Path to Font File $font_path = 'fonts/Timeless-Bold.ttf'; // Set Text to Be Printed On Image $text = "This is a sunset!"; // Print Text On Image imagettftext($jpg_image, 25, 0, 75, 300, $white, $font_path, $text); $directory = "/useruploadedphotos/$picture"; imagejpeg($jpg_image, "useruploadedphotos/$picture"); // Clear Memory imagedestroy($jpg_image); } else{ die('eror'); } ?>
  20. I want to save a caption to a file but for some reason it will not save the file ? here is the code that i am working with ... $directory = "'useruploadedphotos/53346044e7cb6.jpg'"; imagejpeg($jpg_image, $directory);
  21. Hi i want to change the attribute of a div id when the div is clicked.. but its not working for some reason ? $('#prev').attr('id',''); $('#next').attr('id','2'); //Pagination Click $(".controls").click(function(){ $("html, body").animate({ scrollTop: 0 }, 700); $('#next').removeattr('id',''); $('#prev').attr('id',''); $('#next').attr('id','7');
  22. Okay so i have a file that i need some php variables from. This is the code that i am using. please help ! This is the ajax that i am trying to use to get the variable and then set it to a php variable. $.ajax({ url : 'pagination_data.php?page=1', type : 'POST', data : data, dataType : 'json', success : function (result) { var k=result; <?php $next ?>=var k; }, error : function () { alert("error"); } }); Now here i am setting the varialbes in the other file. $next = $page+1; $prev = $page-1; echo json_encode($next); echo json_encode($prev); and this is where i need the variables... <?php echo "<div class='controls' id='$prev'></div><div class='controls' id='$next'>"; ?>
  23. Is there some way to make it to where a user is only allowed to the site if they have donated to the site ? otherwise they get a page where it askes to donate to the site and then they can access the content in the back ? I would like to do this in PHP
×
×
  • 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.