Jump to content

LINK With Spaces Wont be renamed to Without Spaces


Ziph

Recommended Posts

For some reason it wont add _ for where the spaces are

 

this is the outcome of this code

(Ziph) () test test test = fixedlink http://www.gosuhosting.com/upload/Ziph/0028 shakaalxZ ZiphP.rep = mustfixlink

 

<?php

// Start a session

session_start();

// Sends the user to the login-page if not logged in

if(!session_is_registered('member_ID')) :

header('Location: ../login/login.html?msg=requires_login');

endif;

// DB connect ifno

include '../mysql/db.php';

// functions

include '../mysql/functions.php';

 

$username = user_info('username');

echo "($username) ";

echo "($filename) ";

 

$filename = $_GET["msg"];

 

$filelinkconstruct = mysql_query("SELECT filelink FROM uploads WHERE username='$username' AND filename='$filename' ");

while($fix = mysql_fetch_assoc($filelinkconstruct)) {

$mustfixlink = $fix['filelink'];

};

 

$fixedlink = preg_replace('[%[\s]+%]', '_', 'test test        test');

echo "$fixedlink = fixedlink";

echo "$mustfixlink = mustfixlink";

 

?>

 

test test         test is ofcourse in the final version to be replaced with $mustfixlink but the test test test is to test it hehe i also tried to rename the file also didnt work.

 

this preg_replace code does work with other people so i dont know what im doing wrong.

 

preg_replace uses the Regular Expression (google for more information) engine, while str_replace uses simple string matching. str_replace is a lot faster than preg_replace, but nowhere near as powerful.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.