You are not logged in.

  • Login
  • "Tsu_G_" started this thread

Posts: 3,935

Location: Berlin

Occupation: /dev/random

  • Send private message

1

Saturday, August 7th 2004, 5:43am

[PHP] Allgemeines Problem

Hallo,
folgendes Problem:
Ab einer bestimmten Länge werden die GB (=Gästebuch)-Einträge nichtmehr ordnungsgemäß in die Datenbank übertagen (d.h. sie kommen dort überhaupt nicht an). Bei den News geht das ohne Probleme. Ich hoffe darauf, dass jemand mehr Ahnung hat als ich (dürfte jawohl nicht schwer sein), oder zumindest Hilfe gibt.
Danke im vorraus. http://www.rtw-crew.de/ (vll. hilft es).

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
[QUOTE]<?php

if($act == "add"){
	include("add_guestbook_entry.php");
}
elseif($act == "submit" && $action == "Abschicken") {
	if(trim($author) == "" || trim($content) == "") {
		redirectTo("?page=guestbook&act=add". $config['session_id'],$page,0);		
	}
	else {
		$author = addslashes($author);
		$email = addslashes($email);
		$homepage = addslashes($homepage);
		$title = addslashes($title);
		$content = addslashes($content);
		mysql_query("INSERT INTO $tab_gb (timestamp, author, email, homepage, title, content, ip) VALUES ('$timestamp', '$_REQUEST[author]', '$_REQUEST[email]', '$_REQUEST[homepage]', '$_REQUEST[title]', '$_REQUEST[content]', '$ip')");
		redirectTo("?page=guestbook". $config['session_id'],$page,1);
	}
}
else {
	##get_pagination($entriesperpage,$tab_gb,"guestbook");

$linesperpage = $entriesperpage;
$tab = $tab_gb;
$section = "guestbook";

		$offset = $HTTP_GET_VARS['offset'];

		$counter = mysql_query("SELECT Count(*) as total FROM $tab");

		$lines = mysql_fetch_array($counter);

		if(!$HTTP_GET_VARS['offset']) {
			$offset = 0;
		}
		else {
			$offset = $HTTP_GET_VARS['offset'];
		}

		$thisentry = $offset;

		$offset = "0";
		$page = "1";

		$page_output = "";
		$offset = $thisentry;

		$current_site = ($thisentry+$linesperpage)/$linesperpage;
		$page = $current_site-$maxsites;
		if($page < 1) {
			$page = 1;   
		}  
		$offset = ($page*$linesperpage)-$linesperpage;
		if($page < 1) {
			$page = 1;   
		}  
		if($page > 1) { 
			$page_output = $page_output."<a href="?page=".$section."&offset=0". $config['session_id'] ."" title='Seite 1'>1</a> << \n";
		}
		while($offset < $lines['total']) {
			if($offset == $thisentry) {
				$page_output = $page_output." <b>[".$page."]</b> ";
			}
			else {    
				$page_output = $page_output." <a href="?page=".$section."&offset=".$offset."". $config['session_id'] ."" title='Seite ".$page."'>$page</a>\n";
			}
			$offset = ($offset+$linesperpage);
			$page = $page+1;
			if($page > ($current_site+$maxsites)) {
				$page_output = $page_output." >> ";
				break;
			}   
		}
		$offset = $thisentry;
		$page_prev = $offset-$linesperpage;
		$page_prev_link = "<a href="?page=".$section."&offset=".$page_prev."". $config['session_id'] ."" title='Vorherige Seite'>«</a>\n";
		$page_next = $offset+$linesperpage;
		$page_next_link = "<a href="?page=".$section."&offset=".$page_next."". $config['session_id'] ."" title='Nächste Seite'>»</a>\n";





echo "		  <p align="center"><b>[ <a href="?page=guestbook&act=add". $config['session_id'] ."" title="Hier klicken um einen Eintrag in das Gästebuch zu machen.">Ins Gästebuch eintragen</a> ]</b></p>\n";
echo "		  <table border="0" cellpadding="3" cellspacing="0" width="100%" align="center" class='table_in_content'>
		    <tr class='cat_head'>
		      <td height="15" width="150" class='brightbottom'>
			<b>Autor</b>
		      </td>
		      <td height="15" class='bbottom'>
			<b>Eintrag</b>
		      </td>
		    </tr>\n";

if(isset($id) && $id != "") {
	$querystring = "SELECT * FROM $tab_gb WHERE id=$id";
}
else {
	$querystring = "SELECT * FROM $tab_gb ORDER BY timestamp DESC LIMIT $offset,$entriesperpage";
}
$get_gbentries = mysql_query($querystring);
if(mysql_num_rows($get_gbentries) == 0) {
	if(isset($id) && $id != "") {
		echo "<p align="center">Der Gästebuch-Eintrag mit der ID <b>".$id."</b> existiert nicht.</p>\n";	
	}
	else {
		echo "<p align="center">Noch keine Gästebuch-Einträge vorhanden.</p>\n";
	}
}
while($gb = mysql_fetch_array($get_gbentries)) {
	if($bgcolor == "#ffffff") {
		$bgcolor = "#f9f9f9";
	}
	else {
		$bgcolor = "#ffffff";
	}
	echo "		    <tr bgcolor='".$bgcolor."'>
		      <td width="150" valign="top" class='bright'>\n";
	if($gb[email] != "") {
		echo "		        <a href="mailto:".formatpost($gb[email])."" title="Hier klicken um '".formatpost($gb[author])."' eine Email zu schicken.">".formatpost($gb[author])."</a>\n";
	}
	else {
		echo "		        <b>".formatpost($gb[author])."</b>\n";
	}
	echo "		      </td>
		      <td valign="top" height="15" class='bbottom'>
			<small><b>» ";
	if(trim($gb[title]) == "")
	  echo "</b>kein Titel<b>";
        else
	  echo formatpost($gb[title]);

echo "</b></small>
		      </td>
		    </tr>
		    <tr bgcolor='".$bgcolor."'>
		      <td width="150" valign="top" class='brightbottom'>
			<small>".formatdate(date("d. F Y, H:i",$gb[timestamp]))."<br><br>
			".$gb[ip]."<br><br>
			#".$gb[id]."<br><br>";
	if($gb[homepage] != "" && $gb[homepage] != "http://") {
		echo "			<a href="?page=redirect&url=".formatpost($gb['homepage']).$config['session_id']."" target="_blank" title="Hier klicken um die Homepage von '".formatpost($gb[author])."' anzusehen.">Homepage</a><br><br>\n";
		$show = "redirect";

	}

echo "</small>
		      </td>
		      <td valign="top" class='bbottom'>
		        ".convert_bb_code(formatpost($gb[content]))."
		      </td>
		    </tr>\n";
}

echo "		  </table>";
echo "<p align="left">";
if(!isset($id)) {
  if(mysql_num_rows(mysql_query("SELECT * FROM $tab_gb")) > $entriesperpage) {
    output_pagination();
  }
}
else {
	echo "<img src='images/arrow.gif' height='8' width='5' alt=''> <a href="?page=guestbook". $config['session_id'] ."">Alle Einträge anzeigen</a>";
}
echo "<br><br></p>";

}

