Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

babug_prg's scratchpad

by babug_prg (Friar)
on Sep 28, 2006 at 13:51 UTC ( #575354=scratchpad: print w/ replies, xml ) Need Help??

Create following folder in tool path where index.php ===================================================== uploads | temp | images /etc/apache2/sites-enabled/vijay.conf: ==================================== Listen 7777 <VirtualHost *:7777> ServerAdmin mahalakshmi@tnq.co.in DocumentRoot /home/Vijay/Desktop/vijay/php <Directory /home/Vijay/Desktop/vijay/php/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all <FilesMatch ^(.*\.xml|.*localconfig.*)$> deny from all </FilesMatch> </Directory> </VirtualHost> /etc/php5/apache2/php.in ========================= Find below option in php.ini and update the value as per need: ;;;;;;;;;;;;;;;; ; File Uploads ; ;;;;;;;;;;;;;;;; ; Whether to allow HTTP file uploads. ; http://php.net/file-uploads file_uploads = On ; Temporary directory for HTTP uploaded files (will use system default + if not ; specified). ; http://php.net/upload-tmp-dir upload_tmp_dir = /home/Vijay/Desktop/vijay/php/temp ; Maximum allowed size for uploaded files. ; http://php.net/upload-max-filesize upload_max_filesize = 2M ; Maximum number of files that can be uploaded via a single request max_file_uploads = 20 Index.php ========= <!DOCTYPE html> <html> <head> <script type="text/javascript" src="Validation.js"> function validateForm() { var a=document.forms["reg"]["fname"].value; var b=document.forms["reg"]["mname"].value; var c=document.forms["reg"]["address"].value; var d=document.forms["reg"]["contact"].value; var e=document.forms["reg"]["age"].value; if ((a==null || a=="") && (b==null || b=="") && (c==null || c=="") + && (d==null || d=="") && (e==null || e=="")) { alert("All Field must be filled out"); return false; } if (a==null || a=="") { alert("First name must be filled out"); return false; } if (b==null || b=="") { alert("Last name must be filled out"); return false; } if (c==null || c=="") { alert("Gender name must be filled out"); return false; } if (d==null || d=="") { alert("address must be filled out"); return false; } if (e==null || e=="") { alert("contact must be filled out"); return false; } } </script> <link href="Style.css" rel="stylesheet" type="text/css" media="screen" + /> </head> <body> <section> <div id="wrapper"> <div id="header"> <div id="menu"> <ul> <li class="current_page_item"><a href="#">Home</a></li> <li class="current_page_item"><a href="#">Images</a></li> <li class="current_page_item"><a href="#">Videos</a></li> <li class="current_page_item"><a href="#">About</a></li> <li class="current_page_item"><a href="#">Contact</a></li> </ul> </div> <div id="search"> <form method="get" action=""> <fieldset> <input type="text" name="s" id="search-text" size="15" /> <input type="submit" id="search-submit" value="Search" /> </fieldset> </form> </div> </div> <div id="logo"> <!--<h1><a href="#">Blogging</a></h1> <p><em> template design by Free CSS Templates</em></p>--> </div> <hr /> <div id="page"> <div id="content"> <div class="post"> <h2 class="title">Image Upload</h2> <div class="entry"> <form enctype="multipart/form-data" action="Upload.php" method="POST"> <input name="userfile" type="file" /> <input type="submit" value="Send File" /> </form> </div> </div> <div class="post"> <h2 class="title">Login Details</h2> <div class="entry"> <p>Vijay</p> </div> </div> </div> <div id="sidebar"> <h2>Registration form</h2> <form name="reg" action="Register.php" onsubmit="return validateForm() +" method="post"> <table width="274" border="0" align="center" cellpadding="2" cellspaci +ng="0"> <tr> <td colspan="2"> <div align="center"> <?php $remarks=$_GET['remarks']; if ($remarks==null and $remarks=="") { echo 'Register Here'; } if ($remarks=='success') { echo 'Registration Success'; } ?> </div> </td> </tr> <tr> <td><div align="right">First Name:</div></td> <td><input type="text" name="fname" /></td> </tr> <tr> <td><div align="right">Mail Address:</div></td> <td><input type="text" name="address" /></td> </tr> <tr> <td><div align="right">Contact No.:</div></td> <td><input type="text" name="contact" /></td> </tr> <tr> <td><div align="right">Gender:</div></td> <td><input type="text" name="mname" /></td> </tr> <tr> <td><div align="right">Age:</div></td> <td><input type="text" name="age" /></td> </tr> <tr> <td><div align="right"></div></td> <td><input name="submit" type="submit" value="Submit" /></td> </tr> </table> </form> </div> <div style="clear: both;">&nbsp;</div> </div> <div id="footer"> <p>Copyright (c) 2015 vijay.com. All rights reserved. Design by.</p> </div> </div> <div> </div> </section> </body> </html> Style.css ========= /* Design by Free CSS Templates http://www.freecsstemplates.org Released for free under a Creative Commons Attribution 2.5 License */ body { margin-top: 50px; padding: 0; background: #FFFFFF url(images/img01.jpg) repeat-x left top; font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; font-size: 13px; color: #837669; } h1, h2, h3 { margin: 0; font-family: Georgia, "Times New Roman", Times, serif; font-weight: normal; color: #649632; } h1 { font-size: 44px; } h2 { font-size: 20px; } h3 { } p, ul, ol { margin-top: 0; line-height: 240%; text-align: justify; font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; font-size: 11px; } ul, ol { } blockquote { } a { color: #000000; } a:hover { text-decoration: none; } a img { border: none; } img.left { float: left; margin: 7px 30px 0 0; } img.right { float: right; margin: 7px 0 0 30px; } hr { display: none; } .list1 { } .list1 li { float: left; line-height: normal; } .list1 li img { margin: 0 30px 30px 0; } .list1 li.alt img { margin-right: 0; } #wrapper { } /* Header */ #header-wrapper { width: 880px; margin: 0 auto; } #header { width: 900px; height: 60px; margin: 0 auto; background: url(images/img02.jpg) no-repeat left top; } /* Menu */ #menu { float: left; width: 540px; height: 51px; } #menu ul { margin: 0; padding: 20px 0 0 20px; list-style: none; line-height: normal; } #menu li { display: block; float: left; } #menu a { display: block; float: left; margin-right: 5px; padding: 5px 12px 5px 28px; background: url(images/img06.gif) no-repeat left 50%; text-decoration: none; font: 14px Georgia, "Times New Roman", Times, serif; color: #FFFFFF; } #menu a:hover { text-decoration: underline; } #menu .current_page_item a { color: #FFFFFF; } /* Search */ #search { float: right; width: 305px; height: 76px; } #search form { float: right; margin: 0; padding: 25px 20px 0 0; } #search fieldset { margin: 0; padding: 0; border: none; } #search input { float: left; font: 12px Georgia, "Times New Roman", Times, serif; border: none; } #search-text { width: 135px; height: 18px; padding: 3px 0 0 5px; background: #ECF9E4; color: #658453; } #search-submit { height: 21px; margin-left: 12px; color: #39561D; } /* Page */ #page { width: 900px; margin: 0 auto; padding: 30px 0px 0px 0px; } /** LOGO */ #logo { width: 900px; height: 230px; margin: 0 auto; background: url(images/img03.jpg) no-repeat left top; } #logo h1, #logo p { margin: 0; padding: 0 0 0 170px; line-height: normal; } #logo h1 { float: left; padding-top: 70px; } #logo h1 a { text-decoration: none; text-transform: lowercase; color: #FFFFFF; } #logo h1 a:hover { text-decoration: underline; } #logo p { padding: 130px 0 0 170px; font: italic 13px Georgia, "Times New Roman", Times, serif; color: #FFFFFF; } #logo p a { text-decoration: none; color: #FFFFFF; } #logo p a:hover { text-decoration: underline; } /* Content */ #content { float: right; width: 600px; } /* Post */ .post { margin-bottom: 25px; } .post .title { height: 30px; margin-bottom: 3px; padding: 8px 0px 2px 40px; background: url(images/img05.jpg) no-repeat left top; color: #FFFFFF; } .post .date { float: right; margin-top: -45px; padding-right: 20px; font-family: Georgia, "Times New Roman", Times, serif; font-weight: normal; font-size: 18px; color: #F1B566; } .post .meta { margin: -30px 0 3px 25px; padding: 2px 30px 2px 0px; font-family: Arial, Helvetica, sans-serif; font-weight: normal; font-size: 10px; color: #B6ACA2; } .post .meta a { color: #B6ACA2; } .post .entry { padding: 25px 20px 0px 20px; } .post .links { margin: 0 250px 0 0; padding: 0 0 0 0px; } .post .links .comments { } .post .links .permalink { padding-left: 17px; } /* Sidebar */ #sidebar { float: left; width: 280px; } #sidebar ul { margin: 0; padding: 0; list-style: none; line-height: normal; } #sidebar li { margin-bottom: 30px; padding: 0 0 20px 0px; } #sidebar li ul { line-height: 200%; } #sidebar li li { margin: 0; padding: 0 20px; } #sidebar p { margin: 0; padding: 0 20px; } #sidebar h2 { height: 33px; margin: 0 0 20px 0px; padding: 8px 0 2px 40px; background: url(images/img04.jpg) no-repeat left top; font-size: 20px; color: #FFFFFF; } #sidebar p { line-height: 200%; } /* Calendar */ #calendar { } #calendar caption { padding-bottom: 5px; font-weight: bold; } #calendar table { width: 100%; border-collapse: collapse; border-right: 1px solid #F5F2EF; } #calendar thead th { padding: 5px 0; text-align: center; border-top: 1px solid #F5F2EF; border-left: 1px solid #F5F2EF; background: #F5F2EF; } #calendar tbody td { padding: 5px 0; text-align: center; border-top: 1px solid #F5F2EF; border-left: 1px solid #F5F2EF; } #calendar tfoot td { padding: 5px; } #calendar tfoot #next { text-align: right; } #calendar #today { background: #E7F1E1; } /* Footer */ #footer { width: 900px; margin: 0 auto; padding: 0; background: url(images/img07.jpg) no-repeat left top; height: 61px; } #footer p { margin: 0; padding: 20px 0; text-align: center; line-height: normal; color: #FFFFFF; } #footer a { color: #F1B566; } Register.php ============ <?php session_start(); include('Connection.php'); $fname=$_POST['fname']; $address=$_POST['address']; $contact=$_POST['contact']; $mname=$_POST['mname']; $age=$_POST['age']; mysql_query("INSERT INTO members(fname,address,contact,mname,age) +VALUES('$fname','$address','$contact','$mname','$age')"); $sql = "DELETE FROM `vijay`.`members` WHERE `members`.`id` = 15"; mysql_query($sql); header("location: Index.php?remarks=success"); mysql_close($con); ?> Connection.php ============== <?php $mysql_hostname = "localhost"; $mysql_user = "root"; $mysql_password = ""; $mysql_database = "vijay"; $prefix = ""; $bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) + or die("Could not connect database"); mysql_select_db($mysql_database, $bd) or die("Could not select dat +abase"); ?> Upload.php ========== <?php $uploaddir = '/home/Vijay/Desktop/vijay/php/uploads/'; $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); echo '<pre>'; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) +{ echo "File is valid, and was successfully uploaded.\n"; } else { echo "Possible file upload attack!\n"; } echo 'Here is some more debugging info:'; print_r($_FILES); print "</pre>"; ?> Login.php =========
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2015-04-02 09:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who makes your decisions?







    Results (63 votes), past polls