Jump to content

[SOLVED] getting section of a url


chocopi

Recommended Posts

Weird...

 

<?php

function urlpart() {

foreach($_GET as $key => $value) {

  $var = $key;

}

$length = strlen($var);
$length = $length - 1;
$var = substr($var, 0, $length);

return $var;

}

echo urlpart();

?>

Link to comment
Share on other sites

thats what i thought.

 

could you please try and sort this:

 

<?

require_once ('page_header.php');

require_once ('url.php');

$code = urlpart();

$query = "SELECT active FROM users WHERE code = '$code'";

$update = "UPDATE users SET active ='1' WHERE code = '$code'";
mysql_query($update) or die (mysql_error());

print ("<br /> \n");
print ("<center> \n");
print ("$username, your account is now active, please login on the homepage. \n");
print ("<br /> \n");
print ("<br /> \n");
print ("<a href=\"index.php\">Home Page</a> \n");
print ("</center> \n");

?>

 

url.php is where the code you gave me earlier and page_header.php is the database connection.

 

so what this is meant to do is just update the active field from 0 to 1 using the code you gave me to get the activation code

 

thanks,

 

~ Chocopi

Link to comment
Share on other sites

<?php

require_once ('page_header.php');

require_once ('url.php');

$inputcode = urlpart();

$query = "SELECT * FROM users WHERE code = '$inputcode'";
$result = mysql_query($query) or die(mysql_error());
$result = mysql_fetch_assoc($result);

$realcode = $result['code'];
$username = $result['username'];

$update = "UPDATE users SET active ='1' WHERE username = '$username'";
mysql_query($update) or die (mysql_error());

print ("<br /> \n");
print ("<center> \n");
print ("$username, your account is now active, please login on the homepage. \n");
print ("<br /> \n");
print ("<br /> \n");
print ("<a href=\"index.php\">Home Page</a> \n");
print ("</center> \n");

?>

Try that

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.