Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 858 Vote(s) - 3.61 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Drupal url encoding

#1
I am having trouble properly encoding URL data. Using the following code:

$redirect = drupal_urlencode("user/register?destination=/node/1");
drupal_goto( $redirect );

but, the URL that comes up in my browser test is the following:

[To see links please register here]


I thought using the `drupal_urlencode` function should fix this encoding issue. How can I fix it?
Reply

#2
You'd be better off using the built in [`url()`](

[To see links please register here]

) function to create your URL, if you pass an array as the `query` parameter it handles URL encoding for you:

$options = array(
'absolute' => TRUE,
'query' => array('destination' => '/node/1')
);
$redirect = url('user/register', $options);

drupal_goto( $redirect );

`drupal_encode()` will encode the whole string that you pass to it, so if you want to do it your original way it would look like this:

$redirect = 'user/register?' . drupal_urlencode("destination=/node/1");
drupal_goto( $redirect );
Reply

#3
The simplest way of doing this in Drupal 6 is:

drupal_goto("user/register","destination=/node/1");

Reply

#4
The below code from Clive worked for me..


$options = array(
'absolute' => TRUE,
'query' => array('destination' => '/node/1')
);
$redirect = url('user/register', $options);

drupal_goto( $redirect );

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through