Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
shoutbox help!

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side
View previous topic :: View next topic  
Author Message
abeja



Joined: 22 Sep 2003
Posts: 803
Location: Rijeka

PostPosted: 02.08.2004 11:38    Post subject: shoutbox help! Add user to your forum ignore list Reply with quote

na stranici http://www.abeja.cosmosart.org/guest.php bi htjela napraviti da kad recimo netko upise samo razmak u sva 3 polja da ne moze poslati poruku..e to bi htjela..ali neznam kako..pa valjda ce netko znati Smile
Back to top
View user's profile Send private message Visit poster's website
maxy



Joined: 07 Sep 2003
Posts: 894
Location: Zagreb

PostPosted: 02.08.2004 11:48    Post subject: Add user to your forum ignore list Reply with quote

standardna procedura - das kod na inspekciju pa ti kazemo Very Happy
ako imas neke podatke o mysql bazi onda to obrisi i stavi ostatak tu.
Back to top
View user's profile Send private message
abeja



Joined: 22 Sep 2003
Posts: 803
Location: Rijeka

PostPosted: 02.08.2004 11:50    Post subject: Add user to your forum ignore list Reply with quote

ok..budem od doma..necu nista brisati..neznam sta bi trebala brisati:)
Back to top
View user's profile Send private message Visit poster's website
abeja



Joined: 22 Sep 2003
Posts: 803
Location: Rijeka

PostPosted: 02.08.2004 12:05    Post subject: Add user to your forum ignore list Reply with quote

maxy wrote:
standardna procedura - das kod na inspekciju pa ti kazemo Very Happy
ako imas neke podatke o mysql bazi onda to obrisi i stavi ostatak tu.


<?php
//Add the shout to the database
//
if( isset($_GET['action']) && $_GET['action'] == "add" )
{
$_POST['message'] = wordwrap($_POST['message'], 35, " ", 1);
if( $_POST['email'] == "Email address" )
$_POST['email'] = "";
$new_line = $_POST['name']."|".$_POST['email']."|".date("Y/m/d H:i")."|".stripslashes(htmlspecialchars($_POST['message'])) . "\n";
if( ! $fp = fopen($text_file,"a") )
echo "Cannot open " . $text_file . "! Check the file rights.";
if( flock( $fp, LOCK_EX ) )
{
fwrite( $fp,$new_line );
flock( $fp, LOCK_UN );
} else {
echo "Couldn't lock the file " . $text_file . "!";
}
header("Location: " . $referer_url );
}
//
/////////////////////////////////////////////


/////////////////////////////////////////////
//Function show_shoutbox.
//This function will print the complete shout
//box.
//
function show_shoutbox($height = 150,$width = 130,$per_page = 5, $font_family="verdana",$font_size=11 )
{
//When there is requested a certain page
if( isset( $_GET['shoutbox_page'] ) )
$shoutbox_page = $_GET['shoutbox_page'];

//If there is no page then the default page is 1
if( empty( $_GET['shoutbox_page'] ) )
$shoutbox_page = 1;

//The database (a little shorter)
$file = $GLOBALS['text_file'];

//Open the file and return error when fail
if( ! $fp = @fopen( $file, "r" ) )
{
echo "Cannot open database file for the shoutbox!";
exit;
}

//Init the output_buffer (string) and the shouts (array)
$output_buffer = "";
$shouts = array();

//When the filesize is greater then null (file contains info)
if( filesize($file) )
{
//Read the file
$fp = fread( $fp, filesize( $file ) );
//all the shouts per line
$shouts = explode("\n",$fp);
//total of shouts
$total_shouts = count($shouts);
//total number of pages
$total_pages = ceil($total_shouts/$per_page);
//set the shout_pointer from where the shouts must be shown
$shout_pointer = (($total_shouts - ($shoutbox_page * $per_page))+$per_page)-1;

//when the requested page is greater then the total_pages, set the page to 1
if( $shoutbox_page > $total_pages )
$shoutbox_page = 1;

//create the page_numbers (the select box)
$output_buffer .= page_numbers( $total_pages , $shoutbox_page );
}
//Else use the default values... (empty shoutbox)
else
{
$shouts = 0;
$total_shouts = 0;
$shout_pointer = 0;
$output_buffer .= page_numbers( 1 , 1 );
}

//Loop through the shouts. descending (Z to A)
for( $i = $shout_pointer ; $i > ($shout_pointer-$per_page); $i-- )
{
//if the value is greater then -1
if( $i > -1 )
{
//if the shouts exists
if( $shouts[$i] )
list( $name, $email, $date, $shout ) = explode("|",$shouts[$i]);

//if the name is not empty
if( !empty( $name ) )
{
//empty the email_start and end
$email_start = "";
$email_end = "";
//if the email is not empty
if( ! empty( $email ) )
{
$email_start = "<a href=\"mailto:" . $email . "\">";
$email_end = "</a>";
}
//add to output buffer
$output_buffer .= "<strong>" . $email_start . $name . $email_end . "</strong>\n<br />" . $shout . "<br /><br />";
}
}
}
?>
<table width="200" >
<form method="post" action="<?=$GLOBALS['shoutbox_url'];?>?action=add">
<tr><td align="center" style="font-family:<?=$font_family;?>; font-size:<?=$font_size;?>px;"><strong>Shoutbox</strong></td></tr>
<tr>
<td>
<div style="<?=$border;?> font-family:<?=$font_family;?>; font-size:<?=$font_size;?>px; height:<?=$height;?>; overflow:auto; padding:3px; width:100%;">
<?=$output_buffer;?>
</div>
</td>
</tr>
<tr>
<td>
<input type="text" name="name" value="Name" style="<?=$border;?> font-family:<?=$font_family;?>; font-size:<?=$font_size;?>px; " onfocus="this.select();"><br />
<input type="text" name="email" value="Email address" style="<?=$border;?> font-family:<?=$font_family;?>; font-size:<?=$font_size;?>px; " onfocus="this.select();"><br />
<input type="text" name="message" value="Message" style="<?=$border;?> font-family:<?=$font_family;?>; font-size:<?=$font_size;?>px;" onfocus="this.select();"><br />
</td>
</tr>
<tr>
<td align="center">
<input type="submit" value="Submit"><br />
<a href="http://www.my-php.tk" target="_blank" style="font-family: verdana; font-size: 9px;">My-PHP.tk</a>
</td>
</tr>
</table>
<?php
}
//
/////////////////////////////////////////////


/////////////////////////////////////////////
//Function page_numbers
//This function will create the select box
//with page numbers to change the page
//
function page_numbers($total_pages,$current = 1)
{
//Get the URL from the address bar
$url_bar = $_SERVER['PHP_SELF']. "?" . $_SERVER['QUERY_STRING'];

//Remove the shoutbox_page=XX from the URL bar
$url_bar = preg_replace( "/(&shoutbox_page=[1-9]+)/","", $url_bar );

//Create a buffer to output this later.
$buffer = "<div align=\"center\">Page: <select onchange=\"javascript: location.href='" . $url_bar . "&amp;shoutbox_page='+this.value;\" style=\"font-family: verdana; font-size: 10px;\">\n";

//Loop through the number of pages.
for( $i = 1 ; $i <= $total_pages ; $i++ )
{
//None selected
$selected = "";
//If the current page is $i, select this option
if( $current == $i )
$selected = "selected=\"selected\"";
//Add output to the buffer
$buffer .= "<option value=\"".$i."\"" . $selected . ">".$i."</option>\n";
}
//Close the output buffer
$buffer .= "</select></div><hr size=\"1\">\n";

//Return the buffer
return $buffer;
}
//
/////////////////////////////////////////////

show_shoutbox();
?>



i samo mi pliz napisi gdje trebam sta ubaciti
Back to top
View user's profile Send private message Visit poster's website
:cosmos:



Joined: 12 Sep 2003
Posts: 2098
Location: México

PostPosted: 02.08.2004 12:08    Post subject: Add user to your forum ignore list Reply with quote

zasto komplicirati? javascript to vrlo jednostavno moze provjeriti, ja ti imam vec gotovu provjeru jer imam slicnu formu, mogu ti sendat, zsto nisi pitala jojojojo Smile

no, ako se nekom da to provjeravat, go4it!
Back to top
View user's profile Send private message Send e-mail Visit poster's website Twitter profile
maxy



Joined: 07 Sep 2003
Posts: 894
Location: Zagreb

PostPosted: 02.08.2004 12:13    Post subject: Add user to your forum ignore list Reply with quote

Code:
//Add the shout to the database
//
if( isset($_GET['action']) && $_GET['action'] == "add" )
{
$_POST['message'] = wordwrap($_POST['message'], 35, " ", 1);
if( $_POST['email'] == "Email address" )
$_POST['email'] = "";
$new_line = $_POST['name']."|".$_POST['email']."|".date("Y/m/d H:i")."|".stripslashes(htmlspecialchars($_POST['message'])) . "\n";
/********************************************************/
/* tu gdje pise guest.php ubaci ime datoteke ili url na kojeg zelis da te redirecta u slucaju greske (ako su ova 3 polja prazna */

if( ($_POST['message'] == " ") || ($_POST['email'] == " ") || ($_POST['name'] == " ")) {
    header('Location: guest.php');
    exit;
}
/******************************************************/
if( ! $fp = fopen($text_file,"a") )
echo "Cannot open " . $text_file . "! Check the file rights.";
if( flock( $fp, LOCK_EX ) )
{
fwrite( $fp,$new_line );
flock( $fp, LOCK_UN );
} else {
echo "Couldn't lock the file " . $text_file . "!";
}
header("Location: " . $referer_url );
}
//
/////////////////////////////////////////////


