Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $mysqli = new mysqli("Localhost", "xx", "xx", "xx");
- if (mysqli_connect_errno())
- {
- printf("MySQL tilslutnings fejl: %s\n", mysqli_connect_error());
- exit();
- }
- if ($stmt = $mysqli->prepare("SELECT * FROM opskrifter WHERE id='?' ORDER BY navn"))
- {
- $stmt->bind_param("i", mb_convert_encoding($_GET['Opskrift'], "ISO-8859-1", "UTF-8"));
- $stmt->execute();
- $stmt->store_result();
- $rows = $stmt->num_rows;
- if ($rows == "0"
- || $_GET['Opskrift'] == "1"
- || $_GET['Opskrift'] == "2"
- || $_GET['Opskrift'] == "3"
- || $_GET['Opskrift'] == "4"
- || $_GET['Opskrift'] == "5"
- || $_GET['Opskrift'] == "6"
- || $_GET['Opskrift'] == "7"
- || $_GET['Opskrift'] == "8"
- || $_GET['Opskrift'] == "9"
- || $_GET['Opskrift'] == "10"
- || $_GET['Opskrift'] == "11"
- || $_GET['Opskrift'] == "12"
- || $_GET['Opskrift'] == "13"
- || $_GET['Opskrift'] == "14"
- || $_GET['Opskrift'] == "15"
- || $_GET['Opskrift'] == "16"
- || $_GET['Opskrift'] == "17"
- || $_GET['Opskrift'] == "18"
- || $_GET['Opskrift'] == "19"
- || $_GET['Opskrift'] == "20"
- || $_GET['Opskrift'] == "21"
- || $_GET['Opskrift'] == "22"
- || $_GET['Opskrift'] == "23"
- || $_GET['Opskrift'] == "24"
- || $_GET['Opskrift'] == "25"
- || $_GET['Opskrift'] == "26"
- || $_GET['Opskrift'] == "27"
- || $_GET['Opskrift'] == "28"
- || $_GET['Opskrift'] == "29")
- {
- echo '
- <div class="tekst_top">
- <span class="tekst_top_overskrift">Uksendt opskrift</span>
- </div>
- <div class="tekst_center">
- <div class="tekst_center_boks">
- <div class="tekst_advarsel">
- <div class="left">
- <img src="img/tekst_advarsel.png" alt="advarsel" height="73" width="73">
- </div>
- <div class="overskrift">
- Opskriften findes ikke
- </div>
- <div class="right">
- <img src="img/tekst_advarsel.png" alt="advarsel" height="73" width="73">
- </div>
- <div style="clear:both;"></div>
- <div class="forklaring">
- Opskriften du s�ger findes ikke mere, eller har aldirg fundet sted. <br>
- mener du at dettte er en fejl bedes du m�lde det til webmasteren.<br>
- Ellers vil vi bede dig om at g� tilbage til <a href="javascript:go(-1)">forige side.</a>
- </div>
- </div>
- </div>
- </div>
- <div class="tekst_bottom">
- </div>
- ';
- }
- else
- {
- while($row = $stmt->fetch_assoc()) //Lav en while der k�rer alle r�kker igennem
- {
- foreach ($row as $con_name => $con_value)
- {
- $row[$con_name] = mb_convert_encoding($con_value, "UTF-8", "ISO-8859-1");
- }
- unset($con_name,$con_value);
- echo '
- <div class="tekst_top">
- <span class="tekst_top_overskrift">' . $row['navn'] . '</span>
- </div>
- <div class="tekst_center">
- <div class="tekst_center_boks">
- <div class="opskrift-top">
- <div class="opskrift-info">
- <div class="opskrift-overskrift"><span class="overskrift-overskrift">Kort info</span></div>
- <strong>Oprindelse:</strong> '. $row['oprindelse'] . '<br>
- <span style="float:left;"><strong>Bed�mmelse:</strong></span>'; include "MySQL/Plugin/stem_MySQL.php"; echo '<div style="clear:both;"></div>
- <strong>Bio+:</strong> ';
- if ($row['hm'] == "ja")
- {
- echo 'Ja';
- }
- elseif ($row['hm'] == "nej")
- {
- echo 'Nej';
- }
- else
- {
- echo 'Ukendt';
- }
- echo '
- <br><strong>Personer:</strong> ';
- if ($row['personer'] == "1")
- {
- echo '1 person';
- }
- elseif ($row['personer'] == "2")
- {
- echo '2 personer';
- }
- elseif ($row['personer'] == "3")
- {
- echo '3 personer';
- }
- elseif ($row['personer'] == "4")
- {
- echo '4 personer';
- }
- elseif ($row['personer'] == "5")
- {
- echo '5 personer';
- }
- elseif ($row['personer'] == "6")
- {
- echo '6+ personer';
- }
- else
- {
- echo 'Ukendt';
- }
- echo '
- <br><strong>Tid:</strong> ';
- if ($row['tid'] == "0")
- {
- echo '0-1 time';
- }
- elseif ($row['tid'] == "1")
- {
- echo '1-2 timer';
- }
- elseif ($row['tid'] == "2")
- {
- echo '2-3 timer';
- }
- elseif ($row['tid'] == "3")
- {
- echo '3+ timer';
- }
- else
- {
- echo 'Ukendt';
- }
- echo '
- <br></div>
- <div class="opskrift-billede">
- ';
- if (preg_match("/^([^.]+)\.(jpg|png|gif|jpge|JPG|PNG|GIF|JPGE)$/", $row['billede'], $regs))
- {
- $thumbdestination = "Billeder/" . $regs[1] . "_thumb." . $regs[2];
- $realdestination = "Billeder/" . $regs[1] . "_real." . $regs[2];
- if (is_file($thumbdestination) || is_file($realdestination))
- {
- $info = getimagesize($realdestination);
- $infobredde = $info[0];
- $infohojde = $info[1];
- $tilpas = getimagesize($thumbdestination);
- if ($tilpas[0] < 280)
- {
- $tilpasbredde = round(((280 - $tilpas[0]) / 2));
- }
- if ($tilpas[1] < 280)
- {
- $tilpashojde = round(((280 - $tilpas[1]) / 2));
- }
- echo '<img src="'.$thumbdestination.'" alt="' . $row['navn'] . '" style="border:none;cursor:pointer;';
- if (!empty($tilpashojde) || !empty($tilpasbredde))
- {
- if (empty($tilpashojde) || !isset($tilpashojde))
- {
- $tilpashojde = 0;
- }
- if (empty($tilpasbredde) || !isset($tilpasbredde))
- {
- $tilpasbredde = 0;
- }
- echo ' position: relative; top: '.$tilpashojde.'px; left: '.$tilpasbredde.'px;';
- }
- echo '" onclick="myboxopen(\''.$realdestination.'\', \''.$row['navn'].'\', '.$infobredde.', '.$infohojde.');">';
- }
- else
- {
- echo '<img src="Billeder/Intet-billede.jpg" alt="' . $row['navn'] . '" style="border:none;">';
- }
- }
- else
- {
- echo 'fejl';
- }
- echo '
- </div>
- <div style="clear:both;"></div>
- </div>
- <div class="opskrift-bund">
- <div class="opskrift-ingredienser">
- <div class="opskrift-overskrift"><span class="overskrift-overskrift">Ingredienser</span></div>
- ' . $row['ingredienser'] . '
- </div>
- <div class="opskrift-opskrift">
- <div class="opskrift-overskrift"><span class="overskrift-overskrift">Opskrift</span></div>
- ' . $row['tekst'] . '
- </div>
- <div style="clear:both;"></div>
- </div>
- </div>
- </div>
- <div class="tekst_bottom">
- </div>
- ';
- }
- }
- $stmt->close();
- }
- else
- {
- printf("MySQL query fejl: %s\n", $stmt->error);
- $stmt->close();
- }
- $mysqli->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment