Well, both of the are correct, but there is a LOGICAL difference:
The first sentence says that if I ever see you passing me by on the street, I would greet you.
For the second one consider the story: you see me on the street and you say "I saw you yesterday in the park and I said hello. Why didn't you greet me back?". I obviously would have greeted you if you had seen you, because we are friends, but I haven't seen you, so I would say "If I had seen you, I would have greeted you.".
There is obvious grammatical difference between those two sentences, but I think it is easier to distinguish them this way :D