[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

$config['BaseUrl'] QUESTION

Posted on 2014-08-20
9
Medium Priority
?
134 Views
Last Modified: 2014-10-08
I have a line of code that reads:

$userid = 'moffit';
$config['BaseUrl'] = '.s166067.gridserver.com/'.$userid.'/assets/';

This code is part of a script that uploads an image into the assets directory. But the image is NOT being shown on the page because the code is returning:

moffitlake.org.s166067.gridserver.com/moffit/assets/2_ad_facebook.gif

AND IT NEEDS TO BE THIS:

http://moffitlake.org.s166067.gridserver.com/moffit/assets/2_ad_facebook.gif

HOW CAN I GET THE CODE TO ADD THE "HTTP://" in front?
0
Comment
Question by:edavo
8 Comments
 
LVL 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 664 total points
ID: 40275635
I don't know that it matters since neither one is a valid URL.  But the 'http://' needs to be added where it is used and that is somewhere else in your code.
0
 
LVL 8

Assisted Solution

by:Ahmed Merghani
Ahmed Merghani earned 664 total points
ID: 40275637
Where is the part of the code that generate /return "moffitlake.org.s166067.gridserver.com/moffit/assets/2_ad_facebook.gif" ??
Or there will be some where host variable or something is set to "moffitlake.org" just add "http://" before.
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 672 total points
ID: 40275930
HOW CAN I GET THE CODE TO ADD THE "HTTP://" in front?
Use PHP string concatenation like this:

$x = 'http://' . $config['BaseUrl'] . /* WHATEVER */;

I think you need a professional developer.  There is a back-story to this question and to the PHP code in the web site that a professional would probably understand fairly quickly.  But from the question it almost looks like you've got some code you did not understand, but you installed it anyway.  And that is a recipe for certain catastrophe.

This URL is 404
http://moffitlake.org.s166067.gridserver.com/moffit/assets/2_ad_facebook.gif

It looks like it is made up from this:
$config['BaseUrl'] = '.s166067.gridserver.com/'.$userid.'/assets/';

By doing something like this:
$_SERVER['HTTP_HOST'] . $config['BaseUrl'] . '2_ad_facebook.gif';

Then you would use string concatenation to prepend the protocol name to the front of the URL.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 111

Expert Comment

by:Ray Paseur
ID: 40275932
0
 

Author Comment

by:edavo
ID: 40277741
I will look into this further and check the validation per your comments. I appreciate your patience and advice. I will report back soon. Sincerely - d
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 40334875
Any progress in the last month?
0
 
LVL 8

Expert Comment

by:Ahmed Merghani
ID: 40353099
1

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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 …
Suggested Courses
Course of the Month19 days, 9 hours left to enroll

873 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