Jump to content

User Specific Url


pranshu82202

Recommended Posts

I am a student and learning php.

Actually i have my code ready.

 

I have created the registration page.

A php script to send registration details to database.

 

I have created a login page.

A php script to verify the login

 

I have created a general page for all user which have some text fields.

 

Url of the page be like (http://abc.com/everyone.php?id=8) ( Here ID is the id of the registered user) (Anyone can access this page) in which any (even non registered or logged in ).

When user enter data the data automatically inserts into my sql database with the id of the registered user.

 

I have successfully inserts all the data except the id of the owner of the page.

 

And also tell me how shuld i create such a url ...

And what shuld be the name of the general page (everyone.php)

I am pissed off ....

Link to comment
Share on other sites

the php page in which i verify the login,

$username = $_GET['usname']; 
$userpass = $_GET['uspass'];
$username = stripslashes($username);
$userpass = stripslashes($userpass);
$username = mysql_real_escape_string($username);
$userpass = mysql_real_escape_string($userpass); 
$sql = "select * from logintable where us_name='$username' and us_pass='$userpass'"; 
$result=mysql_query($sql);

$count=mysql_num_rows($result);
if($count==1){
session_register("usname");
session_register("uspass"); 
$userPrimaryKey1 = "select id from logintable where us_name='$username'";
$userPrimaryKey=mysql_query($userPrimaryKey1);

// Now from here the problem starts
// I want to redirect user to a member page (only accessible to mebers)
// In which i will provide him a url (Corresponding to his id) (and accessible to anyone)
// When someone enters the url and insert some value in the url i want to store those in my database with a id field (id of the user to which this url belong)

echo "Your generalized url is "
echo 'http://abc.com/everyone.php?id='.$userPrimaryKey.'';

// please tell me weather i write it correct or not.

else {

echo "<br>";
echo '<center>'."Wrong Username or Password".'</center>';
}

Link to comment
Share on other sites

Let me elaborate

i have a page everone.php in which their is a text field.

 

and their is a link http://abc.com/everyone.php?id= which displays same page everyone.php but when someone enters an any value in the textfield it get stored in my database with the id of the user with which it belongs...

 

Plzz Help me i want to create something exactly like www.crushbits.com.

You plzz access this site and you'll get to know what i want to create...

 

You guyzz are great ... Plzz Help Me

 

Link to comment
Share on other sites

What I'm asking is, is the "id" variable connected to the Users "id"?

 

ID // NAME

1 // ANDY

2 // JAMES

3 // TEST

 

If the ID = 1, it will send it to Andy.

If the ID = 2, it will send it to James.

If the ID = 3, it will send it to Test.

 

Is that what you're onabout?

 

We can't help you not knowing what the 'id' variable in the URL is related to.

Link to comment
Share on other sites

first of all users register to my site.

After which i allot them a username, password, id (an auto increment column and a primary key )

 

This is the id ...

When the registered user log in

We redirect them to the members page which looks somewhat like this

 

--------------------------------------------------------------------------------------------------

 

Welcome,

Your personal url is

http://abc.com/everyone.php?id= 8

(You can give this url to anyone)

 

here is the data which others enter with your url

 

xyz

abc

...

..

.

 

--------------------------------------------------------------------------

 

Did you get what i am trying to say.....

Link to comment
Share on other sites

Do you have MSN or anything? I think it'd be easier to help what you want to do as I'm starting to get the idea of what you mean.

 

What you're wanting is the 'id' in the URL to be connected to the user 'id', which will then show the page, but when entered, it sends it accordingly to the 'id' that is connected to the user.

Link to comment
Share on other sites

Exactly... Well i m on gtalk

pranshu.a.11@gmail.com

You can add me if you are also on gmail

 

Well can you tell me the code of the verification page  (login verification page) and the code of everyone.php page and the code of php which inserts the data into the database.....

 

It would be damn good if you provide me these...

PLZZ HELP

 

 

Link to comment
Share on other sites

I'll need to see your codes, and then I can show you how to make it,

 

pretty much, to show the link once they registerd, add this to "sucess" part of your register.php page:

 

$getIDQ = mysql_query("SELECT * FROM `tbl_name` WHERE `username`='".$user."'");
$getIDF = mysql_fetch_assoc($getIDQ);

echo 'Your link is: http://abc.com/everyone.php?id='.$getIDF['id'];

 

Adapt the code to how you need.

-------------------------------------------------

 

 

On the Everyone.php page, use this:

 

$id = $_GET['id'];

$get_user = mysql_query("SELECT * FROM `users` WHERE `id`='".$id."'");
$user_info = mysql_fetch_assoc($get_user);

 

adapt that also.

 

-----------------------------------------

 

When they send the 'value'

 

Use the query like:

 

$user = $user_info['username'];
$value = $_POST['value'];

$send = mysql_query("INSERT INTO `tbl_name` VALUES ('', '$user', '$value')");

 

If thats how you want it, I think thats what you mean.

Link to comment
Share on other sites

Sir one more help plzz...

 

 

On the Everyone.php page, use this:

 

Code: [select]

$id = $_GET['id'];

 

$get_user = mysql_query("SELECT * FROM `users` WHERE `id`='".$id."'");

$user_info = mysql_fetch_assoc($get_user);

 

adapt that also.

 

-----------------------------------------

 

When they send the 'value'

 

Use the query like:

 

Code: [select]

$user = $user_info['username'];

$value = $_POST['value'];

 

$send = mysql_query("INSERT INTO `tbl_name` VALUES ('', '$user', '$value')");

 

 

 

 

 

Can you plzz little bit explain these codes.....

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.