Jump to content

quelle

Members
  • Posts

    61
  • Joined

  • Last visited

    Never

Everything posted by quelle

  1. Dont understand u at all. This "It's not before any tags, and those tags aren't helping" - whose tags ? "on the page I'm having the problem, and it doesn't do anything. However, if I do it on a different page, it works." - what do you mean with diferent ?
  2. am i blind or this guy is starting/ending php code with <? ?>
  3. use the setcookie function before any <html> tags cuz cookies have to be sent before any header information otherwise wont work. If the problem still is there try adding these 2 line before the function ob_start(); ob_clean();
  4. nah not workin' tried both before u said, also tried $dir = "galerija"; always same, nothing happens the div is blank(the space that should be filled with images) EDIT: Sorry for a late reply, was afk never tought someone will reply in minutes
  5. Lets say ive got a function like this one function getPictures() { global $max_width, $max_height; if ( $handle = opendir(".") ) { $lightbox = rand(); echo '<ul id="pictures">'; while ( ($file = readdir($handle)) !== false ) { if ( !is_dir($file) ) { $split = explode('.', $file); $ext = $split[count($split) - 1]; if ( ($type = getPictureType($ext)) == '' ) { continue; } if ( ! is_dir('thumbs') ) { mkdir('thumbs'); } if ( ! file_exists('thumbs/'.$file) ) { if ( $type == 'jpg' ) { $src = imagecreatefromjpeg($file); } else if ( $type == 'png' ) { $src = imagecreatefrompng($file); } else if ( $type == 'gif' ) { $src = imagecreatefromgif($file); } if ( ($oldW = imagesx($src)) < ($oldH = imagesy($src)) ) { $newW = $oldW * ($max_width / $oldH); $newH = $max_height; } else { $newW = $max_width; $newH = $oldH * ($max_height / $oldW); } $new = imagecreatetruecolor($newW, $newH); imagecopyresampled($new, $src, 0, 0, 0, 0, $newW, $newH, $oldW, $oldH); if ( $type == 'jpg' ) { imagejpeg($new, 'thumbs/'.$file); } else if ( $type == 'png' ) { imagepng($new, 'thumbs/'.$file); } else if ( $type == 'gif' ) { imagegif($new, 'thumbs/'.$file); } imagedestroy($new); imagedestroy($src); } echo '<li><a href="'.$file.'" rel="lightbox['.$lightbox.']">'; echo '<img src="thumbs/'.$file.'" alt="" />'; echo '</a></li>'; } } echo '</ul>'; } } What it does is: It checks for files(images) in a directory, check for file types jpg, png or gif cuz I work on gd library and it supports only these 3 type of images and make thumbnails. My problem is I cant change the directory of images, after I do that I just got error or it doesnt read images at all. I tried $dir = "/galerija/"; if ( $handle = opendir($dir) ) But nothing happens, it just leaves me blank space(as I said above it doesnt read images at all)
  6. well doing it on ur way I actually define nothing ... I tried it on this way $question = $_POST['question']; $answer1 = $_POST['answer1']; $answer2 = $_POST['answer2']; $answer3 = $_POST['answer3']; $answer4 = $_POST['answer4']; $answer5 = $_POST['answer5']; But my whole script fucked up after I changed what u said, dunno what's the problem gotta go sleep now ill try tommorow
  7. Your line echo ("You are $remote"); would go like this echo "You are " . $remote;
  8. Here's what i got, a part of poll script, actually this is for a user with some more priviliges... The problem I am facing is actually that my php code doesn't even recognize the text in HTML Form - the text boxes(at least thats what I think so). I made 2 errors - one if client didnt type the title of poll and one if there are lower than 2 answers. And the problem is Im getting those 2 problems all the time no mather what I type in textboxes <?php } function GetNewPollDetails(){ ?> <h1>Nova anketa</h1> <form name="frmAddPoll" action="managepoll.php?method=AddFinal" method="post"> <br /> Pitanje Ankete:<input type="text" name="$question" /> <br /> Odogovor 1:<input type="text" name="answer1" /> <br /> Odogovor 2:<input type="text" name="answer2" /> <br /> Odogovor 3:<input type="text" name="answer3" /> <br /> Odogovor 4:<input type="text" name="answer4" /> <br /> Odogovor 5:<input type="text" name="answer5" /> <br /> <input type="submit" value="Napravi" name="napravi" /> </form> <?php } function AddPoll(){ global $question; global $answer1; global $answer2; global $answer3; global $answer4; global $answer5; $numAnswers = 0; $err = ""; if($answer1 != "") { $numAnswers++; } if($answer2 != "") { $numAnswers++; } if($answer3 != "") { $numAnswers++; } if($answer4 != "") { $numAnswers++; } if($answer5 != "") { $numAnswers++; } if($question == "") $err .= "<li>You didn't enter a title</li>"; if($numAnswers < 2) $err .= "<li>You must enter at least two answer choices</li>"; if($err != "") { ?> <h1>Incomplete Fields</h1> You didn't complete all of the details for this poll. Take a look at the errors below and click the link below to go back and correct them: <ul> <?php echo $err; ?> </ul> <a href="javascript:history.go(-1)">Go Back</a> <?php return; } include("dbvars.php"); @$svrConn = mysql_connect($host, $user, $pw) or die("Couldn't connect to the database server"); @$dbConn = mysql_select_db("websitenforum", $svrConn) or die("Couldn't connect to the database"); $strQuery = "INSERT INTO pollQuestions VALUES("; $strQuery .= "0, '$question', '$answer1', '$answer2', '$answer3', '$answer4', '$answer5')"; if(mysql_query($strQuery)) { echo "You made it, yes!"; } } ?>
  9. thanks it works now ;p btw i defined "method" as part of HTTP_GET_VARS array but I also hadn't to do that because php by itself creates variable for any values that I pass in from either a form or querystring, so an $method variable would be made for me right ? btw thanks again
  10. Ive got some like code like this (this is a part of my source, it'll be enough to solve my problem). I've got 4 functions here trying to run them using switch statement, but only the default one is running, why ? <?php //******PETLJA ZA MENI*******// switch(@$HTTP_GET_VARS["method"]) { case "ShowAdd": GetNewPollDetails(); break; case "AddFinal": AddPoll(); break; case "ShowDelete": GetPollToDelete(); break; case "DeleteFinal": DeletePoll(); break; default: GetChoice(); } function GetChoice(){ ?> <ul> <li><h2><a href="managepoll.php?method=ShowAdd">Dodaj anketu</a></h2></li> <li><h2><a href="managepoll.php?method=ShowDelete">Izbrisi anketu</a></h2></li> <li><h2><a href="managepoll.php?method=DeleteFinal">Pregledaj ankete</a></h2></li> </ul> <?php } ?> <?php function GetNewPollDetails(){ ?> <h1>Nova anketa</h1> <form name="DodajAnketu" action="managepoll.php?method=AddFinal"> <br /> Pitanje Ankete:<input name="text" type="text" width="150"/> <br /> Odogovor 1:<input name="text2" type="text" width="150"/> <br /> Odogovor 2:<input type="text" width="150"/> <br /> Odogovor 3:<input type="text" width="150"/> <br /> Odogovor 4:<input type="text" width="150"/> <br /> Odogovor 5:<input type="text" width="150"/> <br /> <input type="submit" value="Napravi" name="napravi" /> </form> <?php } ?>
×
×
  • 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.