Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. just wonder if you tried include_once '/home/ace/public_html/conflictingforces/functions.php';
  2. the problem line is probably in include '/home/ace/public_html/conflictingforces/functions.php'; EDIT: did you make the changes to function player_session()
  3. try this (for testing) <?php // conflicting forces functions // Put this at the top of pages you need to be logged into function player_session() { // Check whether the player id variable has been set, if it hasn't, log them out if (!isset($_SESSION['playerid'])) { // Destroy the session session_destroy(); // Automatically redirect to the homepage //header("Location: index.php?page=home"); die("Failed: <a href='index.php?page=home'>Home</a>"); } }; also post the first 20 or so lines of leftnav.php
  4. So does "index.php?page=home" make a called to player_session (without setting session_start and/or setting $_SESSION['playerid'])? if so then thats the loop ie 1. load "index.php?page=home" 2. thats calls player_session 3. which redirect to index.php?page=home 4. goto 1
  5. can you post the first 10 lines of functions.php
  6. basically it looks for where the script was called from (using $_SERVER['HTTP_REFERER']), if its not from the server then it fails.. the problem.. not all clients/proxies will set this thus they will fail, it can be changed to make it seam like its from the server so its unsafe.. also if you have a submit button someone could Still simply click it 10000000X of times to cause a kinda DDOS attak so to someup $_SERVER['HTTP_REFERER'] is usless, and the whole script replies on it..! your probably be better off using sessions and on each click check the time in a session then set the session to the currect time.. ie if($_SESSION['Clicker'] >= time()+15) { $_SESSION['Clicker'] = time(); //process action } hope that makes sense!
  7. redirecting to yourself causes problems like that, check the header(Location: );'s
  8. the logic isn't right.. $this->output = preg_replace('#<!-- INCLUDE ([a-zA-Z0-9\_\-\+\./]+) -->#', $this->_include_template($IM), $this->output); should be $this->output = preg_replace($IM, $this->_include_template($IM), $this->output); Warning: i haven't had much sleep!
  9. maybe instead of for($i = 0, $size = sizeof($include_matches[1]); $i < $size; $i++) { $this->output = preg_replace('#<!-- INCLUDE ([a-zA-Z0-9\_\-\+\./]+) -->#', $this->_include_template($include_matches[1][0]), $this->output); array_shift($include_matches[1]); } try foreach($include_matches[1] as $IM) { $this->output = preg_replace('#<!-- INCLUDE ([a-zA-Z0-9\_\-\+\./]+) -->#', $this->_include_template($IM), $this->output); }
  10. Owww 48 hours.. i suggest you post in the freelance section and offer somthing or start googling some more
  11. OK thats means theirs a problem in the following code <?php function loadImage(){ $this->img = null; $extension = strtolower(end(explode('.', $this->image_path))); if ($extension == 'jpg' || $extension == 'jpeg'){ $this->img = imagecreatefromjpeg($this->image_path); } else if ($extension == 'png'){ $this->img = imagecreatefrompng($this->image_path); } else { return false; //<----This is being called } // Sets a random name for the image based on the extension type $file_name = strtolower(current(explode('.', $this->image_file))); $this->random_file = $file_name . $this->getRandom() . "." . $extension; $this->thumbnail = $this->random_file; $this->converted = $this->random_file; $this->resize = $this->random_file; return true; } ?> So the error is probably cause when the $this->image_name is being set, here <?php function getLocation($image){ $this->image_file = str_replace("..", "/", $image); $this->image_path = IMAGE_BASE . $this->image_file; return true; } ?> which is being called from here <?php copy($_FILES['image']['tmp_name'][$i], IMAGE_FULL . $fileName); $thumb = new GallerySizer(); if($thumb->getLocation($_FILES['image']['name'][$i])){ //<---HERE ?> SO.... try changing $thumb = new GallerySizer(); if($thumb->getLocation($_FILES['image']['name'][$i])){ to $thumb = new GallerySizer(); if($thumb->getLocation(IMAGE_FULL . $fileName)){
  12. my bad,, cleaned it up a little <?php include("GallerySizer.php"); include("config.php"); DEFINE("IMAGE_FULL", '../photos/'); //database connect $db_server ="db1125.oneandone.co.uk"; $db_user = "dbo218351273"; $db_pass = "adawman9772"; $db_name = "db218351273"; $con = mysql_connect("$db_server","$db_user","$db_pass"); // Album cover $cover = $_FILES['image']['name'][$_POST['album_cover']]; if (!$_REQUEST['process']){ echo("Error! No images chosen for processing. <br />"); echo("Click <a href='index.php'>here</a> to start processing your images."); die(); } elseif (!$_POST['album_id']){ echo("No album selected. Please <a href=\"\">choose an album</a> to upload images to."); die(); } else { for($i = 0; $i < count($_FILES['image']['tmp_name']); $i++){ $fileName = $_FILES['image']['name'][$i]; copy($_FILES['image']['tmp_name'][$i], IMAGE_FULL . $fileName); $thumb = new GallerySizer(); if($thumb->getLocation($_FILES['image']['name'][$i])){ if($thumb->loadImage()){ echo("Still here!"); if($thumb->getSize()){ if($thumb->setThumbnail()){ if($thumb->copyThumbImage()){ if($thumb->resizeImage()) { $thumb->copyResizedImage(); }else{die("ERROR:resizeImage");} }else{die("ERROR:copyThumbImage");} }else{die("ERROR:setThumbnail");} }else{die("ERROR:getSize");} }else{die("ERROR:loadImage");} }else{ echo("Invalid image/file has been uploaded. Please upload a supported file-type (JPEG/PNG)"); unlink(IMAGE_FULL . $fileName); die(); } insert_location($thumb); } } function insert_location($thumb_obj) { $image_location = $thumb_obj->getImageLocation(); $thumb_location = $thumb_obj->getThumbLocation(); // If image matches cover selection, update album cover if($cover == $_FILES['image']['name'][$i]){ $sql = "UPDATE albums SET album_cover = '" . $thumb_location . "' WHERE album_id = " . $_POST['album_id']; $result = @mysql_query($sql) or die("Error inserting records: " . mysql_error()); } mysql_select_db("db218351273", $con); $sql = ("INSERT INTO photos (photo_id, photo_title, photo_desc, photo_date, photo_location, thumbnail_location,album_id) VALUES('0', '$_POST[photo_title]', '$_POST[photo_desc]', 'NOW()', '$image_location', '$thumb_location', '$_POST[album_id]')"); $result = mysql_query($sql) or die("Error inserting record(s) into the database: " . mysql_error()); if ($result){ echo("Images successfully converted and stored! <br />Click <a href='index.html'>here</a> to continue."); } } ?>
  13. No, notice the duplicated code $thumb = new GallerySizer(); #1 if($thumb->getLocation($_FILES['image']['name'][$i])){#1 if($thumb->loadImage()){ echo("Still here!"); $thumb = new GallerySizer(); #2 if($thumb->getLocation($_FILES['image']['name'][$i]))#2 { try <?php include("GallerySizer.php"); include("config.php"); DEFINE("IMAGE_FULL", '../photos/'); //database connect $db_server ="db1125.oneandone.co.uk"; $db_user = "dbo218351273"; $db_pass = "adawman9772"; $db_name = "db218351273"; $con = mysql_connect("$db_server","$db_user","$db_pass"); // Album cover $cover = $_FILES['image']['name'][$_POST['album_cover']]; if (!$_REQUEST['process']){ echo("Error! No images chosen for processing. <br />"); echo("Click <a href='index.php'>here</a> to start processing your images."); die(); } elseif (!$_POST['album_id']){ echo("No album selected. Please <a href=\"\">choose an album</a> to upload images to."); die(); } else { for($i = 0; $i < count($_FILES['image']['tmp_name']); $i++){ $fileName = $_FILES['image']['name'][$i]; copy($_FILES['image']['tmp_name'][$i], IMAGE_FULL . $fileName); $thumb = new GallerySizer(); //UPDATED if($thumb->getLocation($_FILES['image']['name'][$i])) { if($thumb->loadImage()) { echo("Still here!"); if($thumb->getSize()) { if($thumb->setThumbnail()) { if($thumb->copyThumbImage()) { if($thumb->resizeImage()) { $thumb->copyResizedImage(); }else{die("ERROR:resizeImage");} }else{die("ERROR:copyThumbImage");} }else{die("ERROR:setThumbnail");} }else{die("ERROR:getSize");} }else{die("ERROR:loadImage");} }else{die("ERROR:getLocation");} //END UPDATE else { echo("Invalid image/file has been uploaded. Please upload a supported file-type (JPEG/PNG)"); unlink(IMAGE_FULL . $fileName); die(); } insert_location($thumb); } } function insert_location($thumb_obj){ $image_location = $thumb_obj->getImageLocation(); $thumb_location = $thumb_obj->getThumbLocation(); // If image matches cover selection, update album cover if($cover == $_FILES['image']['name'][$i]){ $sql = "UPDATE albums SET album_cover = '" . $thumb_location . "' WHERE album_id = " . $_POST['album_id']; $result = @mysql_query($sql) or die("Error inserting records: " . mysql_error()); } mysql_select_db("db218351273", $con); $sql = ("INSERT INTO photos (photo_id, photo_title, photo_desc, photo_date, photo_location, thumbnail_location,album_id) VALUES('0', '$_POST[photo_title]', '$_POST[photo_desc]', 'NOW()', '$image_location', '$thumb_location', '$_POST[album_id]')"); $result = mysql_query($sql) or die("Error inserting record(s) into the database: " . mysql_error()); if ($result){ echo("Images successfully converted and stored! <br />Click <a href='index.html'>here</a> to continue."); } } ?>
  14. basically error_reporting(E_ALL ^ E_NOTICE); will ignore the error.. or you set the variables before trying to use them.. their the 2 choices
  15. a little debugging needed it think replace $thumb = new GallerySizer(); if($thumb->getLocation($_FILES['image']['name'][$i])){ if($thumb->loadImage()){ echo("Still here!"); if($thumb->getSize()){ if($thumb->setThumbnail()){ if($thumb->copyThumbImage()){ if($thumb->resizeImage()){ $thumb->copyResizedImage(); } } } } } } with $thumb = new GallerySizer(); if($thumb->getLocation($_FILES['image']['name'][$i])) { if($thumb->loadImage()) { echo("Still here!"); if($thumb->getSize()) { if($thumb->setThumbnail()) { if($thumb->copyThumbImage()) { if($thumb->resizeImage()) { $thumb->copyResizedImage(); }else{die("ERROR:resizeImage");} }else{die("ERROR:copyThumbImage");} }else{die("ERROR:setThumbnail");} }else{die("ERROR:getSize");} }else{die("ERROR:loadImage");} }else{die("ERROR:getLocation");}
  16. try this logic if( ($phototype != "image/jpeg") && ($phototype != "image/gif") && ($phototype != "image/png") ) { also it looks like the type isn't being set, can you post the form.. check the name is "photo" on the input type='file'
  17. can't really ignore them but can stop the error message appearing <?php // error_reporting(0);// Turn off all error reporting // or just // Report all errors except E_NOTICE // This is the default value set in php.ini error_reporting(E_ALL ^ E_NOTICE); ?>
  18. i'm sorry i am still not sure what your trying to do. basic example! <form method="post"> <input name="test1" type="text"><br> <input name="test2" type="text"><br> <input name="test3" type="text"><br> <input name="test4" type="text"><br> </form> <?php $t1 = $_POST['test1']; $t2 = $_POST['test2']; $t3 = $_POST['test3']; echo "$t1, $t3, $t3, etc"; ?>
  19. echo $rarebit; you may also want to use something like ajax to check the database for a last active timestamp..
  20. i have played with this http://www.byterun.com/website-compiler.php but it has problems, i guess it depends on the site, i can't help much more but i'll be watching this thread as i havn't found any good ones as of yet!
  21. maybe echo current($_POST); not sure what you mean by select it !
  22. in this case, you could just add something like: // add to config.php $DefaultLang = "UK.PHP"; include('config.php'); // Language file. $language = (empty($language))?$DefaultLang:$language; include("lang/$language"); at the start of the index.php file!
  23. after a quick review of your post, i am guessing that the language files are like so $color = "colour"; $style = "Cool"; $effect= "none"; $color = "color"; $effect= "lots"; now the problem with the above is if you include the UK.php it will be fine but if you called the US.php $style isn't defind, so you really need to add this in to the US.php file.. OR... create a new file with all the variables and call that first ie $color = ""; $style = ""; $effect= ""; $lang = "US"; include "preset.php"; include "$lang.php";
  24. i guess like this, yet your still unclear! <?php switch($_GET['page']) { default: case "1": //include or echo page data for default or main (1) page break; case "2": //include or echo page data for page 2 break; case "3": //include or echo page data for page 2 break; } ?>
  25. try this **untested** <?php $file_name="Cat's Company Ltd."; //replaces everything except a-z and 0-9 and spaces with nothing (the /i is case insensitive) $file_name = preg_replace('/([^a-z0-9 ])/i', '', $file_name); //So $file_name is "Cats Company Ltd" //Now get the first word if (preg_match('/(\w+)/si', $file_name, $regs)) { $file_name = $regs[1]; } echo $file_name; //should be Cats ?>
×
×
  • 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.