I tried everything, re-installing iTunes, trying on another computer.
The only solution I had is restoring and re-jailbreaking my iPhone, but iTunes said that my iPhone was not eligible to be restores, but I tried restoring to the same version I have,I don't know what's wrong. I didn't even try to upgrade to 3.1.3 because I know the problems it's causing. And I am not using iTunes 9.1 which caused a problem with certain iPhones. I tried blackra1n fix and re-jailbreaked it, but it also didn't work, so I'm clueless here.

So now, I can't sync music and applications to my phone, and I can't restore it anymore.

You have to place the phone to DFU mode.
Open iTunes. Connect the iPhone. You will get the error, accept it. Next hold the power and home buttons for exactly 10 seconds. At this point release the power button and keep holding the home button for exactly 10 more seconds. Release the home button and iTunes should detect your phone for recovery (DFU mode). Restore your firmware.