# Your Site Has Been Hacked By KILO HACKER#



..# KILO HACKER was here #..

# ..MoHaMmeD.. #


Mail:~ UTJS@HoTmAiL.CoM


My BB Pin is :~ 21DE1C3B

 

   

00110101001010100011101101010110011110110010011000111000110111000111111000110101101110010000000111111110001110
11001010111111100000100101011111100110110111101110001011010011111100110011110000100101011010000111001110110010
10000111101100111011010010111111000000000110100011011000101010100000000000010101000001001100001010010101011010
00110111011011101111100000000100100101110110100010001010111001111001101100100001100011000110011111010001011010
11000101000110100001011110100110111110001111110110111100000011110101011011010111000100111111000001001000000100
11000111101100101101000110010011000000101010010011000010110100101010000111000001111111011111101101011001100101
00110011010001001010001110110011101010101101011010000101100011011010001110111000100101010111010011001100011100
11010011011010011001001010000000101010111101101001100010100000010001111101000101010111101110001111111000100100
10010011010101011101100000011101010000010001001100011101110000101100000001111000001011101000011110000010010100
011110111010011111001110111001100110110001011100100
10010011000000001010111101110111110010101111111110001101101
11010110011010011011011000110101000011100000011111110110110000110001110110100001010010110101101000101101010110
10011101110001000100110101011010100111101110001110101111001010011011111001001000001001101111110000111011000000
1101101010110110000101101110111100011010011111111010100111010101
0110111010001000010110100110001100001110010111
0001100001111011101010101100011110011110011011101011
1100111000011110101010000010110001011111100011110000001110
0001111101110010000111100011011100111101110001001011
1111010101010101010110000100011011110011111001001101010001
11001111101011011101111101101110100100011110100100001101011001101110000110000001001011011001000000101000000110
10110100000111001001100001000000101000000101001100111001110100101000001010010110011111110110001111000101111010
1001001100110100001100101000100100011001111001010110001110010001
1010010101111001100011110110010111110001011010
111100000110010111110001100000111000000011011101000000011100101001
10111101010110100011101110010011011010001111
00100010101011000111101011100011011110100000111010101101010110110010010110001001011000000100010100111101000000
00100101110111110110101110011100100000010110110000100011100101000100001110100011110101100100100010111011111010
0111001101100000000111001001011000100011001
0100101011100100111110001110111111100100111001101100000011111100001
00001010011111110010110111010111111010001111001011101011010111110000000011001011000110110011110001111111101000
001000000101010111110001101011110100110001000
10100101001110100000110111011010010101001011100100011111110110100
01001100101010101000001011101110100000110001101000100010110011001011111011010111000100100111110110110010000011
01001011110100000000100010101101110001000000001000011010011001011011010011001100110000001011011011001100000101
01101100000000101110101000100011001001001010100111101001010100000011001011001010010011111011000111010110000101
00000001010011000011010000011000101001101001110100010011000100111111010100010010100100010010100010110000101000
10110101100100101010010000001101011111101010101101000011100000010001101010100101011000110011010101001100101011
00100101100101110010101101000010010111101101000001101111011100101011110111010001111111011111010000000100010111
10001001110100101000111000011000010010000010010101100101011100000011001001100110000100001011000010111101100001
11011100000111000000100010011011111010110110110101001111100100011000001011100000010011001111110110001111000011
01100011110011111100010111010010000000001010110110010100111101110111010000110001110001010100111000110011101111
10110101100111111011101000111101000001101110010010011110011010100100010101000010101100111111000000110010101011
01000001001110000101111010011111110011101011011011100001111100001101011100011111010101011100000111101011011000
01010010110001110000001001011100001010001110010111100000101110101000110010100010010110101111010001101111111000
01110101001100010001100010100001001001001011100110000010011111011001101110000001101001010100110101000100101011
11100001001101111100111010000110111011000111011011101010000011110011101011110110111000100001000110110100000001
10101001110100111001101010001000100111011110110100110010101010010100011111001010110101001110110101001000111010
00111110010111110001100010011100001111101110110010000011101111111010111011001010011111100101100000100100101000

 
 

ahlamontada.com

 

Nov 12

2009

jQuery Star Rating + AJAX + PHP

By Jhoy Imperial Under PHP, Tutorials, jQuery

This article will show you how to create a simple star rating functionality using jQuery.

All values will be stored in our $_SESSION variables. I have set the limit of number of votes to 20. In our demo, when you have reached the total number votes, just clear your cookies in order to use the demo again.

Here is the Demo: jQuery Star Rating

HTML head

In our <head> part, we will include our jQuery file.

<script type="text/javascript" src="jquery-1.3.2.min.js"></script>

HTML body

Our html body will display the average of votes, total number of votes, the 5 stars used in rating and a response text.

