Jump to content

Glenskie

Members
  • Content Count

    108
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Glenskie

  • Rank
    Advanced Member

Profile Information

  • Gender
    Not Telling
  1. Glenskie

    php and jquery button

    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. Glenskie

    php like system.

    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. Glenskie

    PHP update password

    Thank you so much !
  7. Glenskie

    PHP update password

    its defined in header.php and so is $salt
  8. Glenskie

    PHP update password

    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>
  9. Glenskie

    Auto Refresh not working

    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>
  10. 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);
  11. Glenskie

    Position caption on photo with php?

    thank you it works i apprecitate it so much !
  12. Glenskie

    Position caption on photo with php?

    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
  13. Glenskie

    Position caption on photo with php?

    is there anyway to do this with jquery ? and php?
  14. Glenskie

    Position caption on photo with php?

    yes i have
  15. Glenskie

    Position caption on photo with php?

    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
×

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.