I'm not sure where my topic content went, or if I'm doing something wrong, but here it is again. I'm not able to see it anymore for some reason.
@Mods, my apologies for the double posting of this topic, and please remove the other one that is identical.
I'm new to the forum, and hopefully I did a good job with the title.
Essentially I want to block all urls except for a handful. When a person reaches a blocked page, I want to redirect them to the photo upload page.
The way that I find out if they have uploaded a photo is by this: $member_profile_image. That is a snippet the the platform gives that will display the url in text on the webpage. It doesn't require anything other than what I've given to do that, so the <?php reference to it in the script isn't needed, nor will it work because I don't have access to php.
What I've been trying to do thus far is finding out the indexOf a particular word in the default photo's address on the server. Default meaning, if you haven't uploaded a photo, you have the default one that everyone does when they first join. The address for the photo contains the word "Default", and it indexes out at 22.
So, if the index value shows up at 22, and they are on a blocked page, redirect them to the photo upload page and alert("you have to upload a photo"). If the index value shows up at 22 and they are not on a blocked page, do nothing at all. What seems the easiest since I want pretty much all urls to blocked aside from a handful, would be to just say, if these urls and index of 22, do nothing, else redirect and alert.
What I'm working with is below, but it's total fail and I don't know why:
image = "$member_profile_image"; // Displays the url as text, no <?php.
upload = image.indexOf("Default") === 22; // Default indexes at 22 in the url
myurls = [
if(myurls.indexOf(window.location) > -1 && upload)
//This is where I need the code to do nothing at all.
alert("you have to upload an image to access this page");
I've tried it this way and I can't get much of anything to happen at all. Anyone have any advice or tip on what could be going wrong?