Forum Moderators: coopster

Message Too Old, No Replies

PHP URLs truncated at symbols

I looked through the postings, and I am not sure if this has been answered

         

gunders

3:58 am on May 14, 2003 (gmt 0)

10+ Year Member



My site uses php and Mysql. URLs are stored in the database. It seems that when you click on a link generated by the php code (on the link exchange sites for instance) the url is truncated.

<snip>

I have a feeling this is an easy one? but I know little about php.

Thanks for the support!

Ed

[edited by: jatar_k at 4:01 am (utc) on May 14, 2003]
[edit reason] no urls thanks [/edit]

jdMorgan

4:08 am on May 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



gunders,

Welcome to WebmasterWorld [webmasterworld.com]!

May we please have that again, but using "example.com"?

(To keep these forums honest and spam-free, all of us either sell or provide information about widgets, and we all have our sites hosted at www.example.com.)

HTH,
Jim

gunders

4:11 am on May 14, 2003 (gmt 0)

10+ Year Member



Jim,
Thanks!

example:
[example.com...]
becomes
[example.com...]

Thanks for the help
Ed

dmorison

4:30 am on May 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Ed,

There's no obvious reason why the / character would upset anything. Backslash - yes, but forward slash should be ok.

Can you post the line of code that creates the HTML?

Are you using html_entities() to ensure that any special characters are encoded correctly?

gunders

4:40 am on May 14, 2003 (gmt 0)

10+ Year Member



Hello dmorison,

Not using html_entities()

This is the code:

<?
session_start();
session_unset();
setcookie(session_name());
$HTTP_COOKIE_VARS=Array();
$_COOKIE=Array();
$_REQUEST=Array();
session_destroy();
include 'db.php';
global $REQUEST_URI;
global $SCRIPT_NAME;
$path = $SCRIPT_NAME;
$base_href = dirname($path);
$vars = str_replace($path, "", $REQUEST_URI);
$array = explode("/",$vars);
$num = count($array);
for ($i = 0 ; $i < $num ; $i++) {
$user["a".$i] = $array[$i];
}
$username = $user["a1"];
$interogare="SELECT * FROM users WHERE username='$username'";
$sql=mysql_query($interogare);
$username_check = mysql_num_rows($sql);
if(!$username_check > 0)
{echo "No such user";}
else
{while($row = mysql_fetch_array($sql)){
foreach( $row AS $key => $val ){
$$key = stripslashes( $val );
}}
session_register('s_username');
$_SESSION['s_username'] = $username;
session_register('s_activated');
$_SESSION['s_activated'] = $activated;
session_register('userid');
$_SESSION['userid'] = $userid;
session_register('s_sponsor');
$_SESSION['s_sponsor'] = $first_name." ".$last_name;
session_register('s_stormpay');
$_SESSION['s_stormpay'] = $stormpay;
session_register('s_paypal');
$_SESSION['s_paypal'] = $paypal;
session_register('s_url');
$_SESSION['s_url'] = $url;
session_register('usd');
$_SESSION['usd'] = $usd;
session_register('s_popup');
$_SESSION['s_popup'] = $popup;

if(!$activated > 0)
{echo "Please pay your Membership fee to your Sponsor. Thank You";}
else
{
$sql = "UPDATE users set hits=hits+1 WHERE userid='$userid'";
$result = mysql_query ($sql);
echo"<script language=\"JavaScript\">window.location.href='http://www.example.com/index.php';</script>";

}
}

?>