Jump to content

dbillings

Members
  • Posts

    190
  • Joined

  • Last visited

    Never

Everything posted by dbillings

  1. You need to have, I think, 10 post's congrats.
  2. No one? Really.
  3. Here's a few questions I'd like to throw out there. 1. Would my php files need to be named file.php or file.cgi to be executed out of a cgi-bin? 2. I've managed to get the php extension files to print in a browser but the Shebang line prints as text for some reason, why? 3. I assume I want the shebang line to point to c:\wamp\php\php-cgi there is also a php.exe and php-win.exe but I assume the php-cgi is the correct one *shrug*?
  4. The first bit of code you wrote will produce a get variable and send it to product.html (Why not product.php?). Here's what I'd do based on what I interpret what you are trying to do. use a link to send a get variable to our page <?php echo "<a href='product.php?id=2">Product</a>" ?> Then on the product.php page <?php IF (isset($_GET['id'])) { $id = $_GET['id']; $table = // whatever the table name is in your database.; $sql = "SELECT product FROM $table WHERE id ='$id'"; $result = mysql_query($sql)or die(mysql_error()); $row=mysql_fetch_assoc($result); echo $row['product']; } ?>
  5. The links drop down menu's are not done in flash. http://perrysburg.aroundthecreek.com/Home/tabid/329/Default.aspx view source not flash
  6. Howdy, I'm trying to execute a script in a cgi-bin directory, and I'm not having any luck. I'm using wamp and my cgi-bin is located at c:/wamp/Apache2/cgi-bin I've never done this before and I'm not trying anything fancy just... #!C:\wamp\php\php-cgi ## ## printenv -- demo CGI program which just prints its environment ## print "Content-type: text/plain; charset=iso-8859-1\n\n"; <?php echo "Hello World!"; ?> No luck at all yet, any suggestions?
  7. interesting, I had no idea.
  8. To learn more check out.... http://us3.php.net/gd
  9. Why are people so fascinated with a GD thumbnail? You can use an html image tag to do the same task. Here's an example with my rediculously gorgeous infant daughter. It doesn't work in this forum but it would as a link on a site. <a href="http://i2.photobucket.com/albums/y46/dennisbillings/100_0158.jpg><img width="100" height="100" src="http://i2.photobucket.com/albums/y46/dennisbillings/100_0158.jpg"></a>
  10. I don't know why you would want the ID to change??? For example V-bulletin uses ID's to set super admin's. If you had a database that changed id's to make them sequential it would reset a super admin as someone else.
  11. set a cookie and as long as they don't delete it.
  12. This will give you seconds. gmdate('i'); PHP.net is one stop shopping. http://us.php.net/manual/en/function.gmdate.php
  13. Probably best to use javascript for that because it will use the users browser time in my humble opinion.
  14. Depends where your putting the conditional. If it is loaded during the page load you could use a meta redirect <meta http-equiv="Refresh" content="5;url=http://www.phpfreaks.com" />
  15. I'm guessing due to DST.
  16. Try this one.... Can't get the hour to work out correctly though??? <?php IF(isset($_REQUEST['submit'])) { $mo = $_REQUEST['month']; $d = $_REQUEST['day']; $y = $_REQUEST['year']; $h = $_REQUEST['hour']; $m = $_REQUEST['minute']; // gmmktime the first zero is for seconds the last is a boolean for daylight savings time. $timestamp = mktime($h, $m, 0, $mo, $d, $y, 0); echo date("D M j, Y g:i A", $timestamp); } $month = range(1, 12); $day = range(1, 31); $year = range(1995, 2010); $hour = range(0, 24); $minute = range(0, 59); ?> <form method="post" action="<?php $_SERVER['PHP_SELF']; ?>"> <label>Month</label><select name="month"> <?php foreach ($month as $int) { echo "<option value='$int'>$int</option>"; } ?> </select> <label>Day</label><select name="day"> <?php foreach ($day as $int) { echo "<option value='$int'>$int</option>"; } ?> </select> <label>Year</label><select name="year"> <?php foreach ($year as $int) { echo "<option value='$int'>$int</option>"; } ?> </select> <label>Hour</label><select name="hour"> <?php foreach ($hour as $int) { echo "<option value='$int'>$int</option>"; } ?> </select> <label>Minute</label><select name="minute"> <?php foreach ($minute as $int) { echo "<option value='$int'>$int</option>"; } ?> </select> <input type="submit" name="submit" value="Submit"> </form>
  17. Ok here we go... Set your mysql field to accept int instead of date, you won't need a seperate field for date and time it will be stored in one value. If you need to insert the current time mysql has a unix_timestamp() function that inputs up to the second. The following code will generate a unix timestamp for any date after Jan. 1 1970 up until ??? I'm not sure but well past 2010. <?php IF(isset($_REQUEST['submit'])) { $m = $_REQUEST['month']; $d = $_REQUEST['day']; $y = $_REQUEST['year']; $h = $_REQUEST['hour']; $m = $_REQUEST['minute']; // gmmktime the first zero is for seconds the last is a boolean for daylight savings time. $timestamp = gmmktime($h, $m, 0, $m, $d, $y, 0); } $month = range(1, 12); $day = range(1, 31); $year = range(1995, 2010); $hour = range(0, 24); $minute = range(1, 59); <form method="post" action="<?php $_SERVER['PHP_SELF']; ?>"> <label>Month</label><select name="month"> <?php foreach ($month as $int) { echo "<option value='$int'>$int</option>"; } ?> </select> <label>Day</label><select name="day"> <?php foreach ($day as $int) { echo "<option value='$int'>$int</option>"; } ?> </select> <label>Year</label><select name="year"> <?php foreach ($year as $int) { echo "<option value='$int'>$int</option>"; } ?> </select> <label>Hour</label><select name="hour"> <?php foreach ($hour as $int) { echo "<option value='$int'>$int</option>"; } ?> </select> <label>Minute</label><select name="minute"> <?php foreach ($minute as $int) { echo "<option value='$int'>$int</option>"; } ?> </select> <input type="submit" value="Submit> </form> Now your going to need to be able retrieve that date and turn the timestamp back into a useable date that you and I can read. run your query to fetch the date and insert it into the following function <?php echo date("D M j, Y At g:i", $timestamp); ?>
  18. New to the user will need a seperate table for logged on times. That inputs the time that the user last viewed the forum. For example... Last_login_table fields user_id last_login_time Script that executes... (place at the top of every page.) <?php // I used mysql's built in NOW() function for simplicity I prefer PHP's time(). IF (issest($_SESSION['user_id'])) { $query = "UPDATE last_login_table SET last_login_time= NOW()"; $result = mysql_query($query)or die(mysql_error()); } Now you will need to run a query to check when the user returns to see what threads were posted after their last login time. So you will need to adjust your login script to set a session variable to $_SESSION['last_login']. Then run a query finding thread id numbers that were posted after that time. follow?
  19. Further explanation.... The mysql date field type will only accept dates of a given format, I can't recall the exact format something like 2007:08:03. Your selected format doesn't support that so hence the error. Your gut may tell you I'll just change it to a varchar and problem solved, but this will limit the versatility you have with the date. If you use a unix time stamp (which calculates the time in seconds from the unix epoch on Jan. 1, 1970) it will allow you to do all kinds of functional things like sort by date, calculate span of time between two dates, and times.
  20. You are probably trying to insert a string into a mysql value that is set for accepting dates. I would recomend using a unix time stamp (providing all of your dates are post 1969). Have a look at the time() function. http://us.php.net/manual/en/ref.datetime.php
  21. maybe you moved the file make sure the path is correct. For instance.... formerly include("script.php); after move include("file/script.php"); Good luck
  22. You'll need a table that has a many-to-many relationship that shows if the user has viewed the post or not. Post_table User_table | | | | Post_user_map_table Fields Post-id User-id Run the SELECT query (discussed later) to see whats new and whats not. If a user clicks a thread that is new run an INSERT query with their user_id and the post_id and insert a record to the post_user_map_table. To set viewed posts run a SELECT query and if a user_id and post_id match are retrieved then the user already viewed the post and adjust the threads look to illustrate that. Follow?
  23. <?php if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; if($filetype == "image/jpeg" || "image/gif" || "image/png"){ $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } include("mysql_connect.php"); $query = "INSERT INTO upload (name, size, type, content ) ". "VALUES ('$fileName', '$fileSize', '$fileType', '$content')"; mysql_query($query) or die('Error: '.mysql_error()); mysql_close(); echo "<br />File $fileName uploaded<br />"; }else{ echo "<br />File type ".$filetype." not allowed. Must be JPEG,GIF or PNG.<br />"; } } ?> <fieldset id='submit'><legend>Upload Images</legend> <form method="post" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="2000000"> <label id='label'>Select image:</label><input id='input' name="userfile" type="file" id="userfile"><br /> <input id='submit' name="upload" type="submit" class="box" id="upload" value=" Upload "></td> </tr> </table> </form> </fieldset>
  24. Thats javascript
  25. Try this.... If you get errors post them. <html> <head> <title>ParasiteDB - Research and Remove Parasites!</title> <META content="parasite, virus, malware, removal, computer, pc, database, pdb, db" name=keywords> <META content="You can research and find ways to remove hundreds of different parasites here. Come take a look!" name=description> <style TYPE="text/css"> A{text-decoration:none} A:hover{color:#FFFFFF;text-decoration:underline} } BODY { SCROLLBAR-FACE-COLOR: #000000; SCROLLBAR-HIGHLIGHT-COLOR: #000000; SCROLLBAR-SHADOW-COLOR: #0099CC; SCROLLBAR-3DLIGHT-COLOR: #0099CC; SCROLLBAR-ARROW-COLOR: #0099CC; SCROLLBAR-TRACK-COLOR: #000000; SCROLLBAR-DARKSHADOW-COLOR: #0000000; } </style> </head> <BODY BGCOLOR="#000000" TEXT="#FFFFFF" VLINK="#0099CC" ALINK="#0099CC" LINK="#0099CC" topmargin="0"> <table border="0" cellspacing="1" width="100%"> <tr> <td width="100%" background="logo.jpg"> <table border="0" cellpadding="0" cellspacing="0" width="100%" bordercolor="#FFFFFF"> <tr> <td width="100%" background="images/logo.jpg" height="80"> <p align="center"><font color="#FFFFFF" size="4" face="Arial"><b>ParasiteDB - Research and Remove Parasites!</b></font></td> </tr> </table> </td> </tr> <tr> <td width="100%"> <table border="1" cellpadding="5" cellspacing="5" width="100%" bordercolor="#FFFFFF"> <tr> <td width="20%" valign="top"> <font face="Arial" size="2"><b> Navigation</b></font><br> <font face="Arial" size="2"> - <a href="http://parasitedb.freehostia.com/index.php">Home</a><br> - <a href="mailto:[email protected]?subject=Contact Us">Contact Us</a><br> - <a href="mailto:[email protected]?subject=Advertise">Advertise</a><br> - <a href="http://parasitedb.freehostia.com/search.php">Search</a><br> - <a href="index.php">Staff Login</a><br> - <a href="view_online.php">View Users Online</a></font> <font face="Arial" size="1"> <p> </font><font face="Arial" size="2"> <font face="Arial" size="2">Google Ads Coming Soon!</font></a><font face="Arial" size="1"> <p> <font face="Arial" size="2"><b> Sponsors</b></font><br> </font><font face="Arial" size="2">- <a href="http://malwareremoval.com/">Malware Removal</a><br> - <a href="http://pchelpforum.com/">PC Help Forum</a><br> </font></td> <td width="80%" valign="top"><b><font face="Arial"><font size="2" color="#FFFFFF"><center><br> <?php if (isset($_GET['addparasite'])): // User wants to add a joke ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <label>Name:<br /> <textarea name="parasitename" rows="1" cols="50"> </textarea></label><br /> <label>From:<br /> <textarea name="parasitefrom" rows="1" cols="50"> </textarea></label><br /> <label>Genre:<br /> <textarea name="parasitegenre" rows="1" cols="50"> </textarea></label><br / <label>Description:<br /> <textarea name="parasitedescription" rows="5" cols="50"> </textarea></label><br /> <label>Removal Info:<br /> <textarea name="parasiteremoval" rows="5" cols="50"> </textarea></label><br /> <input type="submit" value="Add" /> </form> <?php else: // Default page display $dbcnx = @mysql_connect('xxxxx', 'adaarm_db', 'xxxxx'); if (!$dbcnx) { exit('<p>Unable to connect to the ' . 'database server at this time.</p>'); } if (!@mysql_select_db('adaarm_db')) { exit('<p>Unable to locate the ' . 'database at this time.</p>'); } if (isset($_GET['edit')) { $edit_id = $_GET['edit']; unset($_GET['edit']); $query = "SELECT * FROM parasite WHERE id='$edit_id'"; $result = mysql_query($query)or die(mysql_error()); $data = mysql_fetch_assoc($result); ?> <fieldset><legend>Parasite Edit</legend> <form method="post" action="<?php $_SERVER['PHP_SELF']; ?>"> <input type="hidden" name="id" value="<?php echo $data['id']; ?>"> Parasitename:<input type="text" name="parasitename" value="<?php echo $data['parasitename']; ?>"><br /> Parasitefrom:<input type="text" name"parasitefrom" value="<?php echo $data['parasitefrom']; ?>"><br /> Parasitegenre:<input type="text" name="parasitegenre" value="<?php echo $data['parasitegenre']; ?>"><br /> Parasitedescription:<input type="text" name="parasitedescription" value="<?php echo $data['parasitedescription']; ?>"><br /> Parasiteremoval:<input type="text" name="parasiteremoval" value="<?php echo $data['parasiteremoval']; ?>"><br /> <input type="submit" value="Submit" name="parasiteedit"> </form> </fieldset> <?php } if (isset($_REQUEST['parasiteedit'])) { $n = $_REQUEST['parasitename']; $f = $_REQUEST['parasitefrom']; $g = $_REQUEST['parasitegenre']; $d = $_REQUEST['parasitedescription']; $r = $_REQUEST['parasiteremoval']; $id= $_REQUEST['id']; $edit_sql = "UPDATE parasite SET parasitename='$n', parasitefrom='$f', parasitegenre='$g', parasitedescription='$d', parasiteremoval='$r' WHERE id='$id'"; $result = mysql_query($edit_sql)or die(mysql_error()); if ($result) { echo "The parasite named $edit_name has been changed.<br /> New values: <br /> Parasitename: $parasitename <br /> Parasitefrom: $parasitefrom <br /> Parasitegenre: $parasitegenre <br /> Parasitedescription: $parasitedescription <br /> Parasiteremoval: $parasiteremoval"; }else{ echo "The edit request could not be carried out."; } } if (isset($_GET['delete')) { $delete_id = $_GET['delete']; $delete_name = $_GET['name']; unset($_GET['name']); unset($_GET['delete']); $delete_sql = "DELETE * FROM parasite WHERE id='$delete_id'"; $result = mysql_query($delete_sql)or die(mysql_error()); if ($result) { echo "The parasite named $delete_name had been deleted."; }else{ echo "The delete could not be carried out."; } } if (isset($_POST['parasitename'])) { $parasitename = $_POST['parasitename']; $parasitefrom = $_POST['parasitefrom']; $parasitegenre = $_POST['parasitegenre']; $parasitedescription = $_POST['parasitedescription']; $parasitetechremoval = $_POST['parasiteremoval']; $sql = "INSERT INTO parasite SET parasitename='$parasitename', parasitefrom='$parasitefrom', parasitegenre='$parasitegenre', parasitedescription='$parasitedescription', parasiteremoval='$parasiteremoval'"; if (@mysql_query($sql)) { echo "<p>The parasite '$parasitename' has been added.</p>"; } else { echo '<p>Error adding submitted parasite: ' . mysql_error() . '</p>'; } } echo '<p><a href="' . $_SERVER['PHP_SELF'] . '?addparasite=1">Add a Parasite</a></p>'; $sql = mysql_query("SELECT parasitename,parasitefrom,parasitegenre,parasitedescription,parasiteremoval,id FROM parasite ORDER BY parasitename ASC") or die(mysql_error()); echo "Parasites in Database:<br><br>"; echo "<table width=90% align=center border=1><tr> <td align=center>Name</td> <td align=center>From</td> <td align=center>Genre</td> </tr>"; while ($r = mysql_fetch_array($sql)) { // Begin while $id = $r["id"]; $name = $r["parasitename"]; $from = $r["parasitefrom"]; $genre = $r["parasitegenre"]; $description = $r["parasitegenre"]; $removal = $r["parasiteremoval"]; /* create a $_GET variable called delete using the objects id. Edit the this page link to the name of this page.*/ echo "<tr> <td><a href=view.php?id=$id>$name</a></td> <td>$from</td> <td>$genre</td> <td><a href='thispage.php?delete=$id&name=$name'>Delete</a></td> <td><a href='thispage.php?edit=$id>Edit</a></tr>"; } // end while echo "</table>"; endif; ?> </table> </center> </div> <p> </td> </tr> </table> </td> </tr> <tr> <td width="100%"> <p align="center"><font size="2"><font face="Arial">All Site Content &copy 2007 - ParasiteDB<br>All Rights Reserved</font></td> </tr> </table> </BODY> </html>
×
×
  • 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.