How can I remove part of a string in the address bar?
Hi,
Is is possible to remove the @hotmail.com part of a string that has been submitted in the address bar? for example, when the user clicks on the user name the following page is displayed profile.php/[email protected], is there a way to do this?
How would I change the link in the browse users page to use the username instead of email address to get the user details?
kb posted this at 15:11 — 15th July 2007.
He has: 1,380 posts
Joined: Feb 2002
It would depend on your site's structure. If you created the system that allows profile.php/[email protected] to show the profile, then you are the one who knows how to fix it.
Otherwise, it depends on whose/what code you're using. Chances are that if it's some packaged software, it's not going to be easy to change.
pr0gr4mm3r posted this at 18:35 — 15th July 2007.
He has: 1,502 posts
Joined: Sep 2006
Your system is using that email address as the key in the database. Unless there is another unique field in the DB that you can use as the key, you will have to stick with the email address.
drew22299 posted this at 11:20 — 16th July 2007.
They have: 105 posts
Joined: Mar 2006
Thanks for your replies and yes, there is the userId field. It's a script I have modified so I can learn how it works. If I change the reference to userId as the reference in the link it goes to the user details page and there is an ASP error which says there needs to be a current record selected or something. There are some cookie assignments at the top of the page, could they have anything to do with this error?
pr0gr4mm3r posted this at 13:25 — 16th July 2007.
He has: 1,502 posts
Joined: Sep 2006
Doubt it. If you change it to the userid instead of the email, you should change all queries on that page that refers to the email. Make it refer to the userid instead.
...or a less efficient but quicker way would be to insert some code in the beginning of the page that takes the userid from the URL, and uses that to find the email address. Then, you can set the email $_GET variable for the rest of the queries that use it.
drew22299 posted this at 15:19 — 16th July 2007.
They have: 105 posts
Joined: Mar 2006
I will try chaning all of the references to userId when I can get to my computer.
At the top of the user details page is
<?php
username = request.cookies("passes")
?>
I think username is the email address, this is why I asked if the cookies have anything to do with the error?
This is the code on the browse user page, "user" is the email field, why does it give an error when I replace user with userId? It's still refering to a record? or is it because it isn't a primary key?
while not rs.eof%>
b>
<?php
=rs("userId")
?>
<?php
">=rs("user")
?>
<?php
=rs("user")
?>
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.