Jump to content

dezkit

Members
  • Posts

    1,236
  • Joined

  • Last visited

Everything posted by dezkit

  1. change $ok=1 ; to $ok = "1" ; <?php include("settings.php"); include("header.php"); if (!isset($_POST['submit'])) { // if page is not submitted to itself echo the form ?> <!-- InstanceBeginEditable name="text_box" --> <h1 class="Head">Soccer United <font color="#000000">African Team Member Fact Sheet</font> </h1> <form action="" method="post" enctype="multipart/form-data" name="join"> <p>Name*: <input name="name" type="text" id="name" size="40"> </p> <p>Age*: <input name="age" type="text" id="age" size="10" maxlength="2"> </p> <p> Location*: <input name="location" type="text" id="location" size="40"> </p> <p> Favorite Activity: <input name="activity" type="text" id="activity" size="40"> <p> Soccer Story: <textarea name="grsstory" type="text" id="grsstory" cols="40"></textarea> </p> <p>Upload Photo: <input type="file" name="pic"> </p> <p> <input type="submit" name="submit" value="submit"> <a href="thanks.html">After submitting, you'll go to this page[/url]</p> </form> <?php //imageupload $target = "uploads/"; $target = $target . basename( $_FILES['pic']['name']) ; $ok = "1" ; if(move_uploaded_file($_FILES['pic']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else { echo "Sorry, there was a problem uploading your file."; } //endimageupload } else { // Check to see if the required fields are filled in. If not display errors. $error = 0; if ($_POST['name'] == "") { echo "Sorry, but Name was not entered. "; $error = $error + 1 ; } if ($_POST['age'] == "") { echo "Sorry, but age was not entered. "; $error = $error + 1; } if ($_POST['location'] == "") { echo "Sorry, but email was not entered. "; $error = $error + 1; } echo "<a href=\"javascript:history.go(-1)\">Go back[/url]"; // If the required fields are filled in then proceed. if ($error == 0) { // Set Variable names and get data from form and insert into database. // also checks to make sure it is good data being inserted and escapes possible injection attacks. $Fname = mysql_real_escape_string(trim($_REQUEST["name"])); $Age = mysql_real_escape_string(trim($_REQUEST["age"])); $Location = mysql_real_escape_string(trim($_REQUEST["location"])); $Activity = mysql_real_escape_string(trim($_REQUEST["activity"])); $Grsstory = mysql_real_escape_string(trim($_REQUEST["grsstory"])); $Image = mysql_real_escape_string(trim($_FILES['pic']['name'])); $MySQLquery = "INSERT INTO team_member_teammate VALUES('','$Fname','$Age','$Location','$Activity','$Grsstory','$Image')"; $results = mysql_query($MySQLquery); //Query the results // script to redirect to thanks.html page. print "<script>"; print " self.location='thanks.html';"; print "</script>"; // If there is a problem inserting into database show error. if(!$results){ echo(mysql_error()); } } } // bottom of the template do not remove. include("footer.php"); ?>
  2. $result = mysql_query("SELECT submission_id, col_4 FROM $table ORDER BY submission_date DESC"); if (!$result) { die("Query to show fields from table failed:".mysql_error()); } while($row = mysql_fetch_array($result)) { echo "<a href="Display.php?id=\".$row['submission_id'].'\">'.$row['col_4'].'</a>"; echo "<br />"; } mysql_free_result($result); I didn't read what you wrote, but i found a mistake. `,=,
  3. <?php $page = $_GET["page"]; if (!$page) { include "/home.php"; // default page } else if($page=="home") { include "/pages/home.php"; } // index.php?page=home else if($page=="about") { include "/pages/about.php"; } // index.php?page=about else if($page=="contact") { include "/pages/contact.php"; } // index.php?page=contact else if($page=="links") { include "/pages/links.php"; } // index.php?page=links else if($page=="games") { include "/pages/games.php"; } // index.php?page=games else if($page=="mm2") { include "/pages/mm2.php"; } // index.php?page=mm2 else if($page=="mm2cars") { include "/pages/mm2cars.php"; } // index.php?page=mm2cars else if($page=="mm2tracks") { include "/pages/mm2tracks.php"; } // index.php?page=mm2tracks else if($page=="mm2invert") { include "/pages/mm2invert.php"; } // index.php?page=mm2invert else if($page=="portal") { include "/pages/portal.php"; } // index.php?page=portal else if($page=="prospero") { include "/pages/prospero.php"; } // index.php?page=prospero else if($page=="mm2cars") { include "/pages/mm2cars.php"; } // index.php?page=mm2cars else if($page=="worms") { include "/pages/worms.php"; } // index.php?page=worms else if($page=="trackmania") { include "/pages/trackmania.php"; } // index.php?page=trackmania else if($page=="computer") { include "/pages/computer.php"; } // index.php?page=computer else { echo "<b><h1>404 Error</h1></b>"; } // error message ?> You're welcome.
  4. Why does it say echo "</form> at the end?
  5. actually, it doesn't do anything... but you know what, i'll scim through php.net and i will learn everysingle function. thanks everybody! topic solved.
  6. this is what i have so far vvvvvvvvvvvvvvv index.php <?php include('config.php'); if(CONSTRUCTION == 'yes'){ echo 'Site is under construction'; } else{ echo 'LOL'; } ?> config.php <?php //config.php define('CONSTRUCTION', 'no'); ?> admin.php <?php if(isset($_POST['construction'])){ $construction = $_POST['construction']; $handle = fopen('config.php', 'w+'); //open the file for writing $content = "<?php define('CONSTRUCTION', '{$construction}'); ?>"; //the content to be written fwrite($handle, $content); //write it fclose($handle); } ?> <form action=""> <select name="construction"> <option value="yes">yes</option> <option value="no">no</option> </select> <input type="submit" value="submit"> </form> it doesn't seem to work
  7. like this? admin.php <?php if(isset($_POST['construction'])){ $construction = $_POST['construction']; $handle = fopen('config.php', 'w+'); //open the file for writing $content = "<?php define('CONSTRUCTION', '{$construction}'); ?>"; //the content to be written fwrite($handle, $content); //write it fclose($handle); } ?> <form action=""> <select name="construction"> <option value="yes">yes</option> <option value="no">no</option> </select> <input type="submit" value="submit"> </form>
  8. Whats the difference between these echo's? <?php $name = "max"; echo "Hello $name"; ?> <?php $name = "max"; echo "Hello " . $name; ?>
  9. i don't need the code, i just WANT the code, i wanna boost up my php skills and thats it.
  10. thanks man, even though it didn't work, thanks for your time and patience to write this code, unlike some people.
  11. sorry, i don't pay for 10 lines of code.
  12. php.net is soo complex!
  13. i would like to use a mysql database any more advice including codes
  14. what are you guys talking about???? all i want is a password protected page, that has a password of "123456", and whenever i login, it says "Welcome dezkit, the current status of the website is live, to turn off the website, please click here" and whenever i click the link, it changes the "no" to a "yes" <?php $construction="no"; if($construction == "yes"){ echo ?> <html> <center><br><br><br><br><br><h1> Website is under construction, please remain patient, thank you. </h1> </center> </html> <?php } else { ?> to <?php $construction="yes"; if($construction == "yes"){ echo ?> <html> <center><br><br><br><br><br><h1> Website is under construction, please remain patient, thank you. </h1> </center> </html> <?php } else { ?>
  15. i want cheap and fast. how much?
  16. how much do you want?
  17. haha Help me out bro, edit the code very much appreciated!!
  18. <style type="text/css"> A:link {text-decoration: none} A:visited {text-decoration: none; color: blue} A:active {text-decoration: none} A:hover {text-decoration: underline; color: blue;} </style> <body bgcolor="#EEEEEE"> <br><br><br><center> <table> <tr><td>Chaos Layouts<td><p style="color:black"><a href="http://chaos-layouts.com/">Click Here to enter</a><br> <tr><td>Static Layouts<td><a href="http://www.static-layouts.com">Click Here to enter</a><br> <tr><td>Burning Violet<td><a href="http://www.burningviolet.com">Click Here to enter</a><br> <tr><td>Search Optimizer<td><a href="http://www.addme.com">Click Here to enter</a><br> <tr><td>Pimp my profile<td><a href="http://www.pimp-my-profile.com/partners/ref.php?in=1767">Click Here to enter</a><br> <tr><td>code my layout<td><a href="http://www.codemylayout.com/">Click Here to enter</a><br> <tr><td>top myspace layouts<td><a href="http://www.topmyspacesite.com/in.cgi?id=756">Click Here to enter</a><br> <tr><td>!!panicked!!<td><a href="http://www.panicked.nuclearcentury.com/">Click Here to enter</a><br> <tr><td>Free Code Source<td><a href="http://www.freecodesource.com/r:3001">Click Here to enter</a><br> <tr><td>myspace layouts<td><a href="http://www.revolutionmyspace.com/index.php?r=921">Click Here to enter</a><br> <tr><td>preppy layouts<td><a href="http://www.preppy-lyts.com/">Click Here to enter</a><br> <tr><td>Layouts 24/7<td><a href="http://www.layouts247.net/">Click Here to enter</a><br> <tr><td>Gravity<td><a href="http://www.gravitylayouts.com">Click Here to enter</a></a><br> <tr><td>Overlooked<td><a href="http://overlookedd.com/">Click Here to enter</a><br> <tr><td>Rich Gannon<td><a href="http://richgannon.info/?page=referin&id=16">Click Here to enter</a><br> <tr><td>Free Website Templates<td><a href="http://www.colordip.com/" target="_blank">Click Here to enter</a></a><br> <tr><td>Apply<td><a href="affiliate.php">Click Here to enter</a></div></p> </table> </center></body> awesome eh? took me 10 minutes
  19. I made some code, <?php $construction="yes"; if($construction == "yes"){ echo ?> <html> <center><br><br><br><br><br><h1> Website is under construction, please remain patient, thank you. </h1> </center> </html> <?php } else { ?> THE WEBSITE PAGES HERE OR WHATEVER <?php } ?> I want so i can toggle "yes" and "no" for $construction (like a CMS system) without going into my ftp/file manager. thanks dezkit. i got the admin login page already setup.... <?php $username = "someuser"; $password = "somepassword"; if ($_POST['txtUsername'] != $username || $_POST['txtPassword'] != $password) { ?> <h1>Login</h1> <form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <table> <tr <td>Username: <td><input type="text" title="Enter your Username" name="txtUsername" /></p> <tr> <td>Password: <td><input type="password" title="Enter your password" name="txtPassword" /></p> <tr> <td colspan="2" align="right"><input type="submit" name="Submit" value="Login"> </table> </form> <?php } else { ?> CMS STUFF HERE. <?php } ?>
  20. im just thinking that maybe hes using an online sql or something, same thing happened to me.
  21. original boy, change your mysql password AS SOON AS POSSIBLE.
  22. index.php <html> <head> <title>Upload Image</title> </head> <body> <form action="imageupload.php" method="POST" enctype="multipart/form-data"> Name : <input type="text" name="imageName"> <br/> Image :<input type="file" name="imageFile"> <input type="submit" value="Upload" name="func"> </form> </body> </html> imageupload.php <?php include ("config.php"); /* This function take the image from form variables */ function getImageFile($file){ $takeFile = fopen($file, "r"); $file = fread($takeFile, filesize($file)); fclose($takeFile); return $file; } /* We learn image type using this function Because we will let onlt gif, jpg and png images can be uploaded */ function getfileType( $name ){ $name = explode(".", $name); $name = array_reverse($name); $name = $name[0]; return $name; } $allowedImageTypes = array("gif","jpg","png","bmp","jpeg","tiff"); if(empty($_FILES['image_file']['tmp_name'])){ echo "File not uploaded"; } else { $fileType = $_FILES['image_file']['name']; if(in_array(getfileType($fileType), $allowedImageTypes)){ $fileContent = getImageFile($_FILES['imgFile']['tmp_name']); $uploadedImage = chunk_split(base64_encode($fileContent)); // connect to the mysql server $link = mysql_connect($server, $db_user, $db_pass) or die ("Could not connect to mysql because ".mysql_error()); // select the database mysql_select_db($database) or die ("Could not select database because ".mysql_error()); $query = "INSERT INTO images_table VALUES('NULL','$imgName','$uploadedImage')"; $result = mysql_query($query); if(mysql_affected_rows() > 0){ echo "Image has been inserted succesfully"; } else { echo "Image can not be inserted check your submission"; } } else { echo "This is not a true image type"; } } ?>
  23. the php code should go into a seperate php file, which should be called imageupload.php
  24. is it possible so every mysql query inside of a table (or whatever it is called) to have its own page? Like www.website.com/members.php?id=1
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.