Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. screen shot of start of the "garbage" maybe useful!
  2. try putting it in the the body tags ie <body onload="show_now();" >
  3. Well that's strange which mean the table 'player' does NOT exist.. So what should the table name be ?
  4. this is what you should be on so far! <?php $rank = $_POST['rank']; $description = $_POST['description']; $id = $_POST['id']; // Check if button name "Submit" is active, do this if (isset($_POST['Update'])) { $sql1 = "UPDATE photo SET rank='$rank', description='$description' WHERE id=$id"; $result1 = mysql_query($sql1); if ($result1) { header("location:index1.php"); } } // It double checks to see if I'm logged in require_once 'sources/login/classes/Membership.php'; $membership = New Membership(); $membership->confirm_Member(); $db_name = "trek_trek"; $db_server = "localhost"; $db_user = "trek_user"; $db_pass = "intergreen"; $mysqli = new MySQLi($db_server, $db_user, $db_pass, $db_name) or die(mysqli_error()); error_reporting(0); $change = ""; $abc = ""; define("MAX_SIZE", "400"); $errors = 0; if (isset($_POST['Upload'])) { $image = $_FILES["file"]["name"]; $uploadedfile = $_FILES['file']['tmp_name']; if ($image) { $filename = stripslashes($_FILES['file']['name']); $extension = getExtension($filename); $extension = strtolower($extension); if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) { $change = '<div class="msgdiv">Unknown Image extension </div> '; $errors = 1; } else { $size = filesize($_FILES['file']['tmp_name']); if ($size > MAX_SIZE * 1024) { $change = '<div class="msgdiv">You have exceeded the size limit!</div> '; $errors = 1; } if ($extension == "jpg" || $extension == "jpeg") { $uploadedfile = $_FILES['file']['tmp_name']; $src = imagecreatefromjpeg($uploadedfile); } else if ($extension == "png") { $uploadedfile = $_FILES['file']['tmp_name']; $src = imagecreatefrompng($uploadedfile); } else { $src = imagecreatefromgif($uploadedfile); } echo $scr; list ($width, $height) = getimagesize($uploadedfile); $newwidth = 600; $newheight = ($height / $width) * $newwidth; $tmp = imagecreatetruecolor($newwidth, $newheight); $newwidth1 = 200; $newheight1 = ($height / $width) * $newwidth1; $tmp1 = imagecreatetruecolor($newwidth1, $newheight1); imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); imagecopyresampled($tmp1, $src, 0, 0, 0, 0, $newwidth1, $newheight1, $width, $height); $filename = "uploads/" . $_FILES['file']['name']; $filename1 = "uploads/tn/" . $_FILES['file']['name']; imagejpeg($tmp, $filename, 100); imagejpeg($tmp1, $filename1, 100); imagedestroy($src); imagedestroy($tmp); imagedestroy($tmp1); } } } //If no errors registred, print the success message if ($errors>0) { $q = "INSERT into photo(description, src, tn_src) VALUES('$description', '$filename', '$filename1')"; $result = $mysqli->query($q) or die(mysqli_error($mysqli)); if ($result) { $change = '<div class="msgdiv">Image Uploaded Successfully!</div>'; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Admin Page</title> <link rel="stylesheet" href="sources/styles.css" type="text/css" /> <link rel="stylesheet" href="admin.css" type="text/css" /> </head> <body> <div id="container"> <div id="header"> <h1>Admin page</h1> </div> <div id="content"> <div id="page"> <?php echo $change; ?> <table width="502" cellpadding="0" cellspacing="0" id="main"> <tbody> <tr> <td width="500" height="238" valign="top" id="main_right"> <div id="posts"> <form method="post" action="" enctype="multipart/form-data" name="form1"> <table width="500" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <Td style="height: 25px"> </Td> </tr> <tr> <td width="150"> <div align="right" class="titles">Picture :</div> </td> <td width="350" align="left"> <div align="left"><input size="25" name="file" type="file" style="font-family: Verdana; font-size: 10pt" class="box" /></div> </td> </tr> <tr> <Td></Td> <Td valign="top" height="35px" class="help">Image maximum size <b>400 </b>kb</span></Td> </tr> <tr> <Td></Td> <Td valign="top" height="35px"><label for="description">Description</label><br /> <input type="text" name="description" value="" /><br /> </Td> </tr> <tr> <Td></Td> <Td valign="top" height="35px"><input type="submit" id="mybut" value="Upload" name="Upload" /></Td> </tr> <tr> <td width="200"> </td> <td width="200"> <table width="200" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="200" align="center"> <div align="left"></div> </td> <td width="100"> </td> </tr> </table> </td> </tr> </table> </form> </div> </td> </tr> </tbody> </table> <form method="POST" action=""> <?php include ('testconfig.php'); $result = mysql_query("SELECT * FROM photo ORDER BY rank ASC") or die("Bad query: " . mysql_error()); while ($row = mysql_fetch_array($result)) { ?> <input type="text" name="rank" size="2" value="<?php print $row['rank']; ?>"> <input type="text" name="description" size="" value="<?php print $row['description']; ?>"> <?php echo "<img src=\"" . $row['tn_src'] . "\"/>"; echo " <a href=delete1.php?id={$row['id']}>Delete</a><br>"; } // END WHILE ?> <input type="submit" value="Update" name="Update"> </form> </div>1.0 <?php function getExtension ($str) { $i = strrpos($str, "."); if (! $i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } ?>
  5. $submit = $_POST['submit']; should be $submit = $_POST['Submit'];
  6. change // Check if button name "Submit" is active, do this if($submit){ for($i=0;$i<$count;$i++){ $sql1= mysql_query("UPDATE photo SET rank='{$_POST['rank']}', description='{$_POST['description']}' WHERE id=$id"); $result1=mysql_query($sql1); } } to // Check if button name "Submit" is active, do this if($submit){ $sql1= mysql_query("UPDATE photo SET rank='{$_POST['rank']}', description='{$_POST['description']}' WHERE id=$id"); $result1=mysql_query($sql1); } %count isn't set and i see no reason for having that code
  7. You missed this part! do a find in your code for "picdescription" and replace them both with 'description'
  8. can you post your updated code
  9. your form says 'picdescription' you php code says 'description' update one of them (ie) change <input type="text" name="picdescription" value="" /><br /></Td> to <input type="text" name="description" value="" /><br /></Td> also <input type="text" name="<? print $row['rank'] ;?>" size="2" value="<? print $row['rank'] ;?>"> <input type="text" name="<? print $row['description'] ;?>" size="" value="<? print $row['description'] ;?>"> should be <input type="text" name="rank" size="2" value="<?php print $row['rank'] ;?>"> <input type="text" name="description" size="" value="<?php print $row['description'] ;?>">
  10. Okay, this has been fixed and seams okay now, The strange thing was i deleted a load of files and it word for a while then I got the same error, i spoke to the provider and they fixed it a the inode was setup incorrectly at their end
  11. Ahh little harder as it OOP, change function query($query){ $result = mysql_query($query, $this->connection); if(!$result || mysql_error() != ''){@mail('ster@specialolympiccounty.org','SOAC Error',"Query: ".$query."\r\nMySQL Error: ".mysql_error());} return $result; } to function query($query){ $result = mysql_query($query, $this->connection); if(!$result || mysql_error() != ''){die($query."\r\nMySQL Error: ".mysql_error());} return $result; } and your get a better error funny thing is a mail should be going to ster@... with the error
  12. Well that's probably not the line with the problem this line $this->num_active_users = mysql_numrows($result); is called a line or two after a like that starts like $result = mysql_error( /*something*/); that's probably where the error is.. change that line to $result = mysql_error( /*something*/) or die(mysql_error()); you should get a new error, if you could post that line and the new error it should help *OF COURSE the something is a SQL query
  13. ONLY post the query and the value passed SELECT bi.img AS blueprintimg, bi.id AS blueprintid, bi.name AS blueprintname, i.id as itemid FROM player p JOIN ( SELECT player_id, MAX(id) AS id, COUNT(id) AS num_items FROM items WHERE player_id = 1 ) items_sub ON p.id = items_sub.player_id JOIN items i ON items_sub.id = i.id JOIN blueprint_items bi ON i.id = bi.item_id WHERE p.id = ? replace ? with a player ID Humm not sure about that join
  14. That's a shame, if only we knew what the problems were maybe we could help! oh well!
  15. untested but should atleate give you an idea if ( window.location.href.indexOf("noiphone") == -1 ){ if ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1)) { document.location = "http://www.xxx.com/iphone/"; } }
  16. i don't see the need for a regex why not use == $result = mysql_query("SELECT token FROM data WHERE email='$email'") or die(mysql_error()); $row = mysql_fetch_assoc($result); if ($token == $row['token']) { echo "<font color='green'>Valid Confirmation</font>: You will recieve your serial number in your email in up to 5 minutes please be sure to check your junk inbox"; EDIT: i got $token and $realtoken around the wrong way (fixed)
  17. I don't believe your even need $sessID in the array, unless theirs a purpose for it ? personally i would do this $_SESSION['cart'] = array(); // set as an array //add to the array $_SESSION['cart'][] = array ('quantity' => 1, 'price' => $prodPrice, 'prodName' => $prodName, 'handle' => $handle); So in my example (below) $item is the array foreach ($_SESSION['cart'] => $item) { echo '<td>'. $item['quantity'].'</td><td>'. $item['price'].'</td>'; } personally I use foreach on arrays and while with SQL queries, I find it easier that way.. as I don't know when the query will end but with an array i don't want to check if I'm on the last item!
  18. do you mean something like this $_SESSION['cart'][$sessID] = array(); // set as an array //add to the array $_SESSION['cart'][$sessID][] = array ('quantity' => 1, 'price' => $prodPrice, 'prodName' => $prodName, 'handle' => $handle); echo "<pre>"; //loop thought the array foreach($_SESSION['cart'][$sessID] as $Item) { print_r($Item); } echo "</pre>";
  19. I hit preview, saw your code but didn't notice the note about, $_SERVER['HTTPS'] until it hit post.. what about if(!empty($_SERVER['HTTPS'])) {
  20. the $sql is wrong, in 2 ways 1. your post isn't posting all of the elements (ie name, last ect) 2. you have no quote for the strings this should work but your have incomplete data until you sync with the form <?php $connect=mysql_connect("localhost","dbuser","password123"); $sql="INSERT INTO`dbase`.`dtable`(`name`,`last`,`mi`,`add`,`add2`,`city`,`state`,`zip`,`hp`,`cp`,`work`,`email`,`make`,`model`,`color`,`plate`) VALUES ('{$_POST['name']}','{$_POST['last']}','{$_POST['mi']}','{$_POST['phone']}','{$_POST['cp']}','{$_POST['wp']}','{$_POST['add']}','{$_POST['add2']}','{$_POST['city']}','{$_POST['state']}','{$_POST['zip']}','".md5(md5($_POST['password']))."','{$_POST['make']}','{$_POST['model']},{$_POST['color']}','{$_POST['plate']}')"; $res=mysql_query($sql)or die(mysql_error()); ?>
  21. if ($_SERVER['HTTPS'] != "on") { echo 'secure'; }else { echo 'Not secure'; } EDIT: to slow!
  22. With out details no, I'll need to know where its getting stuck, for example any errors, what do the following functions do CountRecords selectFrom And where are they ? saying doesn't send it the same as saying doesn't work.
  23. cont... the function __construct() basically means run this when the class is first called, the other thing to note is that you can't call a function from directly inside a class, it need to be in a function,
  24. @AlexWD only just beat you and you make the same mistake as I did, but I noticed it just as i was about to hit post $this->xml = simplexml_load_file($xml_stats); should be $this->xml = simplexml_load_file($this->xml_stats); BUT when you think about it, it may be better to pass the filename / path across..
  25. try this <?php class retrieveStats { //set XML file public $xml_stats = "./visits.xml"; private $xml; function __construct() { //load XML file $this->xml = simplexml_load_file($this->xml_stats); } public function show_ids() { if (count($this->xml -> hit) > 0) { foreach ($this->xml -> hit as $a) { echo $a -> id; }//end foreach }//end if } //end show_ids }//end class ?>
×
×
  • 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.