Page 1 of 2

Creating ID's

Posted: Wed May 26, 2004 8:27 pm
by sk8erh4x0r
Having trouble creating ID's for users on my webpage... need help
?>

Posted: Wed May 26, 2004 8:32 pm
by kettle_drum
What sort of ID's? Sessions?

Posted: Wed May 26, 2004 8:33 pm
by Joe
Hmm sk8er you need to be more specific. (Its ur bud from mediamonks here by the way, hehe). Anyway if it's still the problem with your viewprofile use something along the lines of:

<?php
$show = $_GET['ID'];
$link = mysql_connect($host, $user, $pass);
mysql_select_db($dbname) or die("couldnt connect" . mysql_error());
$sql = "SELECT * FROM $tblname WHERE ID = '$show'";
$result = mysql_query($sql) or die(mysql_error());

if (mysql_num_rows($result))
{
$row = mysql_fetch_array($result);

etc, etc...
?>

It has nothing to do with ID's. I just used ID as a variable example, lol.

Peace man 8)

Posted: Wed May 26, 2004 8:33 pm
by feyd
creating what kind of ID's? user id, session id, unique id, global/universal unique id (GUID or UUID)..

little more detailed...

Posted: Wed May 26, 2004 8:40 pm
by sk8erh4x0r
The ID's i am setting up are user ID's. People are able to register accounts there. When an account is created, it sends the info to the mySQL database and opens up a userinfo page. On that userinfo page, I want the ID to show up in the URL. Ex.

URL_HERE/userinfo.php?ID=sk8erhacker


How do i set up that ?ID= ?

Posted: Wed May 26, 2004 8:46 pm
by Joe
I just told you the code required to make a userinfo profile. If your asking how the ID can forward you to the userinfo page when you click it's link you should setup a variable and a new db column. The variable should go like:

$user = "<A href=http://www.securityglitch.com/userinfo. ... rname."</A>";

Posted: Wed May 26, 2004 9:11 pm
by tim
you could use auto_increment attribute here.

it would look like

user.php?id=8

or just use mysql_fetch_array to get the row['username'] and just connect to the sql server via the $_POST OR $_GET method to get the exact record(s) of the specific username

Posted: Wed May 26, 2004 10:02 pm
by d3ad1ysp0rk
http://www.securityglitch.com/Tutorials/

The fact that you have "Hacking" and "Cracking" in the same tutorials list makes me not want to help you much. :\

edit: also, check the freewebs TOS. I don't believe they allow illegal things to be hosted on their sites.
Also, try a new template.

Posted: Wed May 26, 2004 10:13 pm
by sk8erh4x0r
lol. I'm not getting hosting off of FreeWebs... plus, if u click on hacking or cracking, its a dead end. I haven't gotten to that part of the site yet. They're just there as fillers. :)

Posted: Sat May 29, 2004 6:58 pm
by Joe
Hey LiLpunkSkateR, I must say that your opinion against security enthusiasts is very low. Do you know anything about hacking and what it's purpose is. I do not think the person in question is planning to destroy anything. Instead I think he's just trying to improve his security skills to prevent any unwanted intrusions to his property. And as for the freewebs problem, well I had a look and noticed that nothing from the freewebs server which is being used on that site is illegal at all.

Do not judge ones thoughts, we are all individuals!


Regards 8)

Posted: Sun May 30, 2004 4:29 pm
by JAM
tim wrote:you could use auto_increment attribute here.

it would look like

user.php?id=8

or just use mysql_fetch_array to get the row['username'] and just connect to the sql server via the $_POST OR $_GET method to get the exact record(s) of the specific username
Actually, I would personally use this approach, as it's very, very hard to have a primary unique id/key to apear twice. It's the most common version imho ( as seen on this very board, the u=11209 part of profile.php?mode=viewprofile&u=11209 )

If you use an auto_increment id, you have more than half the work done made.

Ok

Posted: Mon May 31, 2004 4:37 pm
by sk8erh4x0r
I'm having trouble with this auto_increment thing. I have a column set as:

field = id, type = varchar, length/values* = (none), attributes = (none), null = not null, Default** = (none), Extra = auto_increment.

When i go to save i get the error saying that it is incorrect. Any help?[/mysql_man]

Posted: Mon May 31, 2004 4:47 pm
by feyd
type should be int, I think for auto-increment to work..

Posted: Mon May 31, 2004 8:24 pm
by sk8erh4x0r
Ok. That did work, but now do i set that up in the PHP code so it sets an ID # when someone signs up?

Posted: Mon May 31, 2004 8:35 pm
by tim
just use INSERT, for each new incoming row into the table, it will attach a id number to it.

some people do something like this

INSERT INTO table_name VALUES (' ', '$var', '$var2');

where the '' means the id field.