Follow us on Twitter!
Few are those who can see with their own eyes and hear with their own hearts. - Albert Einstein
Wednesday, April 23, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 21
Guests Online: 20
Members Online: 1

Registered Members: 82885
Newest Member: ConiBE
Latest Articles
View Thread

HellBound Hackers | Computer General | Webmasters Lounge

Author

php and mysql problems


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 22-02-08 12:47
hey guys

i got 2 problems that are bugging me like hell.

1st problem

on my submit page i have this,
Parse error: parse error, unexpected T_ELSE in submit.php on line 25, all that is on line 25 is , else, how can i sort this out??

2nd problem

on my chatlog page i have this,
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(*) as messagecount from chatmessages' at line 1,
how can i sort this one out??

im still learning PHP and MySQL

cheers in advance

engelavdod



Author

RE: php and mysql problems

mido
Member

Your avatar

Posts: 613
Location: Cairo, Egypt
Joined: 27.01.07
Rank:
Monster
Posted on 22-02-08 12:56
For the first problem : That error means that you've put an "else" statement, unexpectedly. Like :
if (!$thing)
{
//code
}

else
{
//normal code....
}

else // bad statement
{
//won't be executed and outcome error.
}

Or even, a lonely "else" without an "if" above.

And for the second problem, show me the query, and the PHP code. (actually for the first problem too).


www.hellboundhackers.org/sig/r/16019.png

mido_eg3[at]hotmail.com
Author

RE: php and mysql problems


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 22-02-08 13:04
cheers for the reply dude

heres the code for the submit page

Code
<?php

include "connect.php";

if(isset($_POST['submit'])) // if submit button push has been detected

{

   $message=$_POST['message'];
   $name=$_POST['name'];
   if(strlen($message)<1)
   
   {
      print "You did not input a message";
      
   }
   
   else if(strlen($name)<1);
   
   {
      print "You did not enter a name, please try again.";
      
   }
   
   else
   
   {
      $message=strip_tags($message);
      $IP=$_SERVER["REMOTE_ADDR"]; //grabs posters IP
      $checkforbanned=("SELECT IP from ipbans where IP='$IP'");
      $checkforbanned2=mysql_query($checkforbanned) or die("Could not check for banned IPS");
      if(mysql_num_rows($checkforbanned2)>0) //IP is in the banned list
      
      {
         print "Your IP is banned from posting.";
      }
      
      else
      
      {
      
         $thedate = date("U"); // grab data and time of the post
         $insertmessage=("INSERT into chatmessages (name,IP,postime,message) values('$name','$ip','$thedate','$message')";
         mysq_query($insertmessage) or die("Could not insert message");
         
         
      }
   }
   
   

   
}




and for the 2nd problem do you want the code for chatlog or the sql query??


Author

RE: php and mysql problems

spyware
Member



Posts: 4192
Location:
Joined: 14.04.07
Rank:
God
Warn Level: 90
Posted on 22-02-08 13:13
Post the source of include.php



img507.imageshack.us/img507/3580/spynewsig3il1.png
"The chowner of property." - Zeph
[small]
Widespread intellectual and moral docility may be convenient for leaders in the short term,
but it is suicidal for nations in the long term.
- Carl Sagan
[center]�Since the grid is inescapable, what were the earlier lasers about? Does the corridor have a sense of humor?� - Ebert[/ce
Author

RE: php and mysql problems

mido
Member

Your avatar

Posts: 613
Location: Cairo, Egypt
Joined: 27.01.07
Rank:
Monster
Posted on 22-02-08 13:18
spyware wrote:
Post the source of include.php


I don't think that you need that, since it's :

Code
elseif(strlen($name)<1);




Remove the semi-colon.

Btw, here also :

Code
$insertmessage=("INSERT into chatmessages (name,IP,postime,message) values('$name','$ip','$thedate','$message')";




Change to ");.


www.hellboundhackers.org/sig/r/16019.png



Edited by mido on 22-02-08 13:19
mido_eg3[at]hotmail.com
Author

RE: php and mysql problems

spyware
Member



Posts: 4192
Location:
Joined: 14.04.07
Rank:
God
Warn Level: 90
Posted on 22-02-08 13:23
Post the source of include.php.





img507.imageshack.us/img507/3580/spynewsig3il1.png
"The chowner of property." - Zeph
[small]
Widespread intellectual and moral docility may be convenient for leaders in the short term,
but it is suicidal for nations in the long term.
- Carl Sagan
[center]�Since the grid is inescapable, what were the earlier lasers about? Does the corridor have a sense of humor?� - Ebert[/ce

Edited by spyware on 22-02-08 13:25
Author

RE: php and mysql problems

mido
Member

Your avatar

Posts: 613
Location: Cairo, Egypt
Joined: 27.01.07
Rank:
Monster
Posted on 22-02-08 13:31
spyware wrote:
Post the source of include.php.



? connect.php?


www.hellboundhackers.org/sig/r/16019.png

mido_eg3[at]hotmail.com
Author

RE: php and mysql problems

spyware
Member



Posts: 4192
Location:
Joined: 14.04.07
Rank:
God
Warn Level: 90
Posted on 22-02-08 14:31
mido wrote:
? connect.php?


Actually, neither. I need the (sql)source of the chatlog thing, just read this thing using BOTH eyes.



img507.imageshack.us/img507/3580/spynewsig3il1.png
"The chowner of property." - Zeph
[small]
Widespread intellectual and moral docility may be convenient for leaders in the short term,
but it is suicidal for nations in the long term.
- Carl Sagan
[center]�Since the grid is inescapable, what were the earlier lasers about? Does the corridor have a sense of humor?� - Ebert[/ce