SEO Scripts
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   SEO Chat ForumsOtherSEO Scripts

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread SEO Chat Forums Sponsor:
  #1  
Old November 24th, 2005, 03:26 PM
ashrafzia ashrafzia is offline
Registered User
SEO Chat Newbie (0 - 499 posts)
 
Join Date: Nov 2005
Posts: 2 ashrafzia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 8 sec
Reputation Power: 0
Call to undefined function

hello to all:

i have copied the php chat room article and tried but it gives me the following error:

Parse error: syntax error, unexpected '{' in C:\apachefriends\xampp\htdocs\xampp\chat\chat.php on line 41


can any body help whats wrong?



PHP Code:
<?

if (empty($action))

ShowLoginForm();

elseif (
$action == "posts")

ShowAddPosts();

elseif (
$action == "form")

GetInput();

elseif (
$action == "enter")

Login();

function 
ShowLoginForm() {

?>

<b>Enter Your NickName</b>

<form name="chat" method="post" action="chat.php" target="_top">

<input type="text" name="nick" size="20">

<input type="hidden" name="action" value="enter">

<input type="hidden" name="chat" value="<font color=FF0000><b>Enters the Room</b></font>">

<input type="submit" name="Submit" value="Submit">

</form>

<?php

}

ShowAddPosts()  {

global 
$HTTP_SESSION_VARS;

global 
$chat;

global 
$nick;

print 
'<meta http-equiv="refresh" content="10;URL=chat.php?action=posts&nick=<?php echo $nick; ?>">';

$svrConn mysql_connect("localhost""ashraf""zia") or die("<b>Error:</b> Couldnt connect to database");

$dbConn mysql_select_db("chat"$svrConn) or die ("<b>Error:</b> Couldnt connect to database");

}

if(!empty(
$chat)) {

$strQuery "insert into chatScript values(0, '$chat', '$nick')";

mysql_query($strQuery);

}

$strQuery "select theText, theNick from chatScript order by pk_Id desc limit 20";

$chats mysql_query($strQuery);

while(
$chatline mysql_fetch_array($chats)) {

print 
"<b>" $chatline["theNick"] . ":</b> " swapFaces($chatline["theText"]) . "<br>";

}

function 
swapFaces($chatLine) {

$chatLine str_replace(":)""<img src='smile.gif'>"$chatLine);

$chatLine str_replace(":(""<img src='frown.gif'>"$chatLine);

$chatLine str_replace(":D""<img src='bigsmile.gif'>"$chatLine);

return 
$chatLine;

}


function 
Login() {

global 
$chat;

global 
$nick;

session_start();

session_register("nick"$nick);

?>

<frameset rows="563,62" cols="*">

<frame name="posts" src="chat.php?action=posts&nick=<?php echo $nick?>&chat=<?php echo $chat?>">

<frame name="form" src="chat.php?action=form&nick=<?php echo $nick?>">

</frameset>

<noframes>

<body>

<p>This page uses frames, but your browser doesn't support them.</p>

</body>

</noframes>

</frameset>

<?php

}

function 
GetInput() {

global 
$HTTP_SESSION_VARS;

global 
$chat;

global 
$nick;

?>

<form onSubmit="return doSubmit" name="chatform" method="post" action="chat.php" target="posts">

<input type="text" name="chat">

<input type="hidden" name="nick" value="<?php echo $nick?>">

<input type="button" onClick="doSubmit()" name="Submit" value="Say">

<select name="col">

<option>Black</option>

<option>Red</option>

<option>Green</option>

<option>Blue</option>

<option>Orange</option>

</select>

<input type="button" name="DoFace1" value=" :) " onClick="sendFace(1)">

<input type="button" name="DoFace2" value=" :( " onClick="sendFace(2)">

<input type="button" name="DoFace3" value=" :D " onClick="sendFace(3)">

<input type="hidden" name="action" value="posts">

</form>

<script language="JavaScript">

function sendFace(faceNum)

{

switch(faceNum)

{

case 1:

document.chatform.chat.value = ':)';

break;

case 2:

document.chatform.chat.value = ':(';

break;

case 3:

document.chatform.chat.value = ':D';

break;

}



document.chatform.submit();

document.chatform.chat.value = '';

}

function doSubmit()

{

if(document.chatform.chat.value == '') {

alert('Please enter some text!');

document.chatform.chat.focus();

return false;

}

document.chatform.chat.value = '<font color="'+document.chatform.col[document.chatform.col.selectedIndex].text+'">'+document.chatform.chat.value+'</font>';

document.chatform.submit();

document.chatform.chat.value = '';

document.chatform.chat.focus();

return true;

}

</script>

<?php

}

