-3

I have a link on my website which I post in almost every post and which is like this http://somedomain.com/thankyou/?data=abcde/AdJ8YEZAdd4ubfbW4Aztw2Ur/12345 . where "abcde" and "12345" is a random test which I am currently adding myself. I need your help to make the "abcde" and "12345" random text to generate automatically in the link so that I don't have to add them by my self. the middle code "AdJ8YEZAdd4ubfbW4Aztw2Ur" is the main code

thank you very much, looking forward to receiving any help.

Singh G
  • 45
  • 1
  • 7

1 Answers1

0

I am assuming you are creating these urls through php in that case you can write something like

$url = 'http://somedomain.com/thankyou/?data=' . substr (str_shuffle('abcdefghijklmnopqrstuvwxyz'),0,5) . '/AdJ8YEZAdd4ubfbW4Aztw2Ur/'  . rand(1500,9999)

in js you can do it like

var url = 'http://somedomain.com/thankyou/?data=' + (rand(--length, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz".charAt(Math.floor(Math.random() * 60)) + '') : '').substring(1, 5) + '/AdJ8YEZAdd4ubfbW4Aztw2Ur/' + Math.random()
Arpita
  • 1,386
  • 1
  • 15
  • 35