Jump to content

A-Jay

Members
  • Posts

    2
  • Joined

  • Last visited

A-Jay's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. If I understand right, you are asking for a way to include two input values into a string which will then be the name of a web site that is loaded. I would do it somehow like this (in pseudo-code): Validate catid and pagenum If validated, make string with URL from catid and pagenum, and load page from string Else, show error message (or default page) When doing sensitive tasks (like file i/o, database access, and loading pages) based on user input it is always advisable to validate the input to make sure it is like expected. Otherwise, it could be an invitation to the 'bad guys' out there to execute bad script on the server.I would validate catid and pagenum by using the function ctype_digit() to check that they are integers, and also check that they are within the number range expected (or at least not null). Then I would define a string and put catid and pagenum into it together witht the other text needed to make the name of the file. Finally I would load it using a require().I hope this helps If there is anything else, let us know.
  2. Actually, it is not necessarily to end your lines with ; when printing out variables with the <?= ?>.Anyway, I couldn't help but to notice the array definition lines. When defining arrays, the Array statement should always be capitalized.So in stead of for example:"var id=new array();"You should write:"var id=new Array();"In my experience writing array() with lower-case a can actually break a whole script. Strange, but that's the way JavaScript works (at least on my computer).
×
×
  • Create New...