Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. <?php $query = mysql_query("SELECT * from somewhere;") or die(mysql_error()); $bg = '#eeeeee'; if (empty($query)) { echo 'No results found'; } else { ?> //<-----ADD THIS also use code tags!
  2. have you checked google ?
  3. 1. if its "Urgent" please post in the freelance section with an offer. 2. please use code tags. 3. define the problem! "not working" isn't usful... have you got php installed.. maybe the problems their!
  4. Sure, just goto the freelance section and paid for the work to be done, or maybe amazon and get a book
  5. try <?php $link = mysql_connect($server,$anvandare, $losen); if (!$link) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db($databas);//corrected (yet missing an "e") if (!$db_selected) { die ("Can't use selected Database: " . mysql_error()); } $cid = (int)$_GET['id']; //added a basic filter(i assume this is a int) $query = mysql_query("SELECT * from recipes WHERE id = $cid") OR die(mysql_error());//corrected ?> EDIT: updated error handlering (easier to read i hope) of course you can use mysql_connect($server,$anvandare, $losen) or die(mysql_error()); as used on the "mysql_query" line..
  6. please move this to the JS section, its not a PHP problem!
  7. try changing <img name="test" src="http://192.168.1.181/images/expeditions/<?php echo "$picture[$num].jpg"; ?>" width='760' height='160' border='1'> <?php } ?> to <img name="test" src="http://192.168.1.181/images/expeditions/<?php echo $picture[$num].".jpg"; ?>" width='760' height='160' border='1'> <?php } ?>
  8. As we don't write the code for you this is borderline, so this will half the size, i know thats not exactly what you want but it should give you a good idea change $copied = copy($_FILES['image']['tmp_name'], $newname); if (!$copied) { echo '<h1>Copy unsuccessfull!</h1>'; $errors=1; } to $copied = copy($_FILES['image']['tmp_name'], $newname); if (!$copied) { echo '<h1>Copy unsuccessfull!</h1>'; $errors=1; }else{ //new size (percent) $percent = 0.5; // Get new sizes list($width, $height) = getimagesize($newname); $newwidth = $width * $percent; $newheight = $height * $percent; // Load $thumb = imagecreatetruecolor($newwidth, $newheight); $source = imagecreatefromjpeg($newname); // Resize imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); // Output imagejpeg($thumb, $newname); } you want to change the "Get new sizes" part
  9. See here register_globals I'll stress that running PHP with register globals turned on, though convenient, opens unnecessary security risks. Example <HTML> <FORM> Please type your name here:<BR> <INPUT TYPE="TEXT" NAME="username"><BR><BR> <INPUT TYPE="SUBMIT" VALUE="Submit data"> </FORM> <BR><BR> You typed: <?php //$admin = false; //without this line theirs a security hole!!!!! echo $username; if($username == "ADMIN") { $admin = true; } //....................other code if($admin) { echo "<br />Welcome Admin"; } ?> </HTML> now if i used the name as ADMIN i am the administartor anything else an i am not.. BUT if i load the page like this TEST.php?admin=1 then $admin will be 1 (aka true) thus anyuser could be the admin, this can be corrected by setting $admin to false at the start of the script but still it could be missed!
  10. basic idea would be have a table "sessions" when the user logs in, the login script looks for an entry in the sessions table and removes them(it), then it creates one, with the session_id being used.. now everytime you check the user is logged in you can check tha the current users session id is the same as the one in the database.. if not then clear then session_destory(). please note thats just a draft
  11. OK well global register is off (thats good), so your need to tell the form and the php which method to use e.g. <HTML> <FORM method="post"> Please type your name here:<BR> <INPUT TYPE="TEXT" NAME="username"><BR><BR> <INPUT TYPE="SUBMIT" VALUE="Submit data"> </FORM> <BR><BR> You typed: <?php echo $_POST['username']; ?> </HTML>
  12. try this mysql_query("UPDATE `dirtyblo_wpmu`.`wp_2_options` SET `option_value` = 'a:3:{i:0;s:17:\"add-meta-tags.php\";i:1;s:43:\"all-in-one-seo-pack/all_in_one_seo_pack.php\";i:2;s:11:\"sitemap.php\";}' WHERE `wp_2_options`.`option_id` = 39 AND `wp_2_options`.`blog_id` = 0 AND CONVERT(`wp_2_options`.`option_name` USING utf8) = 'active_plugins' LIMIT 1;") or die("update id $id failed" . mysql_error()); Note the " have been escaped \" edit: Option 2 $options = 'a:3:{i:0;s:17:"add-meta-tags.php";i:1;s:43:"all-in-one-seo-pack/all_in_one_seo_pack.php";i:2;s:11:"sitemap.php";}' mysql_query("UPDATE `dirtyblo_wpmu`.`wp_2_options` SET `option_value` = '$options' WHERE `wp_2_options`.`option_id` = 39 AND `wp_2_options`.`blog_id` = 0 AND CONVERT(`wp_2_options`.`option_name` USING utf8) = 'active_plugins' LIMIT 1;") or die("update id $id failed" . mysql_error());
  13. your welcome as a note prefixing the @ omits the error (so use wisely) also the or die(mysql_error()) is VERY useful, keep them inmind, can you click solved (bottom left) if all is well
  14. check the database for the field "email", then either add it or change it to email OR change the query to the one from the database
  15. try this <HTML> <FORM> Please type your name here:<BR> <INPUT TYPE="TEXT" NAME="username"><BR><BR> <INPUT TYPE="SUBMIT" VALUE="Submit data"> </FORM> <BR><BR> You typed: <?php echo $username; ?> </HTML>
  16. try echo "{$myrow['Dealer']}<br />{$myrow['Address']}<br />{$myrow['City']} {$myrow['State']} {$myrow['Zip']} <br /> {$myrow['Phone']}<br />You are $value miles away from this $dname dealer."; if its for testing try echo "You are $value miles away from this $dname dealer.<pre>"; print_r($myrow);
  17. as a side note, i assume you have the <?php $link = mysql_connect("localhost", "mysql_user", "mysql_password"); mysql_select_db("db", $link); ?> above the code posted
  18. Humm you didn't get an extra message ie also you did use exaclty what i posted (removing the @ as well) can you post what the following outputs $query = "SELECT user_name, first_name, last_name, address, postcode, tel, email, agreetolist FROM users WHERE user_id=$id"; echo $query; $result = mysql_query ($query) or die(mysql_error()); // Run the query. $x = mysql_num_rows($result); if ($x == 1) { // Valid user ID, show the form. // Get the user's information. $row = mysql_fetch_array ($result, MYSQL_NUM);
  19. you can use isset, to find if its been checked <form method="post"> <input name="test1" type="checkbox" value="111" /> <input name="test2" type="checkbox" value="222" /> <input name="test3" type="checkbox" value="333" /> <input type="submit" /> </form> <?php if (isset($_POST['test1'])) { echo $_POST['test1']; } if (isset($_POST['test2'])) { echo $_POST['test2']; } if (isset($_POST['test3'])) { echo $_POST['test3']; } ?>
  20. can you try my post above and post the results
  21. change $result = @mysql_query ($query); // Run the query. to $result = mysql_query ($query) or die(mysql_error()); // Run the query. this should show a more useful error
  22. yep move if ($r[$percentage] <= 25) { $fontcol=red; } if ($r[$percentage] >= 25) { $fontcol=orange; } if ($r[$percentage] >= 50) { $fontcol=yellow; } if ($r[$percentage] >=75) { $fontcol=green; } if ($r[$percentage] >=100) { $fontcol=green; } below the $thepercentage=mysql_result($results,$x,$percentage); Full code <link rel="stylesheet" type="text/css" href="stylenews.css"> <? include('data.php'); //include("funktioner.php"); mysql_connect($server,$anvandare, $losen); mysql_select_db($databas); ?> <center><?=$note?></center> <div align="center"> <center> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#5D6765" width="95%" id="AutoNumber1"> <tr> <td width="100%"><br> <? $results= mysql_query("SELECT * FROM todo Order by percentage desc"); $id = "id"; $name = "name"; $description = "description"; $left_to_do = "left to do"; $percentage = "percentage"; echo mysql_error(); if (mysql_Numrows($results)>0) //if there are records in the fields { $numrows=mysql_NumRows($results); //count them $x=0; while ($x<$numrows){ //loop through the records $theid=mysql_result($results,$x,$id); $thename=mysql_result($results,$x,$name); $thedescription=mysql_result($results,$x,$description); $theltd=mysql_result($results,$x,$left_to_do); $thepercentage=mysql_result($results,$x,$percentage); if ($thepercentage <= 25) { $fontcol="red"; } if ($thepercentage >= 25) { $fontcol="orange"; } if ($thepercentage >= 50) { $fontcol="yellow"; } if ($thepercentage >=75) { $fontcol="green"; } if ($thepercentage >=100) { $fontcol=green; } ?> <table width="100%"> <tr> <th class="subcat" width="60%"> <font size="3"><?=$thename?>:</font> </th> <th class="subcat"> <font size="2">Done so far: <font color="<?=$fontcol?>"><?=$thepercentage?>%</font> </th> </tr> <tr> <td colspan="2" class="row2"> Design Page.<BR> <?=$theltd?></td> </tr> </table> <BR> <? $x++; } } else { ?> <center><b>There is nothing left to do !</b></center> <br> <? } ?> </td> </tr> </table> </center> </div> <?php } ?> EDIT: UPDATED Full Code
  23. can you post the form please (use the code tags) [code.][./code] (without the dot)
  24. please click solved (bottom left)
  25. [uNSURE] So is this solved now ?
×
×
  • 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.