ovo ubacis na pocetak koda, snaci ces se i guess Smile
Back to top
View user's profile Send private message
abeja



Joined: 22 Sep 2003
Posts: 803
Location: Rijeka

PostPosted: 02.08.2004 12:14    Post subject: Add user to your forum ignore list Reply with quote

:cosmos: wrote:
zasto komplicirati? javascript to vrlo jednostavno moze provjeriti, ja ti imam vec gotovu provjeru jer imam slicnu formu, mogu ti sendat, zsto nisi pitala jojojojo Smile

no, ako se nekom da to provjeravat, go4it!


nista meni tu nije jednostavno..ajd posalji pa cu vidjeti ako cu se snaci:)
Back to top
View user's profile Send private message Visit poster's website
abeja



Joined: 22 Sep 2003
Posts: 803
Location: Rijeka

PostPosted: 02.08.2004 12:15    Post subject: Add user to your forum ignore list Reply with quote

maxy wrote:
Code:
//Add the shout to the database
//
if( isset($_GET['action']) && $_GET['action'] == "add" )
{
$_POST['message'] = wordwrap($_POST['message'], 35, " ", 1);
if( $_POST['email'] == "Email address" )
$_POST['email'] = "";
$new_line = $_POST['name']."|".$_POST['email']."|".date("Y/m/d H:i")."|".stripslashes(htmlspecialchars($_POST['message'])) . "\n";
/********************************************************/
/* tu gdje pise guest.php ubaci ime datoteke ili url na kojeg zelis da te redirecta u slucaju greske (ako su ova 3 polja prazna */

if( ($_POST['message'] == " ") || ($_POST['email'] == " ") || ($_POST['name'] == " ")) {
    header('Location: guest.php');
    exit;
}
/******************************************************/
if( ! $fp = fopen($text_file,"a") )
echo "Cannot open " . $text_file . "! Check the file rights.";
if( flock( $fp, LOCK_EX ) )
{
fwrite( $fp,$new_line );
flock( $fp, LOCK_UN );
} else {
echo "Couldn't lock the file " . $text_file . "!";
}
header("Location: " . $referer_url );
}
//
/////////////////////////////////////////////


ovo ubacis na pocetak koda, snaci ces se i guess Smile



pokusat cu pa javim ako radi..hvala
Back to top
View user's profile Send private message Visit poster's website
maxy



Joined: 07 Sep 2003
Posts: 894
Location: Zagreb

PostPosted: 02.08.2004 12:18    Post subject: Add user to your forum ignore list Reply with quote

:cosmos: wrote:
zasto komplicirati? javascript to vrlo jednostavno moze provjeriti, ja ti imam vec gotovu provjeru jer imam slicnu formu, mogu ti sendat, zsto nisi pitala jojojojo Smile

no, ako se nekom da to provjeravat, go4it!


a sto ako se korisnik ugasi javascript u svom browseru? pogledaj primjer programera (www.programeri.org, topik je na web stranice) gdje ugasis javascript pa onda recimo umjesto od 1-5 mogu davat ocjene 0-5 i sl.

Quote:
pokusat cu pa javim ako radi..hvala


samo vici ak nesto ne radi :>
Back to top
View user's profile Send private message
abeja



Joined: 22 Sep 2003
Posts: 803
Location: Rijeka

PostPosted: 02.08.2004 22:31    Post subject: Add user to your forum ignore list Reply with quote

maxy wrote:
:cosmos: wrote:
zasto komplicirati? javascript to vrlo jednostavno moze provjeriti, ja ti imam vec gotovu provjeru jer imam slicnu formu, mogu ti sendat, zsto nisi pitala jojojojo Smile

no, ako se nekom da to provjeravat, go4it!


a sto ako se korisnik ugasi javascript u svom browseru? pogledaj primjer programera (www.programeri.org, topik je na web stranice) gdje ugasis javascript pa onda recimo umjesto od 1-5 mogu davat ocjene 0-5 i sl.

Quote:
pokusat cu pa javim ako radi..hvala


samo vici ak nesto ne radi :>


radi..tnx:)
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group