navigating between html php
Hello list. I am running FreeBSD 6.0/apache 1.3.33_2/php 4.4.0/mysql 4.0.25. I am beginner in coding php. In past only added php code to count visitors to home page. Now I want to build application to host user web site as directory on my server. I want to use native html as much as possible in what is seen by user's browser and keep the real functional php code in a common file on my server so it does get seen by anyone. At this point I am just creating the navigation base code to implement this concept. Below is listed 2 files. page1.php is the native html page1 passing a form to the common main.php code workhorse. The idea is main.php will receive the form from page1.php and process the make dir and then return to the page1.php to show any errors or goto page2.php if make dir worked. In main.php the line to check the dir_name for 0-9 a-z gives error and I don't know what is wrong. Also I can not find any function in php manual to (goto or branch to) the native html page I want. Is what I am trying to do legal? Is there a better way to do this? Thanks in advance. page1.php html head link rel=stylesheet type=text/css href=00.00-web_style_sheet.css /head body pnbsp;/p pnbsp;/p pSetup your personal website by first chooseing your 8 character website name. /p form method=POST action=main.php input type=hidden name=action value=dir_add Web Name: input type=text name=dir_name input maxlength=8 size=8 input type=submit value=Add /form br / ?php if($dir_error == yes) {print ($dir_error_msg);} ? /body/html main.php ?php // this is the main work hourse php script the performs all the functions of this application $today = date(Y/m/d); // in mmdd format $directory = (DOCUMENT_ROOT); // home dir of server files usr/local/www/data from global var $user_ip_addr = (REMOTE_ADDR); // ip address of user viewing this page global var $dir_error = ;// set to null //[[:alnum:]] matches any letter or digit (can also be expressed as [a-z0-9] ) if($_POST['action'] = dir_add) { $newdir = $_POST['dir_name']; if(eregi([[:alnum:]], $directory$newdir)) { if(file_exists($directory$newdir)) { $dir_error = yes; $dir_error_msg = Your web site name is not available, try a different one; goto(page1.php); // return to page1 and display error } else { mkdir($directory$newdir, 0707); goto(page2.php); // return to page1 and display error } else; { $dir_error = yes; $dir_error_msg = Enter alphanumaric content only, Try again; goto(page1.php); } endif} // notice following is all comments. /* if($_POST['action'] = user_signup_infor_add) { add code here later } add as flat file to dir users if($_POST['action'] = user_wedpage_infor_add) { add code here later } add as flat file in user created dir from above if($_POST['action'] = user_webpage_infor_display) { add code here later } pass text wysiwyg to native html page if($_POST['action'] = user_webpage_infor_edit) { add code here later } take returned text data ad replace content of flat web page file */ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: navigating between html php
Php is running as a apache mopdule I guess... So apache will need write access to the folder you are trying to write into... Just try to make your directory writable by the www user to check if this is your problem.. To do so, do into the directory your script is trying to write into and do something like chown www:wheel . chmod 770 . or something like that depending on your need... see man chown and man chmod if you are not too sure what you need... It might be something else that prevents you to write in your directory (ie safe mode in php.conf) but without looking at your code, it might be a good place to start with... At 14:17 2006-01-25, fbsd_user wrote: Hello list. I am running FreeBSD 6.0/apache 1.3.33_2/php 4.4.0/mysql 4.0.25. I am beginner in coding php. In past only added php code to count visitors to home page. Now I want to build application to host user web site as directory on my server. I want to use native html as much as possible in what is seen by user's browser and keep the real functional php code in a common file on my server so it does get seen by anyone. At this point I am just creating the navigation base code to implement this concept. Below is listed 2 files. page1.php is the native html page1 passing a form to the common main.php code workhorse. The idea is main.php will receive the form from page1.php and process the make dir and then return to the page1.php to show any errors or goto page2.php if make dir worked. In main.php the line to check the dir_name for 0-9 a-z gives error and I don't know what is wrong. Also I can not find any function in php manual to (goto or branch to) the native html page I want. Is what I am trying to do legal? Is there a better way to do this? Thanks in advance. page1.php Setup your personal website by first chooseing your 8 character website name. Web Name: ?php if($dir_error == yes) {print ($dir_error_msg);} ? main.php ?php // this is the main work hourse php script the performs all the functions of this application $today = date(Y/m/d); // in mmdd format $directory = (DOCUMENT_ROOT); // home dir of server files usr/local/www/data from global var $user_ip_addr = (REMOTE_ADDR); // ip address of user viewing this page global var $dir_error = ;// set to null //[[:alnum:]] matches any letter or digit (can also be expressed as [a-z0-9] ) if($_POST['action'] = dir_add) { $newdir = $_POST['dir_name']; if(eregi([[:alnum:]], $directory$newdir)) { if(file_exists($directory$newdir)) { $dir_error = yes; $dir_error_msg = Your web site name is not available, try a different one; goto(page1.php); // return to page1 and display error } else { mkdir($directory$newdir, 0707); goto(page2.php); // return to page1 and display error } else; { $dir_error = yes; $dir_error_msg = Enter alphanumaric content only, Try again; goto(page1.php); } endif} // notice following is all comments. /* if($_POST['action'] = user_signup_infor_add) { add code here later } add as flat file to dir users if($_POST['action'] = user_wedpage_infor_add) { add code here later } add as flat file in user created dir from above if($_POST['action'] = user_webpage_infor_display) { add code here later } pass text wysiwyg to native html page if($_POST['action'] = user_webpage_infor_edit) { add code here later } take returned text data ad replace content of flat web page file */ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
RE: navigating between html php
Thank you for replying but creating the directory or permissions has nothing to do with my question. Please reread original post. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Ian Lord Sent: Wednesday, January 25, 2006 3:49 PM To: [EMAIL PROTECTED] ORG Subject: Re: navigating between html php Php is running as a apache mopdule I guess... So apache will need write access to the folder you are trying to write into... Just try to make your directory writable by the www user to check if this is your problem.. To do so, do into the directory your script is trying to write into and do something like chown www:wheel . chmod 770 . or something like that depending on your need... see man chown and man chmod if you are not too sure what you need... It might be something else that prevents you to write in your directory (ie safe mode in php.conf) but without looking at your code, it might be a good place to start with... At 14:17 2006-01-25, fbsd_user wrote: Hello list. I am running FreeBSD 6.0/apache 1.3.33_2/php 4.4.0/mysql 4.0.25. I am beginner in coding php. In past only added php code to count visitors to home page. Now I want to build application to host user web site as directory on my server. I want to use native html as much as possible in what is seen by user's browser and keep the real functional php code in a common file on my server so it does get seen by anyone. At this point I am just creating the navigation base code to implement this concept. Below is listed 2 files. page1.php is the native html page1 passing a form to the common main.php code workhorse. The idea is main.php will receive the form from page1.php and process the make dir and then return to the page1.php to show any errors or goto page2.php if make dir worked. In main.php the line to check the dir_name for 0-9 a-z gives error and I don't know what is wrong. Also I can not find any function in php manual to (goto or branch to) the native html page I want. Is what I am trying to do legal? Is there a better way to do this? Thanks in advance. page1.php Setup your personal website by first chooseing your 8 character website name. Web Name: ?php if($dir_error == yes) {print ($dir_error_msg);} ? main.php ?php // this is the main work hourse php script the performs all the functions of this application $today = date(Y/m/d); // in mmdd format $directory = (DOCUMENT_ROOT); // home dir of server files usr/local/www/data from global var $user_ip_addr = (REMOTE_ADDR); // ip address of user viewing this page global var $dir_error = ;// set to null //[[:alnum:]] matches any letter or digit (can also be expressed as [a-z0-9] ) if($_POST['action'] = dir_add) { $newdir = $_POST['dir_name']; if(eregi([[:alnum:]], $directory$newdir)) { if(file_exists($directory$newdir)) { $dir_error = yes; $dir_error_msg = Your web site name is not available, try a different one; goto(page1.php); // return to page1 and display error } else { mkdir($directory$newdir, 0707); goto(page2.php); // return to page1 and display error } else; { $dir_error = yes; $dir_error_msg = Enter alphanumaric content only, Try again; goto(page1.php); } endif} // notice following is all comments. /* if($_POST['action'] = user_signup_infor_add) { add code here later } add as flat file to dir users if($_POST['action'] = user_wedpage_infor_add) { add code here later } add as flat file in user created dir from above if($_POST['action'] = user_webpage_infor_display) { add code here later } pass text wysiwyg to native html page if($_POST['action'] = user_webpage_infor_edit) { add code here later } take returned text data ad replace content of flat web page file */ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
RE: navigating between html php
At 20:16 2006-01-25, fbsd_user wrote: Thank you for replying but creating the directory or permissions has nothing to do with my question. Please reread original post. Sorry, read too fast :) The function to redirect the user to another page is header ('Location: http://www.yahoo.com'); This will do a http redirect, you must make sure the script has not sent any output, otherwise the redirect will fail. Instead of redirecting the user, you might do the following use require, require_once, include, or include_once to inclure the content of page1 this will have the same effect Regarding your error while checking if the directory exist, can you post the exact error php gives you ? ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]