?>

Reply With Quote
  #2  
Old November 26th, 2005, 02:55 PM
mrkryz03 mrkryz03 is offline
Contributing User
SEO Chat Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Location: NYC
Posts: 143 mrkryz03 User rank is Lance Corporal (50 - 100 Reputation Level)mrkryz03 User rank is Lance Corporal (50 - 100 Reputation Level)mrkryz03 User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 4 Days 13 h 16 m 44 sec
Reputation Power: 5
Simple fix:

Change line 41 from:
Code:
ShowAddPosts()  {


to
Code:
function ShowAddPosts()  {


**Edit -> Email me at info@cjkcybermedia.com for an important issue with your code above. Hint: I recommend you delete the code you posted and apply the fix I gave you.

Last edited by mrkryz03 : November 26th, 2005 at 02:58 PM.

Reply With Quote
  #3  
Old November 26th, 2005, 10:33 PM
ashrafzia ashrafzia is offline
Registered User
SEO Chat Newbie (0 - 499 posts)
 
Join Date: Nov 2005
Posts: 2 ashrafzia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 8 sec
Reputation Power: 0
Unhappy

Quote:
Originally Posted by mrkryz03
Simple fix:

Change line 41 from:
Code:
ShowAddPosts()  {


to
Code:
function ShowAddPosts()  {


**Edit -> Email me at info@cjkcybermedia.com for an important issue with your code above. Hint: I recommend you delete the code you posted and apply the fix I gave you.


Thanx for Reply:
I have fixed that problem and the next problem is the following error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\apachefriends\xampp\htdocs\xampp\chat\chat.php on line 71

i have checked the script but didn't find any solution.

Reply With Quote
  #4  
Old November 26th, 2005, 10:40 PM
mrkryz03 mrkryz03 is offline
Contributing User
SEO Chat Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Location: NYC
Posts: 143 mrkryz03 User rank is Lance Corporal (50 - 100 Reputation Level)mrkryz03 User rank is Lance Corporal (50 - 100 Reputation Level)mrkryz03 User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 4 Days 13 h 16 m 44 sec
Reputation Power: 5
Quote:
Originally Posted by ashrafzia
Thanx for Reply:
I have fixed that problem and the next problem is the following error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\apachefriends\xampp\htdocs\xampp\chat\chat.php on line 71

i have checked the script but didn't find any solution.


Your using php 5.x right? ill post a fix in the morning as i cant se estraight right now lol

Reply With Quote
  #5  
Old November 27th, 2005, 10:09 AM
mrkryz03 mrkryz03 is offline
Contributing User
SEO Chat Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Location: NYC
Posts: 143 mrkryz03 User rank is Lance Corporal (50 - 100 Reputation Level)mrkryz03 User rank is Lance Corporal (50 - 100 Reputation Level)mrkryz03 User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 4 Days 13 h 16 m 44 sec
Reputation Power: 5
Did you set up the database and the tables correctly? username/password etc? Post the table structure and types... or the script you used to create.

Reply With Quote
Reply

Viewing: SEO Chat ForumsOtherSEO Scripts > Call to undefined function


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 9 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek