Hio iedereen,
IK verveelde me en ik heb een script gemaakt net zoals habbo.
die headlines hier is de script:
headlines.php
(Heb er ook commentaar bijgezet, en ik weet het meer spacies xD)
Connect.php
Database:
Voorbeeld: http://www.snabbo.nl/onderhoud/headlines.php
Als het goed is moet het zo werken
je kan het aanpassen maar je magNIET Doorverkopen/Zeggen dat JIJ het gemaakt hebt
Wil je ook graag je mening/cijfer geven
?
Alvast bedankt
IK verveelde me en ik heb een script gemaakt net zoals habbo.
die headlines hier is de script:
headlines.php
<html>
<head>
<meta http-equiv="Content-Language" content="nl" />
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<title>Snabbo ~ Headlines</title>
<link rel="stylesheet" type="text/css" href="style_pagina.css">
<style type="text/css">
a.link_1:link, a.link_1:active, a.link_1:visited {
text-decoration: none;
color: #FFFFFF;
}
a.link_1:hover {
text-decoration: underline;
color: #FFFFFF;
}
a.link_2:link, a.link_2:active, a.link_2:visited {
text-decoration: underline;
color: #FFFFFF;
}
a.link_2:hover {
text-decoration: underline;
color: #FFFFFF;
}
</style>
<script type="text/javascript">
function headlines_1() {
headlines_2();
setTimeout("headlines_1()", 10000);
}
i = 0;
function headlines_2() {
if(i >= 3) {
i = 0;
}
document.getElementById(i).style.display="block";
if(i == "0") {
document.getElementById(2).style.display="none";
} else if(i == "1") {
document.getElementById(0).style.display="none";
} else {
document.getElementById(1).style.display="none";
}
i++;
}
</script>
<base target="content">
</head>
<body onload="headlines_1();">
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/require_once"]require_once[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]connect.php[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"
SELECT Tid, tijd, headlinehoofdtekst, headlinekleinetekst, headlineplaatje
FROM topics
WHERE `headlinehoofdtekst` IS NOT NULL
AND `headlinekleinetekst` IS NOT NULL
AND `headlineplaatje` IS NOT NULL
AND `headlinehoofdtekst` <>
AND `headlinekleinetekst` <>
AND `headlineplaatje` <>
ORDER BY Tid DESC LIMIT 5
"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](![/COLOR][COLOR= #0000BB]$res[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700])) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]FORUMCODE0[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[COLOR= #0000BB]$tellen[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$res[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]// telt het aantal rijen[/COLOR]
[COLOR= #0000BB]$teller[/COLOR] [COLOR= #007700]= -[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// teller start met 0[/COLOR]
[URL="http://www.php.net/while"]while[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$res[/COLOR][COLOR= #007700])) {[/COLOR]
[COLOR= #0000BB]$teller[/COLOR][COLOR= #007700]++;[/COLOR] [COLOR= #FF8000]// teller eentje verhogen (1ste is dus nummer 1, 2de nnummer 2, etc..)[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$teller[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]$tellen[/COLOR][COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<div id="[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$teller[/COLOR] [COLOR= #007700].[/COLOR][COLOR= #DD0000]" style="display: block"> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<table cellspacing="0" cellpadding="0" width="300" height="187" background="[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/nl2br"]nl2br[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]headlineplaatje[/COLOR][COLOR= #007700]])).[/COLOR][COLOR= #DD0000]"> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<td valign="top"> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<table cellspacing="0" cellpadding="0" width="300" height="8"> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<td width="280"><img src="http://www.snabbo.nl/onderhoud/images/transparant.gif" width="8" height="8" border="0"></td> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</table> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<table cellspacing="0" cellpadding="0" width="300" height="169"> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<td width="14"><img src="http://www.snabbo.nl/onderhoud/images/transparant.gif" width="10" height="10" border="0"></td> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<td width="272" valign="top"> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<font style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #FFFFFF">LAATSTE NIEUWS<br></font> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<font style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 18px; color: #FFFFFF"><b><a TARGET="_parent" href="index.php?p=nieuws&topic=[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/nl2br"]nl2br[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Tid[/COLOR][COLOR= #007700]])).[/COLOR][COLOR= #DD0000]" class="link_1">[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/nl2br"]nl2br[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]headlinehoofdtekst[/COLOR][COLOR= #007700]])).[/COLOR][COLOR= #DD0000]</a></b></font> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<font style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #FFFFFF"><br><br>[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/nl2br"]nl2br[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]headlinekleinetekst[/COLOR][COLOR= #007700]])).[/COLOR][COLOR= #DD0000]<br><br><a TARGET="_parent" href="index.php?p=nieuws&topic=[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/nl2br"]nl2br[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Tid[/COLOR][COLOR= #007700]])).[/COLOR][COLOR= #DD0000]" class="link_2">Lees meer »</a></font> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</td> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<td width="14"><img src="http://www.snabbo.nl/onderhoud/images/transparant.gif" width="10" height="10" border="0"></td> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</table> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<table cellspacing="0" cellpadding="0" width="300" height="10">[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<td width="280"><img src="http://www.snabbo.nl/onderhoud/images/transparant.gif" width="10" height="10" border="0"></td> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</table>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</td> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</table></div> [/COLOR][COLOR= #007700];
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<div id="[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$teller[/COLOR] [COLOR= #007700].[/COLOR][COLOR= #DD0000]" style="display: none"> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<table cellspacing="0" cellpadding="0" width="300" height="187" background="[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/nl2br"]nl2br[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]headlineplaatje[/COLOR][COLOR= #007700]])).[/COLOR][COLOR= #DD0000]"> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<td valign="top"> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<table cellspacing="0" cellpadding="0" width="300" height="8"> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<td width="280"><img src="http://www.snabbo.nl/onderhoud/images/transparant.gif" width="8" height="8" border="0"></td> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</table> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<table cellspacing="0" cellpadding="0" width="300" height="169"> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<td width="14"><img src="http://www.snabbo.nl/onderhoud/images/transparant.gif" width="10" height="10" border="0"></td> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<td width="272" valign="top"> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<font style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #FFFFFF">LAATSTE NIEUWS<br></font> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<font style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 18px; color: #FFFFFF"><b><a TARGET="_parent" href="index.php?p=nieuws&topic=[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/nl2br"]nl2br[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Tid[/COLOR][COLOR= #007700]])).[/COLOR][COLOR= #DD0000]" class="link_1">[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/nl2br"]nl2br[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]headlinehoofdtekst[/COLOR][COLOR= #007700]])).[/COLOR][COLOR= #DD0000]</a></b></font> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<font style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #FFFFFF"><br><br>[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/nl2br"]nl2br[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]headlinekleinetekst[/COLOR][COLOR= #007700]])).[/COLOR][COLOR= #DD0000]<br><br><a TARGET="_parent" href="index.php?p=nieuws&topic=[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/nl2br"]nl2br[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Tid[/COLOR][COLOR= #007700]])).[/COLOR][COLOR= #DD0000]" class="link_2">Lees meer »</a></font> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</td> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<td width="14"><img src="http://www.snabbo.nl/onderhoud/images/transparant.gif" width="10" height="10" border="0"></td> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</table> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<table cellspacing="0" cellpadding="0" width="300" height="10">[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<td width="280"><img src="http://www.snabbo.nl/onderhoud/images/transparant.gif" width="10" height="10" border="0"></td> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</table>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</td> [/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</table></div> [/COLOR][COLOR= #007700]; }
}
}[/COLOR]
?>
</body>
</html> (Heb er ook commentaar bijgezet, en ik weet het meer spacies xD)
Connect.php
[COLOR= #0000BB]<?php
$sqlhost[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"localhost"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// host MySQL[/COLOR]
[COLOR= #0000BB]$sqlgebruikersnaam[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"NAAM"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// gebruikersnaam MySQL[/COLOR]
[COLOR= #0000BB]$sqlwachtwoord[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"WW"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// wachtwoord MySQL[/COLOR]
[COLOR= #0000BB]$sqldatabase[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"DBNAAM"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// database MySQL[/COLOR]
[COLOR= #0000BB]$message1[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"
<br>
<br>
Beste <br>
Er zijn wat problemen met onze server. die worden zo snel mogelijk opgelost!<br>
Bedankt voor u begrip <br>
<br>
<br>
<br>
<u><b>Foutmelding:</b></u> "[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$db[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sqlhost[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$sqlgebruikersnaam[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$sqlwachtwoord[/COLOR][COLOR= #007700])[/COLOR]
or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$message1[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
[URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"$sqldatabase"[/COLOR][COLOR= #007700]);[/COLOR]
?> Database:
-- phpMyAdmin SQL Dump
-- version 3.3.1
-- http://www.phpmyadmin.net
--
-- Machine: localhost
-- Genereertijd: 12 Mei 2010 om 16:22
-- Serverversie: 5.1.45
-- PHP-Versie: 5.2.13
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `snabbonl_layout`
--
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `topics`
--
CREATE TABLE IF NOT EXISTS `topics` (
`Tid` bigint(20) NOT NULL AUTO_INCREMENT,
`headlinehoofdtekst` varchar(255) NOT NULL,
`headlinekleinetekst` varchar(255) NOT NULL,
`headlineplaatje` text NOT NULL,
PRIMARY KEY (`Tid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=219 ; Voorbeeld: http://www.snabbo.nl/onderhoud/headlines.php
Als het goed is moet het zo werken
je kan het aanpassen maar je mag
Wil je ook graag je mening/cijfer geven
?Alvast bedankt