Line 3: “#star-avg” will hold the average of all the votes
Line 4: “#star-total” will hold the total number of votes sent
Line 7-21: These are the rating stars assigned with different IDs. By default, their class is set to display grey stars.
Line 23: “#star-msg” will hold the response text from our remote file

        <div class="star-rating-wrap">
            <p>
                Average: <span id="star-avg">0</span>,
                Total Ratings: <span id="star-total">0</span>
            </p>
            <div class="star-rating">
                <a href="#">
                    <span id="star1" class="star-grey" title="1">&nbsp;</span>
                </a>
                <a href="#" >
                    <span id="star2" class="star-grey" title="2">&nbsp;</span>
                </a>
                <a href="#" >
                    <span id="star3" class="star-grey" title="3">&nbsp;</span>
                </a>
                <a href="#" >
                    <span id="star4" class="star-grey" title="4">&nbsp;</span>
                </a>
                <a href="#" >
                    <span id="star5" class="star-grey" title="5">&nbsp;</span>
                </a>
            </div>
            <p id="star-msg">&nbsp;</p>
        </div>

jQuery Script

This is our jQuery script and should be place within the <body> tag.

Line 3: “default_star_value” will hold the average value of votes
Line 5: We need to catch the mouse over event. On mouse over, we need to get the value of the star that is placed inside the title attribute of the span and pass it the showRedStar() function.
Line 7: On mouse out, we will call the hideRedStar() function to hide the red stars
Line 9: When user click a star, this should be counted as a vote.
Line 10: Clear the response text area
Line 12: Get the value of selected star
Line 14: We will send an AJAX request to our remote file
Line 15: Remote file
Line 17: This would be our submitted value
Line 18-20: Display the response text
Line 22: Update the default_star_value with the latest average total
Line 26: Set response type as JSON
Line 30: On mouse out of our rating stars, highlight the average star votes
Line 35: showRedStar() function highlights the stars in red
Line 43: hideRedStar() function removeds the red stars

        <script type="text/javascript">
            $(document).ready(function(){
                var default_star_value = 0;

                $("a span").mouseover(function(){
                    showRedStar($(this).attr('title'))
                }).mouseout(function(){
                    hideRedStar()
                }).click(function(){
                    $("#star-msg").html("");

                    var selected_star = $(this).attr('title');

                    $.post(
                        "demo/jquery-star-rating-response.php",
                        { star: selected_star },
                        function(data){
                            $("#star-avg").html(data.average);
                            $("#star-total").html(data.total);
                            $("#star-msg").html(data.message);

                            default_star_value = data.average

                            showRedStar(default_star_value)
                        },
                        "json"
                    );
                });

                $("a").mouseout(function(){
                    showRedStar(default_star_value)
                });
            });

            function showRedStar(star_number){
                hideRedStar();

                for(star_ctr = 1; star_ctr <= star_number; star_ctr++){
                    $("#star" + star_ctr).removeClass('star-grey').addClass('star-red');
                }
            }

            function hideRedStar(){
                for(star_ctr = 5; star_ctr >=1; star_ctr--){
                    $("#star" + star_ctr).removeClass('star-red').addClass('star-grey');
                }
            }
        </script>

PHP

In our remote file, we will process the vote using PHP. For this demo, instead of saving the votes in a database, we will store our values in a $_SESSION array.

Line 01: start our session
Line 03: Store the list of valid star vote values in an array
Line 05: Set the default total number of votes to “0
Line 06: Set the default average to “0″
Line 08: Check if we have reached the total limit of 20 votes
Line 09: If limit is not yet reached, check if the submitted value is in our list
Line 10: If valid value is submitted, push our submitted value to our array holder of votes
Line 11: Set message that the vote has been counted
Line 14: If the submitted value is not valid, set message that it is invalid
Line 18: If the limit has been reached, set message that says we have reached the total limit of votes
Line 21: Check if we stored votes in our session
Line 22: If there our votes stored, get the average of our votes. We use the ceil() function to round of the average to the nearest ones. So, if the average is 4.98, the returned value would be 5
Line 23: Count the total number of votes
Line 26: Display our result in JSON format

    session_start();

    $starValuesArr = array(1, 2, 3, 4, 5);

    $responseArr['total'] = 0;
    $responseArr['average'] = 0;

    if (count($_SESSION['rating']) < 20){
        if (in_array($_POST['star'], $starValuesArr)){
            $_SESSION['rating'][] = $_POST['star'];
            $responseArr['message'] = 'Thank you for the rating!';
        }
        else{
            $responseArr['message'] = 'Invalid vote value';
        }
    }
    else{
        $responseArr['message'] = 'You have reached the limit of 20 votes. <br/>Try to clearing your cookies to be able to vote again.';
    }

    if (count($_SESSION['rating']) > 0){
        $responseArr['average'] = ceil(array_sum($_SESSION['rating']) / count($_SESSION['rating']));
        $responseArr['total'] = count($_SESSION['rating']);
    }

    echo json_encode($responseArr)
Line 3: “#star-avg” will hold the average of all the votes
Line 4: “#star-total” will hold the total number of votes sent
Line 7-21: These are the rating stars assigned with different IDs. By default, their class is set to display grey stars.
Line 23: “#star-msg” will hold the response text from our remote file

