Go Back   Computer Forums > Web Design | Website Development > Web Design and Development | Site Reviews
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 03-20-2009, 02:46 PM   #1
Fully Optimized
 
ssc456's Avatar
 
Join Date: Jan 2007
Posts: 4,279
Send a message via MSN to ssc456
Default Website Help

Hey guys,

could do with some website help here.

basically heres my site.

http://mkradio.co.nr

and wat im looking to do is add an input box where to send shout outs they type a message hit submit and it appears on another webpage only viewable by me.

heres an example. http://www.smokintyrezradio.co.uk/listen-now.php
__________________

__________________
He who has never failed has never attempted anything worth succeeding at.

Dont Eat Animals, Its Not Good For Them And They Dont Like It!
ssc456 is offline   Reply With Quote
Old 03-20-2009, 03:30 PM   #2
Fully Optimized
 
vampist's Avatar
 
Join Date: Oct 2008
Location: USA
Posts: 2,404
Default Re: Website Help

You are going to need some PHP.
You also SHOULD and would be easier to do with Mysql.

Now Php is obviously a server side scripting language, Mysql is a database manager that Php can talk to.

I would recommend you do some research on these two subjects before trying this. It could end up being VERY bad.. (spam possibly even viruses).
__________________

vampist is offline   Reply With Quote
Old 03-20-2009, 03:51 PM   #3
j03
~~~~~~~~
 
Join Date: Jan 2005
Location: Wales
Posts: 5,556
Send a message via MSN to j03
Default Re: Website Help

Use a Captcha, and you should be fine. It wont be too hard to code - You could even just have it email the message/"shout" to you?
j03 is offline   Reply With Quote
Old 03-20-2009, 06:55 PM   #4
Site Team
 
David Lindon's Avatar
 
Join Date: Dec 2002
Posts: 15,233
Default Re: Website Help