?>
[/QUOTE]

Das Forum SUCKT! "CODE" und "PHP" nicht möglich,

This post has been edited 3 times, last edit by "Tsu_G_" (Aug 7th 2004, 5:54am)


2

Saturday, August 7th 2004, 2:30pm

Ist die Kolumne (Spalte) für genug Zeichen ausgelegt?

3

Saturday, August 7th 2004, 2:36pm

Schreib mal dort:
mysql_query("INSERT INTO $tab_gb (timestamp, author, email, homepage, title, content, ip) VALUES ('$timestamp', '$_REQUEST[author]', '$_REQUEST[email]', '$_REQUEST[homepage]', '$_REQUEST[title]', '$_REQUEST[content]', '$ip')");

or die(mysql_query()) am Schluss dazu, aber ich vermute mal dass das $ vor dem tab_gb der Fehler ist, und es deshalb nicht geht.[/email]

This post has been edited 2 times, last edit by "Tsu_Cortes" (Aug 7th 2004, 2:37pm)


4

Saturday, August 7th 2004, 2:37pm

omg :rolleyes:

1. Benutze explizit Post statt Reuqest (ist aber nur ne kleinigkeit)

2. Ist das Forumlar mit POST ?

3. Welcher Typ hat die DB-Spalte ? Nimm am besten Blobb, kein varchar (das kann nur max. 255 zeichen)

cya max

5

Saturday, August 7th 2004, 2:38pm

Quoted

Original von Tsu_Cortes
Schreib mal dort:
mysql_query("INSERT INTO $tab_gb (timestamp, author, email, homepage, title, content, ip) VALUES ('$timestamp', '$_REQUEST[author]', '$_REQUEST[email]', '$_REQUEST[homepage]', '$_REQUEST[title]', '$_REQUEST[content]', '$ip')");

or die(mysql_query()) am Schluss dazu, aber ich vermute mal dass das $vor dem tab_gb nur ein Tippfehler ist, und es deshalb nicht geht.[/quote]

omg, wenn man keine Ahnung hat...

Schreibe :

mysql_query(blabla) or die(mysql_errno().' : '.mysql_error());[/email]

6

Saturday, August 7th 2004, 2:42pm

Quoted

Original von SiA_MaxPower
omg :rolleyes:

1. Benutze explizit Post statt Reuqest (ist aber nur ne kleinigkeit)

2. Ist das Forumlar mit POST ?

3. Welcher Typ hat die DB-Spalte ? Nimm am besten Blobb, kein varchar (das kann nur max. 255 zeichen)

cya max


edit: ok, Formular ist Post und hab eben einen sehr langen text gepostet, das hat gefunzt.

Hast du schon was verändert ?

7

Saturday, August 7th 2004, 2:54pm

Ich habe im Prinzip das selbe gemeint wie du, nur eben nicht so gut ausgedrückt und mit Fehlernummer ist zwar professioneller, aber mit denen kann ich zumindest nicht sehr viel anfangen.