Published by Jhoy Imperial on Thursday, November 12th, 2009 2:47 am Under PHP, Tutorials, jQuery

Tagged , , ,

Comments (9)

  1. [...] This post was mentioned on Twitter by codingcereal, codingcereal. codingcereal said: jQuery Star Rating + AJAX + PHP http://bit.ly/1AyHT9 [...]

  2. where to download the source code?

  3. code is not complete i think. css missing

  4. Finally, my first ajax-ish setup works. Thanks a lot Jhoy! Great work.

  5. this is not so clear to develop

  6. where

    star-grey.jpg

    star-red.jpg

    i cant dawnload it

  7. You should be give chance to download as .zip file.

  8. Maybe it can help MAGENTO-DEVELOPER.

Leave a Comment

Hacked By KILO HACKER

# Your Site Has Been Hacked By KILO HACKER#



..# KILO HACKER was here #..

# ..MoHaMmeD.. #


Mail:~ UTJS@HoTmAiL.CoM


My BB Pin is :~ 21DE1C3B

 

   

00110101001010100011101101010110011110110010011000111000110111000111111000110101101110010000000111111110001110
11001010111111100000100101011111100110110111101110001011010011111100110011110000100101011010000111001110110010
10000111101100111011010010111111000000000110100011011000101010100000000000010101000001001100001010010101011010
00110111011011101111100000000100100101110110100010001010111001111001101100100001100011000110011111010001011010
11000101000110100001011110100110111110001111110110111100000011110101011011010111000100111111000001001000000100
11000111101100101101000110010011000000101010010011000010110100101010000111000001111111011111101101011001100101
00110011010001001010001110110011101010101101011010000101100011011010001110111000100101010111010011001100011100
11010011011010011001001010000000101010111101101001100010100000010001111101000101010111101110001111111000100100
10010011010101011101100000011101010000010001001100011101110000101100000001111000001011101000011110000010010100
011110111010011111001110111001100110110001011100100
10010011000000001010111101110111110010101111111110001101101
11010110011010011011011000110101000011100000011111110110110000110001110110100001010010110101101000101101010110
10011101110001000100110101011010100111101110001110101111001010011011111001001000001001101111110000111011000000
1101101010110110000101101110111100011010011111111010100111010101
0110111010001000010110100110001100001110010111
0001100001111011101010101100011110011110011011101011
1100111000011110101010000010110001011111100011110000001110
0001111101110010000111100011011100111101110001001011
1111010101010101010110000100011011110011111001001101010001
11001111101011011101111101101110100100011110100100001101011001101110000110000001001011011001000000101000000110
10110100000111001001100001000000101000000101001100111001110100101000001010010110011111110110001111000101111010
1001001100110100001100101000100100011001111001010110001110010001
1010010101111001100011110110010111110001011010
111100000110010111110001100000111000000011011101000000011100101001
10111101010110100011101110010011011010001111
00100010101011000111101011100011011110100000111010101101010110110010010110001001011000000100010100111101000000
00100101110111110110101110011100100000010110110000100011100101000100001110100011110101100100100010111011111010
0111001101100000000111001001011000100011001
0100101011100100111110001110111111100100111001101100000011111100001
00001010011111110010110111010111111010001111001011101011010111110000000011001011000110110011110001111111101000
001000000101010111110001101011110100110001000
10100101001110100000110111011010010101001011100100011111110110100
01001100101010101000001011101110100000110001101000100010110011001011111011010111000100100111110110110010000011
01001011110100000000100010101101110001000000001000011010011001011011010011001100110000001011011011001100000101
01101100000000101110101000100011001001001010100111101001010100000011001011001010010011111011000111010110000101
00000001010011000011010000011000101001101001110100010011000100111111010100010010100100010010100010110000101000
10110101100100101010010000001101011111101010101101000011100000010001101010100101011000110011010101001100101011
00100101100101110010101101000010010111101101000001101111011100101011110111010001111111011111010000000100010111
10001001110100101000111000011000010010000010010101100101011100000011001001100110000100001011000010111101100001
11011100000111000000100010011011111010110110110101001111100100011000001011100000010011001111110110001111000011
01100011110011111100010111010010000000001010110110010100111101110111010000110001110001010100111000110011101111
10110101100111111011101000111101000001101110010010011110011010100100010101000010101100111111000000110010101011
01000001001110000101111010011111110011101011011011100001111100001101011100011111010101011100000111101011011000
01010010110001110000001001011100001010001110010111100000101110101000110010100010010110101111010001101111111000
01110101001100010001100010100001001001001011100110000010011111011001101110000001101001010100110101000100101011
11100001001101111100111010000110111011000111011011101010000011110011101011110110111000100001000110110100000001
10101001110100111001101010001000100111011110110100110010101010010100011111001010110101001110110101001000111010
00111110010111110001100010011100001111101110110010000011101111111010111011001010011111100101100000100100101000

 
 

ahlamontada.com