|
Having a little bit of a problem with my blog script
Having a little bit of a problem with my blog script
Currently viewing this thread: 1 (0 members and 1 guests)
 July 20th, 2004 03:51 AM
Having a little bit of a problem with my blog script
hi there, im working on making a really simple blog for me... its viewable at http://www.eblinger.com/blog
What im wanting to do, is when it posts, instead of posting plain text, I Wwould like it to post inside of the contents box which is viewable below the text... the file that posts the stuff is called sys.php, but when I opened it, it didnt look like I could add HTML to it, so when it posted it would post with the content box around it...
someone please help/
 July 20th, 2004 04:30 AM
Can we see your post page?
 July 20th, 2004 04:41 AM

I believe this is the code for it... if this is what u want
<?
if(isset($_POST['user'])) {
$mypassword = "" ;
}
else {
//////// Change you password here
$mypassword = "password";
}
if($HTTP_POST_VARS['password'] == $mypassword) {
if(isset($_POST['edita'])) {
if($HTTP_POST_VARS['mood']=='' || $HTTP_POST_VARS['blogspaceone']==''){
echo "<td height='475' width='100%' valign='center'> <strong><font size='2' face='Tahoma'>You
left one of the required feilds blank. Please go back and fix this.</font></strong></td>";
}
elseif($HTTP_POST_VARS['mood']=='|' || $HTTP_POST_VARS['mood']=='\n' || $HTTP_POST_VARS['blogspaceone']=='|' || $HTTP_POST_VARS['blogspaceone']=='\n'){
echo "<td height='475' width='100%' valign='center'> <strong><font size='2' face='Tahoma'>No feilds can contain the pipe symbol! Please go back and fix this.</font></strong></td>";
}
else {
$filename = '../data/file.txt';
$fp = fopen( $filename, 'r' );
$file_contents = fread( $fp, filesize( $filename ) );
fclose( $fp );
$line = explode("\n", $file_contents);
$arraysize = count ($line);
$i = $_POST['number'];
$entry = explode("|", $line[$i]);
$entry[1] = $_POST['mood'];
function add_smileys($content) {
$filename = '../data/smiley.txt';
$fp = fopen( $filename, 'r' );
$file_contents = fread( $fp, filesize( $filename ) );
fclose( $fp );
$lines = explode("\n", $file_contents);
$numlines = count($lines) ;
for ($i = 0; $i < $numlines; $i++) {
$line = explode("!", $lines[$i]);
$content = str_replace(trim($line[1]), "<img src=images/".trim($line[0])." border=0 alt=\"\">", $content);
}
return $content;
}
$entry[3] = str_replace("\n", "<br>", $_POST['blogspaceone']);
$new = add_smileys($entry[3]);
$edited = stripslashes($new);
$line[$i] = $entry[0] . "|" . "<b>Mood: </b>" . $entry[1] . "<br>|" . $entry[2] . "|" . $edited . "<br><br><br>";
$finish = implode("\n", $line);
$fp = fopen( $filename, 'w' );
fwrite( $fp, $finish );
fclose( $fp );
print "<center><b>Entry edited successfully</b><br><br><a href=../confirm.php>Click here for results</a></center>";
}
}
if(isset($_POST['newa'])) {
if($HTTP_POST_VARS['mood']=='' || $HTTP_POST_VARS['blogspaceone']==''){
echo "<b><center>You left one of the required feilds blank. Please go back and fix this.</b></center>";
}
elseif($HTTP_POST_VARS['mood']=='|' || $HTTP_POST_VARS['mood']=='\n' || $HTTP_POST_VARS['blogspaceone']=='|' || $HTTP_POST_VARS['blogspaceone']=='\n'){
echo "<center><b>No feilds can contain the pipe symbol! Please go back and fix this.</b></center>";
}
else {
$date = date("m.d.y g:i a");
$name = stripslashes($_POST['name']);
$mood = stripslashes($_POST['mood']);
$temp = stripslashes($_POST['blogspaceone']);
function add_smileys($content) {
$filename = '../data/smiley.txt';
$fp = fopen( $filename, 'r' );
$file_contents = fread( $fp, filesize( $filename ) );
fclose( $fp );
$lines = explode("\n", $file_contents);
$numlines = count($lines) ;
for ($i = 0; $i < $numlines; $i++) {
$line = explode("!", $lines[$i]);
$content = str_replace(trim($line[1]), "<img src=images/".trim($line[0])." border=0 alt=\"\">", $content);
}
return $content;
}
$_1 = add_smileys($temp) ;
$new = str_replace("\n", "<br>", $_1);
$file = "../data/file.txt";
$file_point = fopen($file, "r");
$file_read = fread($file_point, filesize($file));
$old = $file_read;
fclose($file_point);
$file_name = "../data/file.txt";
$file_pointer = fopen($file_name, "w+");
if ($old == ""){
$oldstuff = "";
}
else {
$oldstuff = "<BR><BR>\n" . $old;
}
$combine = "<b>-" . $name . "</b><br>|<b>Mood: </b>" . $mood . "<BR>|<I>" . $date . "</i><br>|" . $new . "<br><br><br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=<br><br>" . $oldstuff;
fwrite($file_pointer, $combine);
print "<center><b>Entry added successfully</b><br><br><a href=../confirm.php>Click here for results</a></center>";
fclose($file_pointer);
}
}
if(isset($_POST['user'])) {
if($HTTP_POST_VARS['mood']=='' || $HTTP_POST_VARS['blogspaceone']==''){
echo "<b><center>You left one of the required feilds blank. Please go back and fix this.</b></center>";
}
elseif($HTTP_POST_VARS['mood']=='|' || $HTTP_POST_VARS['mood']=='\n' || $HTTP_POST_VARS['blogspaceone']=='|' || $HTTP_POST_VARS['blogspaceone']=='\n'){
echo "<center><b>No feilds can contain the pipe symbol! Please go back and fix this.</b></center>";
}
else {
$date = date("m.d.y g:i a");
$name = stripslashes($_POST['name']);
$mood = stripslashes($_POST['mood']);
$temp = stripslashes($_POST['blogspaceone']);
function add_smileys($content) {
$filename = '../data/smiley.txt';
$fp = fopen( $filename, 'r' );
$file_contents = fread( $fp, filesize( $filename ) );
fclose( $fp );
$lines = explode("\n", $file_contents);
$numlines = count($lines) ;
for ($i = 0; $i < $numlines; $i++) {
$line = explode("!", $lines[$i]);
$content = str_replace(trim($line[1]), "<img src=images/".trim($line[0])." border=0 alt=\"\">", $content);
}
return $content;
}
$_1 = add_smileys($temp) ;
$new = str_replace("\n", "<br>", $_1);
$file = "../data/users.txt";
$file_point = fopen($file, "r");
$file_read = fread($file_point, filesize($file));
$old = $file_read;
fclose($file_point);
$file_name = "../data/users.txt";
$file_pointer = fopen($file_name, "w+");
if ($old == ""){
$oldstuff = "";
}
else {
$oldstuff = "<BR><BR>\n" . $old;
}
$combine = "<b>-" . $name . "</b><br>|<b>Mood: </b>" . $mood . "<BR>|<I>" . $date . "</i><br>|" . $new . "<br><br><br>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=<br><br>" . $oldstuff;
fwrite($file_pointer, $combine);
print "<center><b>Entry added successfully</b><br><br><a href=../read.php>Click here for results</a></center>";
fclose($file_pointer);
}
}
if(isset($_POST['alinka'])) {
$filename = '../data/links.txt';
$fp = fopen( $filename, 'r' );
$file_contents = fread( $fp, filesize( $filename ) );
fclose( $fp );
$lines = explode("\n", $file_contents);
$numlines = count($lines) ;
$_1 = "<li><a href=";
$_2 = " title=item ";
$_3 = "><span>·</span> ";
$_4 = "</a></li>";
$tempname = $_POST['name'];
$tempaddress = $_POST['address'];
for ($i = 0; $i <= $numlines; $i++) {
if($i == $numlines){
$i++;
$z = $i;
break;
}
}
if ($file_contents == ""){
$foo = $file_contents;
}
else {
$foo = $file_contents . "\n";
}
$new = $foo . $_1 . $tempaddress . $_2 . $z . $_3 . $tempname . $_4;
$link = "<a href='../acc.html'>Return to ACC</a>";
echo "<center><b>Link Added Successfully<br>" . $link . "</b><center>";
$fp = fopen( $filename, 'w' );
fwrite( $fp, $new );
fclose( $fp );
}
if(isset($_POST['aimagea'])) {
if($HTTP_POST_VARS['name']==''){
echo "<b><center>You left one of the required feilds blank. Please go back and fix this.</b></center>";
}
else {
$name = $_POST['name'];
$file = "../data/images.txt";
$file_point = fopen($file, "r");
$file_read = fread($file_point, filesize($file));
$old = $file_read;
fclose($file_point);
$file_pointer = fopen($file, "w+");
$combine = $old . "\n" . $name;
fwrite($file_pointer, $combine);
print "<center><b>Photo added successfully</b><br><br><a href=../acc.html>Click here to return to ACC</a></center>";
fclose($file_pointer);
}
}
if(isset($_POST['asmileya'])) {
if($HTTP_POST_VARS['name']=='' || $HTTP_POST_VARS['text']==''){
echo "<b><center>You left one of the required feilds blank. Please go back and fix this.</b></center>";
}
else {
$name = $HTTP_POST_VARS['name'];
$text = $HTTP_POST_VARS['text'];
$file = "../data/smiley.txt";
$file_point = fopen($file, "r");
$file_read = fread($file_point, filesize($file));
$lines = explode("\r\n", $file_read);
$arraysize = count($lines);
$foo = 0;
for ($i=0 ; $i<$arraysize ; $i++) {
$line = explode("!", $lines[$i]);
if ($text == $line[1]) {
$foo = 1;
break ;
}
}
if ($foo == 1) {
echo "<b><center>The text you choose:</b> " . $text . "<b> is already in use. Please go back and select a new one.</b></center>";
}
else {
fclose($file_point);
$file_pointer = fopen($file, "w+");
$combine = $file_read . "\r\n" . $name . "!" . $text;
$filepath = "../images/" . $name;
fwrite($file_pointer, $combine);
print "<center><b>Smiley added successfully</b><br><br><a href=../acc.html>Click here to return to ACC</a></center>";
fclose($file_pointer);
}
}
}
if(isset($_POST['rentry'])) {
$link = "<a href='../acc.html'>Return to ACC</a>";
$filename = '../data/file.txt';
$fp = fopen( $filename, 'r' );
$file_contents = fread( $fp, filesize( $filename ) );
fclose( $fp );
$lines = explode("\n", $file_contents);
$i = $_POST['entrynumber'];
$oldarraysize = count($lines);
if ($oldarraysize == 1) {
echo "<center><b>There are now no entries left<br>" . $link . "<br><br></b></center>This is NOT an error...";
}
else {
echo "<center><b>The entry was removed<br>" . $link . "</center>";
}
for ($a=0 ; $a<$i ; $a++ ) {
$foo[$a] = $lines[$a];
}
$b = $i+1;
for ($a=$i ; $a<$oldarraysize-1 ; $a++ ) {
$foo[$a] = $lines[$b];
$b++;
}
$arraysize = count($foo);
$fp = fopen( $filename, 'w' );
for ($a=0 ; $a<$arraysize ; $a++ ) {
if ($a == $arraysize-1) {
fwrite( $fp, $foo[$a]);
}
else {
fwrite( $fp, $foo[$a]."\n" );
}
}
fclose( $fp );
}
if(isset($_POST['rimage'])) {
$filename = '../data/images.txt';
$fp = fopen( $filename, 'r' );
$file_contents = fread( $fp, filesize( $filename ) );
fclose( $fp );
$lines = explode("\n", $file_contents);
$i = $_POST['image'];
$oldarraysize = count($lines);
for ($a=0 ; $a<$i ; $a++ ) {
$foo[$a] = $lines[$a];
}
$b = $i+1;
for ($a=$i ; $a<$oldarraysize-1 ; $a++ ) {
$foo[$a] = $lines[$b];
$b++;
}
$arraysize = count($foo);
$fp = fopen( $filename, 'w' );
for ($a=0 ; $a<$arraysize ; $a++ ) {
if ($a == $arraysize-1) {
fwrite( $fp, $foo[$a]);
}
else {
fwrite( $fp, $foo[$a]."\n" );
}
}
fclose( $fp );
$line = explode("!", $lines[$i]);
$link = "<a href='../acc.html'>Return to ACC";
echo "<center><b>The image was removed<br>" . $link . "</center>";
}
if(isset($_POST['rlinka'])) {
$link = "<a href='../acc.html'>Return to ACC</a>";
$filename = '../data/links.txt';
$fp = fopen( $filename, 'r' );
$file_contents = fread( $fp, filesize( $filename ) );
fclose( $fp );
$lines = explode("\n", $file_contents);
$i = $_POST['link'];
$oldarraysize = count($lines);
if ($oldarraysize == 1) {
echo "<center><b>There are now no links left<br>" . $link . "<br><br></b></center>This is NOT and error...";
}
else {
echo "<center><b>The link was removed<br>" . $link . "</center>";
}
for ($a=0 ; $a<$i ; $a++ ) {
$foo[$a] = $lines[$a];
}
$b = $i+1;
for ($a=$i ; $a<$oldarraysize-1 ; $a++ ) {
$foo[$a] = $lines[$b];
$b++;
}
$arraysize = count($foo);
$fp = fopen( $filename, 'w' );
for ($a=0 ; $a<$arraysize ; $a++ ) {
if ($a == $arraysize-1) {
fwrite( $fp, $foo[$a]);
}
else {
fwrite( $fp, $foo[$a]."\n" );
}
}
fclose( $fp );
$line = explode("!", $lines[$i]);
}
if(isset($_POST['rsmileya'])) {
$filename = '../data/smiley.txt';
$fp = fopen( $filename, 'r' );
$file_contents = fread( $fp, filesize( $filename ) );
fclose( $fp );
$lines = explode("\n", $file_contents);
$i = $_POST['smiley'];
$oldarraysize = count($lines);
for ($a=0 ; $a<$i ; $a++ ) {
$foo[$a] = $lines[$a];
}
$b = $i+1;
for ($a=$i ; $a<$oldarraysize-1 ; $a++ ) {
$foo[$a] = $lines[$b];
$b++;
}
$arraysize = count($foo);
$fp = fopen( $filename, 'w' );
for ($a=0 ; $a<$arraysize ; $a++ ) {
if ($a == $arraysize-1) {
fwrite( $fp, $foo[$a]);
}
else {
fwrite( $fp, $foo[$a]."\n" );
}
}
fclose( $fp );
$line = explode("!", $lines[$i]);
$link = "<a href='../acc.html'>Return to ACC";
if ($oldarraysize == 1) {
echo "<center><b>There are now no links left<br>" . $link . "<br><br></b></center>This is NOT and error...";
}
else {
echo "<center><b>This smiley was removed:</b> " . $line[1] . "<br>" . $link . "</center>";
}
}
if(isset($_POST['cpw'])) {
echo "<center><b>To change your password open sys.php</b></center>";
}
}
else {
echo "<center><b>PASSWORD INCORRECT!</b>";
}
 July 20th, 2004 05:08 AM
