Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,166,293 members, 7,864,436 topics. Date: Tuesday, 18 June 2024 at 06:08 PM

Help In Php Programing - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Help In Php Programing (861 Views)

Which Programing Language Is Best To Start With / Online Shopping System In Php Documentation Help / Running Python Codes In Php (2) (3) (4)

(1) (Reply) (Go Down)

Help In Php Programing by nimboya: 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: 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)

.net Forum (vb & C#) / Is This Magic? / Phpmyadmin A Tools 4 Database Design

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 14
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.