Jump to content

Lamez

Members
  • Posts

    1,686
  • Joined

  • Last visited

    Never

Everything posted by Lamez

  1. oh this is simple <?php $id = $_POST['id']; $query = "INSERT INTO `table_name` (id) VALUES ('$id')"; mysql_query($query); $r = mysql_query("SELECT * FROM `table_name`"); $row = mysql_fetch_array($r); id = $row['id']; echo '<a href=addhours.php?Id='.$id.'>ID: '.$id.'</a>'; // 1 results while ($row = mysql_fetch_array($r)){ id = $row['id']; echo '<a href=addhours.php?Id='.$id.'>ID: '.$id.'</a><br>'; // ALL results } ?>
  2. Oh ya I have done that before, I am starting to comment my brackets like //end loop or //checks if username is correct
  3. on your contact me form, you need to use php not JavaScript to validate your form, I turned my JS off and was able to mess with the form!
  4. I am not too sure what the other members are saying, but in a mysql insert query it should look like this: <?php $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $query = "INSERT INTO `table` (firstname, lastname) VALUES (''$firstname', $'lastname')"; mysql_query($query); ?>
  5. do you have short tags enabled? It is always best to use <?php instead of <?
  6. <?php $posted = str_replace("\\", "", $posted); ?> That will do it, I used it for my HTML thing!
  7. needs work! 1st - you need to align your navigation, with the text. 2nd - seems boring I would add more images 3rd - I would make my logo same width of my navigation. 4th - Needs more color! I am sure I could find more, but I will let the others have a stab at it
  8. what is happening that you do not like? in other words what is wrong?
  9. no ideas?
  10. how are they wrong values? please post an example!
  11. No I am sorry, let me explain better! I am making a football pool, and the admin goes and types in how many bowls there will be, it can be any number, the script does not know. So I made it where the admin can go and edit the bowl information. So I made a while loop to pull the information from the database. Well I want to know how to process the information. Here is entire code (kinda sloppy): <?php ob_start(); $path = "../../"; $title = "Manage Football Bowls"; $rank = "yes"; include ($path."main/include/cons/head.php"); ?> <SCRIPT TYPE="text/javascript"> function numbersonly(myfield, e, dec) { var key; var keychar; if (window.event) key = window.event.keyCode; else if (e) key = e.which; else return true; keychar = String.fromCharCode(key); // control keys if ((key==null) || (key==0) || (key== || (key==9) || (key==13) || (key==27) ) return true; // numbers else if ((("0123456789").indexOf(keychar) > -1)) return true; // decimal point jump else if (dec && (keychar == ".")) { myfield.form.elements[dec].focus(); return false; } else return false; } //--> </SCRIPT> <?php $salt = "KRAZYPICK-d-d-dS FOOTBALL :D adFADS :F:Asdf 4656+1131545641564548945645645"; $rand = rand(1, 10000); $date = date('l jS \of F Y h:i:s A')+date(DATE_RFC822); $get = md5($salt.$date.$user_); $start_over = md5($get.$salt.$date.$user_).md5($user_); $current = md5($get.$start_over.$user_.$date).md5($user_); $num_con = md5($get.$current.$user_.$date.$start_over).md5($user_); $add = md5($num_con.$current.$user_.$date.$start_over.$get.$salt).md5($user_); $ask = md5($num_con.$current.$date.$start_over.$user_.$get.$salt.$add).md5($user_); $dele = md5($user_.$ask.$add.$current.$num_con.$date.$get.$salt.$start_over).md5($user_); $val = md5($user_.$ask.$dele.$add.$current.$num_con.$date.$get.$salt.$start_over).md5($user_); $start_done = md5($get.$start_over.$current.$num_con.$add.$ask.$dele.$user_.$val.$salt).md5($user_); $update = md5($get.$ask.$start_over.$current.$num_con.$dele.$val.$start_done.$date.$salt).md5($user_); $idir = "bowls_img/"; // Path To Images Directory $tdir = $idir; // Path To Thumbnails Directory, --If the same as IMG DIR, it will only make thumbnails--Lamez $twidth = "125"; // Maximum Width For Thumbnail Images $theight = "100"; // Maximum Height For Thumbnail Images if($session->logged_in){ if($session->isAdmin()){ $result = mysql_query("SELECT * FROM `foot_bowls`"); echo '<p class="header">Manage Football Bowls</p><p class="maintext">'; if (!isset($_GET[$get])) { echo '<DD>'; unset($_SESSION['asked']); if (mysql_num_rows($result) !== 0) { echo '<li><a href="?'.$get.'='.$current.'">Edit Current Bowl Setup</a><br />'; } echo '<li><a href="?'.$get.'='.$start_over.'">New Bowl Setup</a>'; }else if (isset($_GET[$get]) && $_GET[$get] == $start_over) { if (mysql_num_rows($result) !== 0) { header("Location: ?".$get."=".$ask); } ?> <form id="form1" name="form1" method="post" action="?<?php echo $get; ?>=<?php echo $num_con ?>"> Number of Bowls: <label> <input name="bowl_num" type="text" id="bowl_num" size="5" maxlength="5" onkeypress="return numbersonly(this, event)" /> </label> <label> <input type="submit" name="con_num" id="con_num" value="Continue" /> </label> </form> <?php }else if (isset($_GET[$get]) && $_GET[$get] == $update) { echo $_POST['id']; }else if (isset($_GET[$get]) && $_GET[$get] == $current) { echo '<form method="post" action="?'.$get.'='.$update.'" enctype="multipart/form-data"> <table width="100%" border="0"> <tr> <td width="6%" align="center" valign="top"><strong>ID</strong></td> <td width="13%" align="center" valign="top"><strong>Name</strong></td> <td width="13%" align="center" valign="top"><strong>Date</strong></td> <td width="13%" align="center" valign="top"><strong>Time</strong></td> <td width="13%" align="center" valign="top"><strong>Network</strong></td> <td width="12%" align="center" valign="top"><strong>Place</strong></td> <td width="30%" align="center" valign="top"><strong>Image</strong></td> </tr>'; $q = mysql_query("SELECT * FROM `foot_bowls` ORDER BY `id` ASC"); while($row = mysql_fetch_array($q)){ $id = $row['id']; $name = $row['name']; $date = $row['date']; $time = $row['time']; $network = $row['network']; $place = $row['place']; $img = $row['image']; ?> <tr> <td align="center" valign="top"><?php echo $id; ?><input name="id" type="hidden" id="id" value="<?php echo $id; ?>"></td> <td align="center" valign="top"><label> <input name="name" value="<?php echo $name; ?>" type="text" id="<?php echo $name; ?>" maxlength="100" /> </label></td> <td align="center" valign="top"><label> <input name="date" value="<?php echo $date; ?>" type="text" id="<?php echo $date; ?>" maxlength="500" /> </label></td> <td align="center" valign="top"><label> <input name="time" value="<?php echo $time; ?>" type="text" id="<?php echo $time; ?>" maxlength="100" /> </label></td> <td align="center" valign="top"><label> <input name="network" value="<?php echo $network; ?>" type="text" id="<?php echo $network; ?>" maxlength="100" /> </label></td> <td align="center" valign="top"><label> <input name="place" value="<?php echo $place; ?>" type="text" id="<?php echo $place; ?>" maxlength="100" /> </label></td> <td align="center" valign="top"><center> <a href="?"><img src="<?php echo $path.$img; ?>" /><br /> <a href="?">Change Above Image</a></center></td> </tr> <?php } //end while loop echo '<tr> <td colspan="7"><label> <input type="submit" name="button" id="button" value="Submit" /> </label></td> </tr> </table> <label></label> </form>'; }else if (isset($_GET[$get]) && $_GET[$get] == $num_con) { if (!isset($_POST['con_num'])){ header("Location: ?".$get."=".$start_over); } $num = $_POST['bowl_num']; if ($num == (0)){ header("Location: ?".$get."=".$start_over); } echo '<form method="post" action="?'.$get.'='.$add.'" enctype="multipart/form-data"> <table width="100%" border="0"> <tr> <td width="6%"><strong>ID</strong></td> <td width="13%"><strong>Name</strong></td> <td width="13%"><strong>Date</strong></td> <td width="13%"><strong>Time</strong></td> <td width="13%"><strong>Network</strong></td> <td width="12%"><strong>Place</strong></td> <td width="30%"><strong>Image (.jpeg and .jpg only!)</strong></td> </tr>'; for ($counter = 1; $counter <= $num; $counter++) { ?> <tr> <td><?php echo $counter; ?></td> <td><label> <input name="name-<?php echo $counter; ?>" type="text" id="name-<?php echo $counter; ?>" maxlength="100" /> </label></td> <td><label> <input name="date-<?php echo $counter; ?>" type="text" id="date-<?php echo $counter; ?>" maxlength="500" /> </label></td> <td><label> <input name="time-<?php echo $counter; ?>" type="text" id="time-<?php echo $counter; ?>" maxlength="100" /> </label></td> <td><label> <input name="network-<?php echo $counter; ?>" type="text" id="network-<?php echo $counter; ?>" maxlength="100" /> </label></td> <td><label> <input name="place-<?php echo $counter; ?>" type="text" id="place-<?php echo $counter; ?>" maxlength="100" /> </label></td> <td><input type="file" name="image-<?php echo $counter; ?>" class="form" id="image-<?php echo $counter; ?>"></td> <?php }//end for loop echo ' </tr> <tr> <td colspan="7"><label> <input type="submit" name="button" id="button" value="Submit" /> </label></td> </tr> </table> <label></label> </form>'; $_SESSION['num'] = $num; $_SESSION['up'] = true; //code here! }else if (isset($_GET[$get]) && $_GET[$get] == $start_done) { echo "Added ".$num." bowls"; echo '<DD>'; echo '<li><a href="?">Manage Football Bowl Home</a>'; echo '<li><a href="../index.php">Admin Center</a>'; }else if (isset($_GET[$get]) && $_GET[$get] == $add) { $num = $_SESSION['num']; if($_SESSION['up'] !== (true)){ header("Location: ?".$get."=".$start_over); } function getExt($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } for ($counter = 1; $counter <= $num; $counter++) { //Image Settings! $url = $_FILES['image-'.$counter]['name']; // Set $url To Equal The Filename For Later Use $ext = getExt($url); if ($_FILES['image-'.$counter]['type'] == "image/jpg" || $_FILES['image-'.$counter]['type'] == "image/jpeg" || $_FILES['image-'.$counter]['type'] == "image/pjpeg") { $file_ext = strrchr($_FILES['image-'.$counter]['name'], '.'); // Get The File Extention In The Format Of , For Instance, .jpg, .gif or .php $name = $counter.".".$ext; $url = $name; $copy = copy($_FILES['image-'.$counter]['tmp_name'], "$idir" . $name); // Move Image From Temporary Location To Permanent Location if ($copy) { // If The Script Was Able To Copy The Image To It's Permanent Location // print 'Image uploaded successfully.<br />'; // Was Able To Successfully Upload Image $simg = imagecreatefromjpeg("$idir" . $url); // Make A New Temporary Image To Create The Thumbanil From $currwidth = imagesx($simg); // Current Image Width $currheight = imagesy($simg); // Current Image Height if ($currheight > $currwidth) { // If Height Is Greater Than Width $zoom = $twidth / $currheight; // Length Ratio For Width $newheight = $theight; // Height Is Equal To Max Height $newwidth = $currwidth * $zoom; // Creates The New Width } else { // Otherwise, Assume Width Is Greater Than Height (Will Produce Same Result If Width Is Equal To Height) $zoom = $twidth / $currwidth; // Length Ratio For Height $newwidth = $twidth; // Width Is Equal To Max Width $newheight = $currheight * $zoom; // Creates The New Height } $dimg = imagecreate($newwidth, $newheight); // Make New Image For Thumbnail imagetruecolortopalette($simg, false, 256); // Create New Color Pallete $palsize = ImageColorsTotal($simg); for ($i = 0; $i < $palsize; $i++) { // Counting Colors In The Image $colors = ImageColorsForIndex($simg, $i); // Number Of Colors Used ImageColorAllocate($dimg, $colors['red'], $colors['green'], $colors['blue']); // Tell The Server What Colors This Image Will Use } imagecopyresized($dimg, $simg, 0, 0, 0, 0, $newwidth, $newheight, $currwidth, $currheight); // Copy Resized Image To The New Image (So We Can Save It) imagejpeg($dimg, "$tdir" . $url); // Saving The Image imagedestroy($simg); // Destroying The Temporary Image imagedestroy($dimg); // Destroying The Other Temporary Image } //Add to the database++ } $name = "admin_area/foot/bowls_img/".$name; $image = $name; $id = $counter; $name = $_POST['name-'.$counter]; $date = $_POST['date-'.$counter]; $time = $_POST['time-'.$counter]; $network = $_POST['network-'.$counter]; $place = $_POST['place-'.$counter]; $query = "INSERT INTO `foot_bowls` (id, name, image, date, time, network, place) VALUES ('".$id."', '".$name."', '".$image."', '".$date."', '".$time."', '".$network."', '".$place."')"; mysql_query($query)or die(mysql_error()); }//end loop header("Location: ?".$get."=".$start_done); //Delete Area--++ }else if (isset($_GET[$get]) && $_GET[$get] == $ask) { if (mysql_num_rows($result) == 0) { header("Location: ?".$get."=".$start_over); } $_SESSION['ask'] = true; echo "In order to continue, you need to delete the old bowl settings.<br /><br />"; ?> <form id="form1" name="form1" method="post" action="?<?php echo $get; ?>=<?php echo $val; ?>"> <label> <input name="ask" type="radio" id="radio" value="no" checked="checked" /> </label> Nevermind! <label> <input type="radio" name="ask" id="radio2" value="yes" /> </label> Delete and Continue <label> <input type="submit" name="dele_ask" id="dele_ask" value="Continue" /> </label> </form> <?php }else if (isset($_GET[$get]) && $_GET[$get] == $val) { if (mysql_num_rows($result) == 0) { header("Location: ?".$get."=".$start_over); } if (!isset($_SESSION['ask'])){ header("Location: ?".$get."=".$ask); } unset($_SESSION['ask']); $_SESSION['asked'] = true; if($_POST['ask'] == ("no")){ header("Location: ?"); } if($_POST['ask'] == ("yes")){ header("Location: ?".$get."=".$dele); }else{ header("Location: ?"); } }else if (isset($_GET[$get]) && $_GET[$get] == $dele) { if (mysql_num_rows($result) == 0) { header("Location: ?".$get."=".$start_over); } if (!isset($_SESSION['asked'])){ header("Location: ?".$get."=".$ask); } mysql_query("DELETE FROM `foot_bowls` WHERE `id` > '0'"); foreach(glob($idir.'*.jpg') as $file){ unlink($file); } foreach(glob($idir.'*.jpeg') as $file){ unlink($file); } foreach(glob($idir.'*.pjpeg') as $file){ unlink($file); } echo "Deleted old Bowls"; header("Location: ?".$get."=".$start_over); unset($_SESSION['ask']); unset($_SESSION['asked']); } }else{ header('Location: '.$path.'index.php'); } }else{ header('Location: '.$path.'index.php'); } include ($path."main/include/cons/foot.php"); ?> Hoped I explained it better.
  12. Ok so my script ask you how many bowls you want to make (football bowls), then it stores it into the DB. Well I want to make it where you can go back and edit the bowls, so I made a while loop to pull all the information, so my question is, how do I process the forum with out know how much data to process. I think I might need to make a foreach loop, but not sure.
  13. omg I am sorry I thought this was in the php help section! once again sorry!
  14. Hey post in the right section! http://www.phpfreaks.com/forums/index.php/board,10.0.html
  15. lol sweet :D
  16. I added you! We can figure this out
  17. can you post line 36!?
  18. I do not get what you want to do!?
  19. not to sure but look at http://us2.php.net/str_replace
  20. are you making a NCAA bracket? Because I made one for last season, and I had it on my hard drive, not uploaded it yet, and I installed Windows SP3 (do not do) and it corrupted my hard drive, now I got to start from scratch!
  21. so did I tell him right?
  22. oh, no everybodys gota learn some time or another, we are all here just to help, almost more than half of my posts where questions, lol
  23. hey that seems a little easier to understand, thanks
  24. here is what I have: $path = "../../"; $title = "Marked Paid"; $rank = "yes"; include ($path."main/include/cons/head.php"); that is on every page
×
×
  • 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.