Oh wow... you use a flat file. I'm not good with flat files so I wont be able to help you. 
 July 20th, 2004 05:28 AM
Neversidian
Status: Offline!
if that file wasnt 80,000 lines long i would help you.
___________________
Neverside Development Director
PHP Snippets
BigToach.com - IT WORKS, TOACHY!
 July 20th, 2004 09:44 AM
so, I cant get no help or what?...
Im willing to switch blog scripts, but I need one that is simple
basic blog script, that is customizable that I can integrate into my design, and supports multiple users
 July 20th, 2004 01:29 PM
Neversidian
Status: Offline!
Well, its kinda hard to go through so much code and look for errors.
I'd just suggest you use a premade script such as Textpattern or Wordpress.
___________________
"Hey, **** YOU!"
 July 20th, 2004 06:32 PM
That code is for the administration side of the blog script. You need to post the script that loads the stuff from the file.
___________________

 July 20th, 2004 07:05 PM
whoa, wtf?
Status: Offline!
Or get livejournal's source if you wouldn't mind perl. Also, google some syntax conventions man, indent or something.
___________________
Fomerly known as lasnaranjas. Holler.

 July 20th, 2004 07:39 PM
Originally posted by lasnaranjas
Or get livejournal's source if you wouldn't mind perl. Also, google some syntax conventions man, indent or something.
He didn't write the script. and if you leave the indents on when posting it here it goeas all distorted (line lengths etc).
Try www.hotscripts.com for a MySQL script.
___________________

|