Most common open source licenses include a phrase like that. This is the MIT license, for example.
Typically, this is just included in the code as a comment, so that, as you describe, someone could see it if they looked at the code. IANAL, but presumably you can come up with whatever license you...