You should be able to do that with some simple server side scripting - perl/php etc
__________________
[url=http://www.LNXPS.NET]LNXPS.NET - The XPS Library]
David Lindon is offline   Reply With Quote
Old 03-21-2009, 07:49 PM   #5
Fully Optimized
 
tom-knox's Avatar
 
Join Date: Jun 2007
Posts: 2,451
Send a message via MSN to tom-knox
Default Re: Website Help

If it were me i'd just hack up a really simple guestbook script. Change the normal screen to just the input form (sans the previous entries). Then put the entries on another page.

I'll do it for you tomorrow if you still need it.
__________________
New laptop:
2.1 Ghz Core 2 Duo processor :: nVidia GT150m :: 15.6" HD LCD :: 4gb RAM :: 320gb HDD

New player: iPhone 4 32gb
tom-knox is offline   Reply With Quote
Old 03-22-2009, 02:17 PM   #6
Fully Optimized
 
ssc456's Avatar
 
Join Date: Jan 2007
Posts: 4,279
Send a message via MSN to ssc456
Default Re: Website Help

hey guys,

i did what was suggested and i did some research into PHP and ive come up with the below.

Code:
 <form action="result.php" method="post"> 
	     Name: <input name="name" type="text" /> 
		 <br>
		 Message: <input name="message" type="text" /> 
		<input type="submit" value="Send Shout" />
now thats working ok and on the results page i have.

Code:
<?php
$name = $_POST['name'];
$message = $_POST['message'];

echo "Name: ". $name . " <br />";
echo "Message: ". $message . ".<br />";

?>
no problems working fine but i noticed when i click send shout it takes me to the next page to view the shout, is it possible to have it loop back to the same page so that the shout is only viewable by me on the results page.

also if someone sends a shout straight after someone else i will not have chance to read the first one so is there a way to make it a long list of shouts?

i think i do need a modded guest book script but again im still starting out any pre made scripts i could play with would be great

thanks for the help
__________________
He who has never failed has never attempted anything worth succeeding at.

Dont Eat Animals, Its Not Good For Them And They Dont Like It!
ssc456 is offline   Reply With Quote
Old 03-25-2009, 08:13 AM   #7
In Runtime
 
Daeva's Avatar
 
Join Date: Dec 2005
Posts: 407
Send a message via AIM to Daeva Send a message via MSN to Daeva Send a message via Yahoo to Daeva
Default Re: Website Help

you would need a database system to "queue" the orders or at the very least a text file.

Here is an example of a database script you could use on your results page:
PHP Code:
<?
  $conn 
mysql_connect("localhost","userName","password");
  if(!
$conn) { // mysql_connect returns false on failure
    
die("Could not connect to database.  Reason: " mysql_error() ."\n");
  } else {
    
mysql_select_db("databaseName"$conn);
    
$query "INSERT INTO [shoutBox] ([shoutBox_Name],[shoutBox_Message]) VALUES (";
    
$name addslashes($_POST['name']);
    
$message addslashes($_POST['message']);
    
$query .= "'" $name "','" $message "')";
    
$rowsAffected 0;
    
mysql_query($query,$conn);
    
$rowsAffected mysql_affected_rows($conn);
    if (
$rowsAffected 0) {
      echo 
"Your shout was successfully added!\n";
    } else {
      echo 
"Your shout was not added.\n";
    } 
// end if/else
  
// end if/else
?>
Breif explanation:

mysql_connect: connects you to a pre-existing (you'll have to create it and I can show you how) instance of mySQL server with a specified username and password. For security purposes, you should create a seperate login for this database that doesn't have access to the rest of your databases. Also, this login should not have delete permission.

if this succeeds we continue, otherwise we print the reason why and exit.

if we continue, we then select the database we are going to be performing these tasks on.

After this, we build a "query" statement that is the insert statement used on the shoutBox (needs to be created) table (I can help you with this also if you need it).

Once our statement is done, we execute it and find out if it was successful (by calling mysql_affected_rows). If it was successful we will have had at least 1 row changed, otherwise it failed.

This also eliminates your need to re-direct if you don't want them to see it.

Hope this helps.
__________________
**Official Self-proclaimed glorified excessive (insert additional adjectives here) post editor/modifier.
Edit = Best feature ever
http://www.twitter.com/xDaevax
Daeva is offline   Reply With Quote
Old 03-28-2009, 04:54 PM   #8
Fully Optimized
 
ssc456's Avatar
 
Join Date: Jan 2007
Posts: 4,279
Send a message via MSN to ssc456
Default Re: Website Help

ok people im progressing.

i have my shoutbox sorted.

http://mkradio.co.nr

but at the moment i can only view the shouts by going to my phpmyadmin and looking at the database i need some help pulling the info from the database and displaying it
__________________
He who has never failed has never attempted anything worth succeeding at.

Dont Eat Animals, Its Not Good For Them And They Dont Like It!
ssc456 is offline   Reply With Quote
Old 03-30-2009, 08:27 AM   #9
In Runtime
 
Daeva's Avatar
 
Join Date: Dec 2005
Posts: 407
Send a message via AIM to Daeva Send a message via MSN to Daeva Send a message via Yahoo to Daeva
Default Re: Website Help

ok, I see you're running apache. You should (if you don't already) have a password protected directory. To do this, create a new folder in your website. Then create a file called .htaccess
in this file, place the following code:
Code:
AuthUserFile C:/WAMP/www/news/includes/.htpasswd
AuthName "Access to Admin"
AuthType Basic

require valid-user
Where the AuthUserFile is the location to a password file named .htpasswd
AuthName is the title of the box that comes up.

Then, create a file called .htpasswd in the same directory and add a line for every user-account you want to use in this form:

UserName : password
Username2 : password2
etc...
without the spaces between the colon. (smileys show up if I don't put the spaces.)

Once you have that setup on the (private) folder (NOTE* putting this in the root of your website will deny people access to view the site).

in your private folder, create a new php file and connect to the database as before.

establish the connection, call mysql_select_db on your database, then set query equal to something like this:
Code:
SELECT * FROM [myTableName]
where myTableName is the name of your table.

Next, you have to "iterate" through the result set.

[code]
$rs = mysql_query($query,$conn);
//loop through all the rows returned by the query

while ($row = mysql_fetch_array($rs,MYSQL_ASSOC)) {
echo $row['column_name'] . "<br />\n";
} // end while

format that however you want, probably in a table. $row is an associative array with a number of elements equal to the number of columns you have in your database table.

NOTE: Make sure to close your connection to your database!
Code:
mysql_close($conn);
Hope that helps.
__________________

__________________
**Official Self-proclaimed glorified excessive (insert additional adjectives here) post editor/modifier.
Edit = Best feature ever
http://www.twitter.com/xDaevax
Daeva is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 06:59 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0