 |
| Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more. |
|
 |
07-06-2006, 02:44 PM
|
#1 (permalink)
|
|
Member
Join Date: 06-01-06
Posts: 70
Latest Blog: None
|
Help need for php code
I am creating a php script so that ppl can submit articles.
What code can I use so that when ppl tyle
<a href="http://www.domain.com">http://www.domain.com"</a> it will be converted to the actual link when the articles goes live?
I tried htmlentities($article_body) but it does not work, can anyone help me here? thanks
|
|
|
07-06-2006, 02:54 PM
|
#2 (permalink)
|
|
Contributing Member
Join Date: 06-29-06
Posts: 70
Latest Blog: None
|
I am willing to help you, if you could be more specific 
|
|
|
07-06-2006, 02:57 PM
|
#3 (permalink)
|
|
Member
Join Date: 06-01-06
Posts: 70
Latest Blog: None
|
Quote:
|
Originally Posted by helloworld
I am willing to help you, if you could be more specific 
|
if it is not too much trouble for you, you can go to
http://www.bedroomfurniturestores.com/articles
you can register an account and then just write something with <a href>, you should see the problem i am refering to here 
|
|
|
07-06-2006, 03:29 PM
|
#4 (permalink)
|
|
Contributing Member
Join Date: 06-29-06
Posts: 70
Latest Blog: None
|
trying to create a new account I get this,
Fatal error: Call to undefined function: outputstor() in /var/www/public_html/platform/html3/articles/header.php on line 28
looks like it's trying to call a function that doesn't exsist?
|
|
|
07-06-2006, 03:37 PM
|
#5 (permalink)
|
|
Member
Join Date: 06-01-06
Posts: 70
Latest Blog: None
|
Quote:
|
Originally Posted by helloworld
trying to create a new account I get this,
Fatal error: Call to undefined function: outputstor() in /var/www/public_html/platform/html3/articles/header.php on line 28
looks like it's trying to call a function that doesn't exsist?
|
thanks very much, actually right now my question is solved and i just fixed that page, but i do have another question here:
I did a upload image script, but it gives me this message:
move_uploaded_file(): open_basedir restriction in effect
I don't have full control over the server, is it something wrong with the permission?
|
|
|
07-06-2006, 03:45 PM
|
#6 (permalink)
|
|
Contributing Member
Join Date: 06-29-06
Posts: 70
Latest Blog: None
|
Quote:
|
Originally Posted by GoWFB_SEO
thanks very much, actually right now my question is solved and i just fixed that page, but i do have another question here:
I did a upload image script, but it gives me this message:
move_uploaded_file(): open_basedir restriction in effect
I don't have full control over the server, is it something wrong with the permission?
|
Use phpinfo.php
Code:
<?php
phpinfo();
?>
and find "open_basedir." If the setting is something other than "no value" then you might have to use that directory.
How did you fix the other problem?
PHP htmlspecialchars?
|
|
|
07-06-2006, 05:00 PM
|
#7 (permalink)
|
|
Member
Join Date: 06-01-06
Posts: 70
Latest Blog: None
|
Quote:
|
Originally Posted by helloworld
Use phpinfo.php
Code:
<?php
phpinfo();
?>
and find "open_basedir." If the setting is something other than "no value" then you might have to use that directory.
How did you fix the other problem?
PHP htmlspecialchars?
|
yes, under local value, i see something and "no value" under master value
the directory show in "local value" is the upper directory", so when I assign image directory, should I use
$Image_dir = "../directory-path" ??
for that problem, someone told me to use "stripslashes",
is there a code so that when I type http://www.domain.com, it will automatically become a link? (without using <a href>)
|
|
|
07-06-2006, 09:36 PM
|
#8 (permalink)
|
|
Contributing Member
Join Date: 06-29-06
Posts: 70
Latest Blog: None
|
Quote:
|
Originally Posted by GoWFB_SEO
is there a code so that when I type http://www.domain.com, it will automatically become a link? (without using <a href>)
|
Code:
<?php
//check what?? could possibly use a $GET_['text'] to change a form //
$input = "http://www.yahoo.com is a great place to visit";
///change it///
$input = trim($input);
$input = htmlspecialchars($input);
$input = preg_replace('#(.*)\@(.*)\.(.*)#','<a href="mailto:\\1@\\2.\\3">Email</a>',$input);
$input = preg_replace('=([^\s]*)(www.)([^\s]*)=','<a href="http://\\2\\3" target=\'_new\'>\\2\\3</a>',$input);
//echo modified input//
echo "$input";
?>
This code will do
IE:
http://www.yahoo.com
www.yahoo.com
you@yahoo.com "converted to a mailto that says email"
what it will not do is,
http://yahoo.com
hope it helps, just didn't have much time today 
Last edited by helloworld; 07-06-2006 at 09:42 PM..
|
|
|
07-07-2006, 01:06 AM
|
#9 (permalink)
|
|
Member
Join Date: 06-01-06
Posts: 70
Latest Blog: None
|
Quote:
|
Originally Posted by helloworld
Code:
<?php
//check what?? could possibly use a $GET_['text'] to change a form //
$input = "http://www.yahoo.com is a great place to visit";
///change it///
$input = trim($input);
$input = htmlspecialchars($input);
$input = preg_replace('#(.*)\@(.*)\.(.*)#','<a href="mailto:\\1@\\2.\\3">Email</a>',$input);
$input = preg_replace('=([^\s]*)(www.)([^\s]*)=','<a href="http://\\2\\3" target=\'_new\'>\\2\\3</a>',$input);
//echo modified input//
echo "$input";
?>
This code will do
IE:
http://www.yahoo.com
www.yahoo.com
you@yahoo.com "converted to a mailto that says email"
what it will not do is,
http://yahoo.com
hope it helps, just didn't have much time today 
|
thanks a lot, helloworld!! you really gave me a lot of help and i really appreciated it
just have one unswered question here,
for that upper level directory, i tried to use "../", but it seems still does not work 
|
|
|
07-07-2006, 02:47 AM
|
#10 (permalink)
|
|
Contributing Member
Join Date: 06-29-06
Posts: 70
Latest Blog: None
|
Your welcome!
Did you try this:
$Image_dir = "../directory-path/"
Let me know if that works out
It's possible the host is not allowing it.
This one I am not quite sure about 
Last edited by helloworld; 07-07-2006 at 03:15 AM..
|
|
|
07-07-2006, 03:22 AM
|
#11 (permalink)
|
|
Contributing Member
Join Date: 06-29-06
Posts: 70
Latest Blog: None
|
Also I believe with your setup it's not allowing you to access files outside the directory or sub directories so that may be a problem.
It's kind of hard to tell, not knowing much about the setup, and what's happening.
It seems to be a path issue though
|
|
|
07-07-2006, 09:27 AM
|
#12 (permalink)
|
|
Member
Join Date: 06-01-06
Posts: 70
Latest Blog: None
|
Quote:
|
Originally Posted by helloworld
Your welcome!
Did you try this:
$Image_dir = "../directory-path/"
Let me know if that works out
It's possible the host is not allowing it.
This one I am not quite sure about 
|
It takes me about 3 hours and finally i got it solved (I didn't know I have permission to other paths, i am a master level  )
Thanks again, helloworld
|
|
|
07-07-2006, 03:28 PM
|
#13 (permalink)
|
|
Contributing Member
Join Date: 06-29-06
Posts: 70
Latest Blog: None
|
your welcome, glad to hear you got it working 
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 11:49 AM.
© Copyright 2008 V7 Inc Powered by vBulletin Copyright © 2000-2009 Jelsoft Enterprises Limited.
|
|
|