₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,049 members, 8,420,058 topics. Date: Thursday, 04 June 2026 at 10:27 AM

Toggle theme

Help In Php Programing - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingHelp In Php Programing (926 Views)

1 Reply (Go Down)

Help In Php Programing by nimboya(op): 10:40pm On Nov 12, 2010
How do i create a redirect to a page like www.websitename.com/username

Please someone help me
Re: Help In Php Programing by binkabir(m): 7:40pm On Nov 13, 2010
what do u really want to do?

redirecting an authenticated user to another site that need assess control or just redirect to a different url?

if the latter is the question u can simple use the php built in function "header" to redirect

eg
<?PHP

  header('location:user.php');


?>

u can also put it in conditional statment so that u can redirect to different pages
based on the conditions
Re: Help In Php Programing by nimboya(op): 10:17pm On Nov 20, 2010
What i actually mean is that just like when you type in facebook someones special page like www.facebook.com/ewere it will open the user's page
Re: Help In Php Programing by gameaddict(m): 10:36pm On Nov 20, 2010
google url rewrite.
Re: Help In Php Programing by mikkytrio(m): 1:36pm On Nov 26, 2010
on the page where you want the extra value to be fixed eg
http://www.yourwebsite.com/username
and username is the value to be inserted then on the http://www.yourwebsite.com/index.php or the profile.php page place this codes

$url = empty( $_SERVER['REQUEST_URI']) ? index.php:$_SERVER['REQUEST_URI']; //this gets the address from the address bar eg /index.php or username
$url = stripslashes($url); //strips off the /username to username

//then u palce a conditional statement to collect the /username and lead the user to the expected page
//first of all access ur database to get all usernames

/*,

codes for connecting to database and table where username is located goes here
to get username i prefer using
$sql = mysql_query("select from ".$tableName." where columnName=".$url);

assuming there is a column called username and userpage eg username.php

$userUsed = mysql_fetch_row($sql);
$newUrl = $userUsed ? false: $userUsed['userpage'];


, */
if($newUrl )
header("location:".$newUrl);
else
header("location:index.php"wink;



Please, these codes are open to suggerstions.
Re: Help In Php Programing by dee5(m): 5:58pm On Nov 26, 2010
^^ nice tip
Re: Help In Php Programing by mikkytrio(m): 3:59pm On Nov 29, 2010
thanks but ıt ıs not so secured, because a sql query ran in the browser can acess the database.
1 Reply

Which Programing Language Is Best To Start WithOnline Shopping System In Php Documentation HelpRunning Python Codes In Php234

Wp - Member Plugin For Wordpress, Register Link Not ShowingHow Are Short Codes Developed By Telecom CoysMcts