Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. change if (filesize($file)>60000) to if (filesize($file)<60000)
  2. look http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html#function_if
  3. create another script for pull images from database and pass to it key from database row
  4. try <?php $url = "https://remotedomain.com/api.php"; $url = parse_url($url); print_r($url); ?>
  5. can you echo $i; after for loop
  6. try <?php if(! empty($poll_title)) { $test = false; foreach($_POST['poll_questions'] as $key => $questions) { $poll_options = $_POST['poll_options'][$key]; foreach ($poll_options as $k => $v) if (empty($v)) unset($poll_options[$k]); if(empty($questions) or count($poll_options) < 3) { continue; } $test = true; $sql = "INSERT INTO poll_questions (question_text) VALUES('". $db->escape($questions) ."')"; $db->query($sql); $poll_id = $db->last_id(); foreach ($poll_options as $option){ $sql = "INSERT INTO poll_options (question_id, option_text) VALUES('". $poll_id ."', '". $option ."')"; $db->query($sql); } } if ($test){ $sql = "INSERT INTO polls (poll_title, topic_id) VALUES('$poll_title', $topic_id)"; $db->query($sql); $sql = "UPDATE topics SET has_poll = 1 WHERE topic_id = $topic_id"; $db->query($sql); define('META_REFRESH', "viewtopic.php?t=$topic_id&f=$forum_id"); trigger_error('poll_added'); } else echo 'poll not added'; } ?>
  7. 1st part of code create array $BlockOutput (try to print_r it), and 2nd insert this array in array $BlockArray with index 'Blocks'
  8. try <?php $products_description = "\" TESTING \""; echo trim($products_description, '"'); ?>
  9. change form to <form> tags etc here {QUESTION} 1: <input type="text" name="poll_questions[1]"/><br/> Option 1: <input type="text" name="poll_options[1][]"/><br/> Option 2: <input type="text" name="poll_options[1][]"/><br/> Option 3: <input type="text" name="poll_options[1][]"/><br/> Option 4: <input type="text" name="poll_options[1][]"/><br/> Option 5: <input type="text" name="poll_options[1][]"/><br/> Option 6: <input type="text" name="poll_options[1][]"/><br/> Option 7: <input type="text" name="poll_options[1][]"/><br/> Option 8: <input type="text" name="poll_options[1][]"/><br/> Option 9: <input type="text" name="poll_options[1][]"/><br/> Option 10: <input type="text" name="poll_options[1][]"/><br/> <br/> {QUESTION} 2: <input type="text" name="poll_questions[2]"/><br/> Option 1: <input type="text" name="poll_options[2][]"/><br/> Option 2: <input type="text" name="poll_options[2][]"/><br/> Option 3: <input type="text" name="poll_options[2][]"/><br/> Option 4: <input type="text" name="poll_options[2][]"/><br/> Option 5: <input type="text" name="poll_options[2][]"/><br/> Option 6: <input type="text" name="poll_options[2][]"/><br/> Option 7: <input type="text" name="poll_options[2][]"/><br/> Option 8: <input type="text" name="poll_options[2][]"/><br/> Option 9: <input type="text" name="poll_options[2][]"/><br/> Option 10: <input type="text" name="poll_options[2][]"/><br/> <br/> {QUESTION} 3: <input type="text" name="poll_questions[3]"/><br/> Option 1: <input type="text" name="poll_options[3][]"/><br/> Option 2: <input type="text" name="poll_options[3][]"/><br/> Option 3: <input type="text" name="poll_options[3][]"/><br/> Option 4: <input type="text" name="poll_options[3][]"/><br/> Option 5: <input type="text" name="poll_options[3][]"/><br/> Option 6: <input type="text" name="poll_options[3][]"/><br/> Option 7: <input type="text" name="poll_options[3][]"/><br/> Option 8: <input type="text" name="poll_options[3][]"/><br/> Option 9: <input type="text" name="poll_options[3][]"/><br/> Option 10: <input type="text" name="poll_options[3][]"/><br/>
  10. try <?php while ($BlockCounter <= $NumBlocks) { $BlockName = 'Block' . $BlockCounter; $BlockFColor = $_POST[$BlockName . 'FColor']; $BlockINavYN = $_POST[$BlockName . 'INavYN']; $BlockDNavYN = $_POST[$BlockName . 'DNavYN']; $BlockTitle = $_POST[$BlockName . 'Title']; $BlockContent = $_POST[$BlockName . 'Content']; $BlockOutput[$BlockName]= array("FontColor" => "$BlockFColor", "INavYN" => "$BlockINavYN", "DNavYN" => "$BlockDNavYN", "Title" => "$BlockTitle", "Content" => "$BlockContent"); $BlockCounter++; } ?> and <?php $BlockArray = array("PageTitle" => "$PageTitle", "HeaderImage" => "$HeaderImage", "Introduction" => array("FontColor" => "$IntroColor", "Content" => "$IntroContent"), "NumberOfBlocks" => $NumBlocks, "Blocks" => $BlockOutput); ?>
  11. no one knows what you want
  12. try <?php $test = '<h1>Some tables and text</h1> <table> <tr> <th>England</th> <th>Paris</th> <th>Munich</th> </tr> <tr> <td> <table> <tr> <th>London</th> <th>Brighton</th> <th>Cambridge</th> </tr> <tr> <td>rain</td> <td>sun</td> <td>wind</td> </tr> </table> </td> <td>sun</td> <td>wind</td> </tr> </table> This is a text between the tables wich should not be removed. <table> <tr> <th>London</th> <th>Paris</th> <th>Munich</th> </tr> <tr> <td>rain</td> <td>sun</td> <td>wind</td> </tr> </table> This is a text after the tables which should also not be removed.'; $out = ''; $start = 0; $a = strpos($test, '<table'); $b = strpos($test, '</table'); $open_tag = 0; while ($a !== false or $b !== false){ if ($a < $b and $a !== false){ if ($open_tag == 0){ $out .= substr($test, $start, $a - $start); } $open_tag++; $a = strpos($test, '<table', $a + 1); } else { $open_tag--; $start = strpos($test, '>', $b+1) + 1; $b = strpos($test, '</table', $start); } } if ($open_tag) die('HTML error!'); $out .= substr($test, $start); echo $out; ?>
  13. change if ($_GET["Page"] !="") to if (isset($_GET["Page"])) and so on. test isset($_GET) before you proces form btw. you dont have field with name 'Time' or 'time' in your form
  14. fields in your forms are named 'Page', 'User Code' and 'Date'. You mast use same names in $_GET index
  15. try <?php $count = mysql_num_rows($result); $count1 = 0; while($hey = mysql_fetch_array($result)){ echo $hey['firstname']; $count1++; if ($count1 == 2 and $count > 2){ echo "<a href=\"moreinfo.php\">[...]</a><br>"; break; } } echo '</td>'; ?>
  16. <?php print($_SESSION['tmp_form']['error']); ?> change to <?php print(isset($_SESSION['tmp_form']['error']) ? $_SESSION['tmp_form']['error']) : ""; ?> btw. it isn't error it's notice
  17. try to add space after "UPDATE" , change to "UPDATE " in 2nd $sql you have field name isx23
  18. '/<a href="profile\.php\?[^"]*selected=([^"&]*)["&][^>]+><span[^>]+>([^<]*)</'
  19. 1st grab data and then count grabed rows @BioBob Format of LIMIT in MySQL is 'LIMIT start, lenght', not 'LIMIT start, end'
  20. you dont pass $id thru your form change form to <?php include "db.php"; $id = $_GET[íd]; $select = mysql_query("select * from table where ID = '$id'"); $data = mysql_fetch_array($select); ?> <form method="post" ><input type="checkbox" name="publish" value="yes" <?php if($data['publish'] == 'yes'){ echo "checked='checked'"; } echo "<input type='hidden' name='id' value='$id' />" ?> /><input type="submit" name="submit"></form> and 2nd part to <?php if (isset($_POST['submit'])){ $publish = isset($POST[publish]) ? 'yes' : 'no'; $id = $_POST['id']; $query = mysql_query("UPDATE table SET publish = '$publish' WHERE ID = '$id'"); } ?>
  21. you need ) in the end of query $q = "INSERT INTO moon (question, answer) VALUES('" . mysql_real_escape_string(stripslashes($_POST['question'])) . "', '" . mysql_real_escape_string(stripslashes($_POST['answer'])) . "')";
  22. try <?php $current_page = 4; $totalpages = 6; $show = 5; $start = (int) max(1, min($current_page - floor(($show - 1)/2), $totalpages - $show + 1)); $end = min($totalpages, $start + $show - 1); $count = 0; for ($i = $start; $i <= $end; $i++) { if($current_page == $i) echo $i."\n"; else echo "<a href=?p=".$i."> ".$i." </a>\n"; } ?>
  23. try <?php $width = 55; $a = '<table width="$width%">'; $a = addslashes($a); eval('$out = "'.$a.'";'); echo $out; ?>
×
×
  • 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.