Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. try this $password = mysql_query("SELECT password FROM users WHERE user_id = '$uid' and PASSWORD ('$password')") OR DIE(mysql_error()); if(mysql_num_rows($password)>0) { //valid } it should be the same as the login script
  2. i assume you are using .htaccess something like Redirect /blar/file/ /?file= check that and get the variable
  3. post code example setcookie("TestCookie", "blar", time()+3600); /* expire in 1 hour */
  4. can you post an example you could probably trim it via substr or regex
  5. try a new script <?php echo "Hello "; ?> world does that work ?
  6. Just an idea.. when you download add a extra entry to the speadsheet a code or tag of sorts.. then when you upload check that code to the one in the database. of course someone could download one and copy that code/tag and put it on another file then re-upload but your know who as the tag will could be logged by the system..
  7. do a search for "PHP facebook" or "PHP Google" its really hard to say really theirs tons of google APIs and what do you want to do in facebook ? example here
  8. ROFLMAO
  9. can you echo the SQL query and post that, it may be an idea to do a select from the existing record and post that.. it may be come clear!
  10. really need to see the code that displays that data.. i would guess your do this echo stdClass->any; //or echo stdClass['any'];
  11. depends you could use extended classed & overloads, or read the API section in the manual, or create an API and add it to the manual!
  12. Heres a script i cleaned up read the full post (its shortish) http://www.phpfreaks.com/forums/index.php/topic,162782.0.html
  13. if its still failing your need to post the class..
  14. i gave the code a quick clean up.. try it now <?php session_start(); include('../params/params.php'); include_once('thumbnail.inc.php'); if(!isset($_SESSION['valid_admin'])) { header("Location:index.php"); } $process = ""; $process = isset($_POST['process']) ? $_POST['process'] : ''; if ($process != "execute") { //not being submitted... }else{ $county=""; $location=""; $type=""; $price="";$bedrooms="";$sale_type="";$description="";$accomodation=""; $county = $_POST['county']; $location = $_POST['location']; $type = $_POST['type']; $address = $_POST['address']; $price = $_POST['price']; $bedrooms = $_POST['bedrooms']; $sale_type = $_POST['sale_type']; $description = $_POST['description']; $features = $_POST['features']; $accomodation = $_POST['accomodation']; if($county == "") { $countyerror = "Please select a county."; $error=1; }elseif($location == ""){ $locationerror = "Please select a location."; $error=1; }elseif($type == ""){ $typeerror = "Please select a property type."; $error=1; }elseif($address == ""){ $addresserror = "Please enter an address for this property."; $error=1; }elseif($price == ""){ $priceerror = "Please enter a price for this property."; $error=1; }elseif($description == ""){ $descriptionerror = "Please enter a description for this property."; $error=1; } if($error == 1) { //an error occured cant save... }else{ $imagedir = dirname(__FILE__)."/property_images/"; $timest = time(); $image1 = $_FILES['image1']['tmp_name']; if($image1 != "") { $image1exists = 1; $includesimage = '1'; } $image1exists=""; $image1a=""; if($image1exists == 1) { $image1file = $imagedir.$timest."AA".basename($_FILES['image1']['name']); $image1 = $imagedir.$timest."AA".basename($_FILES['image1']['name']); $image1a = $imagedir."THUMB".$timest."AA".basename($_FILES['image1']['name']); if($_FILES['image1']['tmp_name'] != "") { list($width, $height, $type, $attr) = getimagesize($_FILES['image1']['tmp_name']); $C = move_uploaded_file($_FILES['image1']['tmp_name'], $image1file); if(!$C) die("Upload Failed #1"); if($width > $height){ $istaller = "0";} if($width < $height){ $istaller = "1";} if($width == $height){ $istaller = "2";} $thumb = new Thumbnail($image1file); if($istaller == "0") { $thumb->resize('0','100'); $thumb->cropFromCenter('100'); }elseif($istaller == "1"){ $thumb->resize('100','0'); $thumb->cropFromCenter('100'); }else{ $thumb->resize('100','100'); } $thumb->save($image1a,100); if($height > "650") { $thumb2 = new Thumbnail($image1file); if($istaller == "0") { $thumb2->resize('0','650'); $thumb2->cropFromCenter('650'); }elseif($istaller == "1"){ $thumb2->resize('650','0'); $thumb2->cropFromCenter('650'); }else{ $thumb2->resize('650','650'); } $thumb2->save($image1,100); } } $insertproperty=""; insertproperty($county, $location, $type, $address, $price, $bedrooms, $sale_type, $description, $features, $accomodation, $image1, $image1a, $image2, $image3, $image4, $image5, $image6); if($insertproperty == 0) { echo $generalerror = "Error uplaoding files(s)."; }else{ echo $generalerror = "Files Uploaded."; } } } } ?>
  15. oops i should of said add this line back in $check = move_uploaded_file($_FILES['image1']['tmp_name'], $image1file); var_dump($check, $image1file); //<==This line
  16. try this change if($image1exists == 1){ $image1file = $imagedir.$timest."AA".basename($_FILES['image1']['name']); //ADD THIS echo "I am set:"; var_dump($image1file); } to if($image1exists == 1){ $image1file = dirname(__FILE__)."/".$imagedir.$timest."AA".basename($_FILES['image1']['name']); //ADD THIS echo "I am set:"; var_dump($image1file); }
  17. better to use RegEx.. see Regex Section example code <?php $html = '<a href="http://something.com" target="_blank">Test </a>'; if (preg_match('/href="([^"]*)"/i', $html , $regs)) { $result = $regs[1]; } else { $result = "No URL Found"; } echo $result ; ?>
  18. Problem with the upload this line fails.. move_uploaded_file($_FILES['image1']['tmp_name'], $image1file); reason..is this $image1file is not being set add line (see comments) <?php $image1 = $_FILES['image1']['tmp_name']; //ADD echo "Testing123:"; var_dump($_FILES); if($image1 != ""){ $image1exists = 1; $includesimage = '1'; } if($image1exists == 1){ $image1file = $imagedir.$timest."AA".basename($_FILES['image1']['name']); //ADD THIS echo "I am set:"; var_dump($image1file); } ?>
  19. try this.. see what gets returned <?php $check = move_uploaded_file($_FILES['image1']['tmp_name'], $image1file); var_dump($check, $image1file); die("END");// if($width > $height){ $istaller = "0";} ?>
  20. you did it wrong then.. post what you have
  21. see example code .. add the html you wish to hide in the else block
  22. the exit is terminating the page before its finished loading.. try something like <?php // if today is Thu or Friday add 4 days to today if ($d=="Thu" || $d=="Fri") { echo "Market Closed"; }else{?> HTML CODE <span class="style14"> </span> </small></div></td> etc etc etc <?php } //everyone forgets this one?> BUT it really depends what your trying to do this is not what your trying to do.. if it really is then just move // get the day $d=date("D"); // if today is Thu or Friday add 4 days to today if ($d=="Thu" || $d=="Fri") { echo "Market Closed"; exit; } to the VERY start of the page
  23. SO that was infact thats a NO its not at the top!! thats the problem
  24. post how you added it in
×
×
  • 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.