Jump to content

usadarts

Members
  • Posts

    64
  • Joined

  • Last visited

    Never

About usadarts

  • Birthday 04/16/1976

Contact Methods

  • Website URL
    http://www.USADarts.com

Profile Information

  • Gender
    Not Telling
  • Location
    Laurence Harbor, NJ

usadarts's Achievements

Member

Member (2/5)

0

Reputation

  1. Hello All, A form can be filled out and NOT have a file uploaded. If no file is selected, I do NOT want to run the following: $uploaddir = '../../flyers/'; $uploadfile = $uploaddir . basename($_FILES['filename']['name']); echo '<pre>'; if (move_uploaded_file($_FILES['filename']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.\n"; } else { echo "Possible file upload attack!\n"; } print "</pre>"; I added the below around the code, but does not work. if (basename($_FILES['filename']['name']) != ' '){ ...... } Any suggestions?
  2. Hello All, I have a field within a database that is set as a text field. When outputting, I want to force in comma's when needed. I do not need decimal positions. Do I have to convert this to a numeric field first? How would I go about doing this without changing the field attributes in the database itself? David
  3. Excellent....I got ride of most of the errors.....I just have this..... I will figure this out.....thanks again!
  4. I changed the $target_path = "uploads/"; to calendar I also have permissions for calendar set at 777 <input name="uploadedfile" type="file"> $target_path = "calendar/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; }
  5. Thank you for the link....... What is this telling me??
  6. Good Evening All, I have a form in which I need to be able to upload a file to a specified folder (uploads) and put the file name in a database field. How is this done? Any examples for me to view? Thanks, David
  7. Excellent again.....thank you kindly. David
  8. This works AWESOME.....thank you. Another question....same as the first actually: I also ran into a time when I had to add a link to the left column of the website and ended up updating 50+ webpages. I want the left cpimn information all in 1 file and would need to only update that file. I tried what nethnet stated, but did not work.
  9. I have some code to display a random image at the top of each webpage. I will be adding more images every so often. I really to not want to have to modify 50+ pages everytime I do this. I have the following code at the top of each page: <script language="JavaScript" type="text/javascript"> var images = [ ["<img src='/pictures/banner1.jpg' alt='Banner Image 1'>", 1], ["<img src='/pictures/banner2.jpg' alt='Banner Image 2'>", 2], ["<img src='/pictures/banner3.jpg' alt='Banner Image 3'>", 3], ["<img src='/pictures/banner4.jpg' alt='Banner Image 4'>", 4], ["<img src='/pictures/banner5.jpg' alt='Banner Image 5'>", 5], ["<img src='/pictures/banner6.jpg' alt='Banner Image 6'>", 6], ["<img src='/pictures/banner7.jpg' alt='Banner Image 7'>", 7], ] ;var randomValue = Math.random() * 7;var imageId = -1; for (i = 0; i < images.length; i++) { if (randomValue <= images[i][1]) { imageId = i; break; } } document.write(images[imageId][0]); </script> Is it possible to create a seperate page with just this information and have some kind of code to call this file? This way, in the future, I would only have to change 1 file instead of 50+
  10. I have a website that has about 50+ pages to it. I need to add a link to the left column of all the webpages. Does CSS help in a way to create a CSS file with the links and somehow attach it to each page. That way, in the future, if I need to add another link, all I would have to do is change the CSS file? Is this what CSS can be used for?
  11. I must be missing something, not sure what you mean.....I already have this code in there..... or die ('I cannot connect to the database because: ' . mysql_error()); on all relative queries
  12. Not sure if it has something to do with the RRN that i pass through, but when I modify the information, it does not change the database. index.php <html> <head> <script type="text/javascript"> <!-- function articleHandler(form){ var URL = "http://www.websites.com/cpanel/updatearticles?rrn="+articles.rrn.value; window.location.href = URL; } //--> </SCRIPT> <style type="text/css"> <!-- .style2 {color: #808080} --> </style> </head> <body> <center> <table width="75%" valign="top"> <tr> <td><?php $dbh=mysql_connect ("localhost", "xxxxxxxx", "xxxxxxxx") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("xxxxxxxx"); $query = "SELECT * FROM `articles` ORDER BY `date` DESC"; $result = mysql_query($query,$dbh) or die(mysql_error()); if (result){ echo "<center><form name=\"articles\">"; echo "<select name=\"rrn\" size=1 onChange=\"javascript:articleHandler()\">"; echo "<option value=''>Select Article To Update</option>"; while($row = mysql_fetch_array($result)) { echo "<option value='{$row['rrn']}'>{$row['date']} - {$row['title']}</option>"; } echo '</select></form></center>'; } ?> <?php $dbh=mysql_connect ("localhost", "xxxxxxxxx", "xxxxxxxx") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("xxxxxxxx"); $rrn = $_GET['rrn']; $queryr = "SELECT * FROM `articles` WHERE `rrn` = '$rrn'"; $resultr = mysql_query($queryr,$dbh) or die(mysql_error()); while($row = mysql_fetch_array($resultr)) { echo "<center><font size=+2>Add News Articles</font>"; echo "<form action=\"post.php?$rrn\" method=\"post\">"; echo "<textarea name=\"title\" cols=\"50\" rows=\"1\">"; echo $row['title']; echo "</textarea><br>"; echo "<textarea name=\"author\" cols=\"50\" rows=\"1\">"; echo $row['author']; echo "</textarea><br>"; echo "<textarea name=\"date\" cols=\"20\" rows=\"1\">"; echo $row['date']; echo "</textarea><br>"; echo "<textarea name=\"newcomments\" cols=\"100\" rows=\"50\">"; echo $row['info']; echo "</textarea><br>"; echo "<input type=\"submit\">"; echo "</form></center>"; } ?> </td> </tr> </table> </center> </body> </html> post.php code <?php $title = $_POST['title']; $author = $_POST['author']; $date = $_POST['date']; $info = $_POST['info']; $str = $info; $order = array("\r\n", "\n", "\r"); $replace = '<br />'; $newstr = str_replace($order, $replace, $str); $rrn = $_GET['rrn']; str_replace("/r/n","<br><br>",'$info'); $dbh=mysql_connect ("localhost", "xxxxxxxxxxx", "xxxxxxxx") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("xxxxxxxxx"); $insert = "UPDATE article SET title='$title', author='$author', date='$date', info='$newstr' WHERE rrn=$rrn"; $results = mysql_query($insert); echo "<center>Article Modified - <a href=\"../index.php\"><font size=\"4\">BACK TO CONTROL PANEL</font></A></center>"; echo ""; ?>
  13. Works good, thank you. However 1 small problem...... When the form loads, only the first word of the field is loading..... Example....within the database field is "Every Good Boy Does Fine" When I load the "title" field to the text field, "Every" is the only thing that appears. Any ideas???? echo "Title:<input type=\"text\" name=\"title\" size=\"50\" value={$row['title']}><br>";
  14. I need to load information from a database to a form to be modified. Below is the code to load the field title into a text field. Not working......what is wrong with the code below??? echo "Title:<input type=\"text\" name=\"title\" size=\"50\" value=$row['title']"><br>"; David
×
×
  • 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.