DIgital Input And 120VAC Line Voltage

I need to build a dimmer controlled by an arduino and need to sync a timer to AC phase so the triac works properly. Can i connect one of the digital input pins directly to AC line voltage via a 20 megaohm resistor?

A PIC Can handle it. ( page 3 )

Or should i use a zener diode?

That arrangement only works if you have the Arduino ground connected directly to one side of the 120v ac supply, then the 20M resistor can be connected to the other. For safety reasons, this isn't a good idea for home-built projects, and is a definite no-no if you want to connect the Arduino to anything else such as a PC.

A better way of doing this is to use an optoisolator. Drive the LED from the 120V AC supply by using a suitably large series resistor and diode in inverse parallel. Use the transistor output to drive a digital pin on the Arduino with a suitable pull-up resistor. That way, it's a lot safer than a direct connection to the 120V power.

And you should consider in addition to the opto-isolator, using a small 120vac transformer for the actual interface to the mains connection. That would allow isolation from the neutral and hot 120vac wires.