Solved

PHP path verification

Posted on 2007-03-28
8
229 Views
Last Modified: 2013-12-13
Does the following path = C:\workqueue\...  ?

$weborddir="\\c\$\\workqueue\\".$ordnum."-".$pfn.$invoice;
0
Comment
Question by:guy4graphics
  • 4
  • 3
8 Comments
 
LVL 48

Expert Comment

by:hernst42
ID: 18814212
Could you please add some more words to your question. I can't understand what you want or asking.
0
 
LVL 4

Expert Comment

by:Arrivist
ID: 18815104
Depends what you want to do with it:

$weborddir="C:\workqueue\".$ordnum."-".$pfn.$invoice;
should work fine for screen output, however,

$weborddir =  quotemeta ( "C:\workqueue\".$ordnum."-".$pfn.$invoice );
may work better if you need to input into a database...

HTH...
0
 
LVL 1

Author Comment

by:guy4graphics
ID: 18817033
this path is placing ouput files in the c:\workqueue folder
0
 
LVL 4

Expert Comment

by:Arrivist
ID: 18818086
Using the second example should work fine.

If you have Apache installed on your Windows box then you can actually use forward slashes to save any confusion, eg:

$weborddir="C:/workqueue/".$ordnum."-".$pfn.$invoice;
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 1

Author Comment

by:guy4graphics
ID: 18818171
I get errors when using the 2nd line. I am using IIS so unfortunately I have to keep things confusing... ; )

This is the way the path was written originally for an intranet environment:

$weborddir="\\\\192.168.1.96\\d\$\\workqueue\\".$ordnum."-".$pfn.$invoice;

now iam on a webserver wanting to pass the subsequent information to c:\workqueue
0
 
LVL 4

Expert Comment

by:Arrivist
ID: 18818290
Can't see any reason why the second example won't work.

The original path you gave equates to
\\192.168.1.96\d$\workqueue\...etc, which points it to the admin share (d$) or the root of the D: drive.
You don't need to include the \$ as you gave in your first example.

Try the static path
$weborddir="C:\\workqueue\\".$ordnum."-".$pfn.$invoice;
if not, try the forward slash version.
0
 
LVL 1

Author Comment

by:guy4graphics
ID: 18818732
i tried that path with slashes both ways and it still does not place the files in the appropriate folder.

if i added my server's ip where 192.168.1.96 is will that essentially be doing the same thing as the path you provided? What does the 4 slashes at the beginning indicate?

$weborddir="\\\\192.168.1.96\\d\$\\workqueue\\".$ordnum."-".$pfn.$invoice;

I appreciate you helping me out with this...
0
 
LVL 4

Accepted Solution

by:
Arrivist earned 500 total points
ID: 18820081
The four slashes indicates a double (escaped) slash path.
Let me explain...

In windows, to indicate a network path, you would use:

\\myserver\sharedpath

as you can see, you need \\ to indicate that it is a network path.

because backslashes are normally used to indicate that the following character is a special character then PHP would normally ignore the backslash (because it thinks that it is indicating something and not actually being used as part of the string)
In order for PHP NOT to interpret a backslash as an indicator that the following character is a special character then you have to escape the backslash itself... eg, \\ = \.

Using four back slashes merely says to PHP that the backslashes should not be interpreted as special characters, which means that \\\\ realy means \\. ...phew

Anyway, back to your problem...
Are you getting any errors?, if so please post them and we will go from there...


0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now