Jump to content
MakeWebGames

Help anyone?


The Coder

Recommended Posts

Hi all, I've tried to access someones profile through usersonline, however after clicking on there username from usersonline.php, it strangely opens up in a new tab, can anyone help me out on this one? I just get the feeling the issue is somewhere in here, please correct me if I am wrong, thanks. :)

 

$user=$r['userid'];
?>
<tr class='hover' onClick="window.location='viewuser.php?u=<?php echo $user; ?>'"><td><a href="viewuser.php?u=<?php print $user; ?>" target="_blank"><?php print $r['username']; ?> [<?php echo $r['userid']; ?>]</a></td>
<td><?php echo $la; ?> <?php print $unit; ?></td></tr>
<?php
}
Link to comment
Share on other sites

Hi all, I've tried to access someones profile through usersonline, however after clicking on there username from usersonline.php, it strangely opens up in a new tab, can anyone help me out on this one? I just get the feeling the issue is somewhere in here, please correct me if I am wrong, thanks. :)

 

$user=$r['userid'];
?>
<tr class='hover' onClick="window.location='viewuser.php?u=<?php echo $user; ?>'"><td><a href="viewuser.php?u=<?php print $user; ?>" target="_blank"><?php print $r['username']; ?> [<?php echo $r['userid']; ?>]</a></td>
<td><?php echo $la; ?> <?php print $unit; ?></td></tr>
<?php
}

Take this out:

target="_blank"

Link to comment
Share on other sites

Hey also, I keep getting this error:-

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/public_html/staffapps.php on line 10

This is line ten:-

 

><a href="index.php" >Go Home</a>";

 

Anyone know the issue? Many thanks! :)

Edited by The Coder
Took away "Blank" thingy and "Https" :P
Link to comment
Share on other sites

Hey also, I keep getting this error:-

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/public_html/staffapps.php on line 10

This is line ten:-

 

><a href="index.php" >Go Home</a>";

 

Anyone know the issue? Many thanks! :)

It looks like it's because you're using double quotes to wrap both your string and your echo/print.

For example, it should be either this:

print "<a href='index.php'>Go Home</a>";

 

Or this:

print '<a href="index.php">Go Home</a>';

 

But neither of these two:

print "<a href="index.php">Go Home</a>";

 

print '<a href='index.php'>Go Home</a>';

 

See the differences?

Link to comment
Share on other sites

Hey Seker, unfortunately I get the same error with both codes you have supplied for me. :(

Also, sorry about that Kyle here is some of the code before and after line 10. :)

 

require "globals.php";
if($set['stafflock'] == 'Locked')
{
echo "Staff Applications are locked at the moment, please try again later.
><a href="index.php" >Go Home</a>";
$h->endpage();
exit;
}
echo "<h3>Staff Applications</h3>";
$_POST['ID'] = abs((int) $_POST['ID']);
if($_POST['ID'])
Link to comment
Share on other sites

to solve your T_STRING error as mentioned by SEKER whos Edits were correct you can do this one of 2 ways to fix it...

 

require "globals.php";

if($set['stafflock'] == 'Locked'){

echo "Staff Applications are locked at the moment, please try again later.><a href=\"index.php\" >Go Home</a>";

$h->endpage();exit;}echo "<h3>Staff Applications</h3>";

$_POST['ID'] = abs((int) $_POST['ID']);

if($_POST['ID'])

 

or

 

require "globals.php";

if($set['stafflock'] == 'Locked'){

echo "Staff Applications are locked at the moment, please try again later.><a href='index.php' >Go Home</a>";

$h->endpage();exit;}echo "<h3>Staff Applications</h3>";

$_POST['ID'] = abs((int) $_POST['ID']);

if($_POST['ID'])

 

Remember at all times if your echo or print starts with a " or a ' when you end out your echo or print you need to use the same method as you did to start with.

example THIS WILL CREATE AN ERROR

print " how are you world ';

echo " how are you world ';

the reason for this is because you started both statements with a " and ended it with a '

However you can use more than 1 " in a statement but you need to block the next " so the script doesnt think its finished

ecample

echo "we are here <a href="index.php">HERE</a>"; <<<<< will cause an error cos you have 4 " statements and it thinks the second " is the closing out statement

so to cure this you can simply do this

echo "we are here <a href=\"index.php\">HERE</a>"; <<<< the use of the \ tells the script you havent quite finished yet so carry on...

Link to comment
Share on other sites

However you can use more than 1 " in a statement but you need to block the next " so the script doesnt think its finished

ecample

echo "we are here <a href="index.php">HERE</a>"; <<<<< will cause an error cos you have 4 " statements and it thinks the second " is the closing out statement

so to cure this you can simply do this

echo "we are here <a href=\"index.php\">HERE</a>"; <<<< the use of the \ tells the script you havent quite finished yet so carry on...

I actually didn't know you can do it this way. Though, I don't know why anyone would want to. It's a lot messier, in my opinion.

Link to comment
Share on other sites

to solve your T_STRING error as mentioned by SEKER whos Edits were correct you can do this one of 2 ways to fix it...

 

require "globals.php";

if($set['stafflock'] == 'Locked'){

echo "Staff Applications are locked at the moment, please try again later.><a href=\"index.php\" >Go Home</a>";

$h->endpage();exit;}echo "<h3>Staff Applications</h3>";

$_POST['ID'] = abs((int) $_POST['ID']);

if($_POST['ID'])

 

or

 

require "globals.php";

if($set['stafflock'] == 'Locked'){

echo "Staff Applications are locked at the moment, please try again later.><a href='index.php' >Go Home</a>";

$h->endpage();exit;}echo "<h3>Staff Applications</h3>";

$_POST['ID'] = abs((int) $_POST['ID']);

if($_POST['ID'])

 

Remember at all times if your echo or print starts with a " or a ' when you end out your echo or print you need to use the same method as you did to start with.

example THIS WILL CREATE AN ERROR

print " how are you world ';

echo " how are you world ';

the reason for this is because you started both statements with a " and ended it with a '

However you can use more than 1 " in a statement but you need to block the next " so the script doesnt think its finished

ecample

echo "we are here <a href="index.php">HERE</a>"; <<<<< will cause an error cos you have 4 " statements and it thinks the second " is the closing out statement

so to cure this you can simply do this

echo "we are here <a href=\"index.php\">HERE</a>"; <<<< the use of the \ tells the script you havent quite finished yet so carry on...

Thanks but after doing this, I get this error:-

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/gothcent/public_html/staffapps.php on line 25

With these codes:-

 

require "globals.php";

if($set['stafflock'] == 'Locked'){

echo "Staff Applications are locked at the moment, please try again later.><a href=\"index.php\" >Go Home</a>";

$h->endpage();exit;}echo "<h3>Staff Applications</h3>";

$_POST['ID'] = abs((int) $_POST['ID']);

if($_POST['ID'])
{
$sql = sprintf('SELECT COUNT(ID) AS `count` FROM `staffaps` WHERE ID = %u', $userid);
$sql = $db->query($sql);
$gaps = $db->fetch_row($sql);
if($gaps['count'])
{
echo "Invalid Command.
You already have submitted a application.
><a href="index.php" >Go Home</a>"; [LINE 25]
$h->endpage();
exit;
}
else if(!$gaps['count'])
{
$_POST['staff'] = abs((int) $_POST['staff']);
$_POST['about'] = mysql_real_escape_string(htmlentities($_POST['about']));
$_POST['exp'] = mysql_real_escape_string(htmlentities($_POST['exp']));
if(strlen($_POST['about']) > 75 OR strlen($_POST['exp']) > 75)
{

 

:( Btw I stated where line 25 is in the codes.

Edited by The Coder
Link to comment
Share on other sites

Thanks but after doing this, I get this error:-

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/gothcent/public_html/staffapps.php on line 25

With these codes:-

 

require "globals.php";

if($set['stafflock'] == 'Locked'){

echo "Staff Applications are locked at the moment, please try again later.><a href=\"index.php\" >Go Home</a>";

$h->endpage();exit;}echo "<h3>Staff Applications</h3>";

$_POST['ID'] = abs((int) $_POST['ID']);

if($_POST['ID'])
{
$sql = sprintf('SELECT COUNT(ID) AS `count` FROM `staffaps` WHERE ID = %u', $userid);
$sql = $db->query($sql);
$gaps = $db->fetch_row($sql);
if($gaps['count'])
{
echo "Invalid Command.
You already have submitted a application.
><a href="index.php" >Go Home</a>"; [LINE 25]
$h->endpage();
exit;
}
else if(!$gaps['count'])
{
$_POST['staff'] = abs((int) $_POST['staff']);
$_POST['about'] = mysql_real_escape_string(htmlentities($_POST['about']));
$_POST['exp'] = mysql_real_escape_string(htmlentities($_POST['exp']));
if(strlen($_POST['about']) > 75 OR strlen($_POST['exp']) > 75)
{

 

:( Btw I stated where line 25 is in the codes.

You still haven't even fixed it.

Change this:

<a href="index.php" >Go Home</a>";

 

To this:

<a href='index.php' >Go Home</a>";
Link to comment
Share on other sites

Hey thanks, it works now, but another two issues, and also I'm so sorry to bother you all, but I really need mod working for the game. :)

I get an error for both of these SQL's:-

 

CREATE TABLE IF NOT EXISTS `staffaps` (
 `ID` int(11) NOT NULL default '0',
 `about` text NOT NULL,
 `exp` text NOT NULL,
 `position` int(11) NOT NULL default '0'
);

 

Error with the above SQL:-

#1064 - 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 '`ID` int(11) NOT NULL default '0', Â Â `about` text NOT NULL, Â Â `exp` text NOT' at line 2

And 2nd SQL -

 

INSERT INTO `settings` (
`conf_id` ,
`conf_name` ,
`conf_value`
)
VALUES (
'17', 'stafflock', 'Locked'
);

 

Error with 2nd SQL -

#1062 - Duplicate entry '17' for key 'PRIMARY'

Thanks to all who help me. :)

Link to comment
Share on other sites

Maybe for the first SQL:

CREATE TABLE IF NOT EXISTS `staffaps` (
 `ID` int(11) NOT NULL default '0',
 `about` varchar(max) NOT NULL,
 `exp` varchar(max)  NOT NULL,
 `position` int(11) NOT NULL default '0'
);

 

Though, I do not know why text wouldn't work.

For the second SQL:

INSERT INTO `settings` 
(
       `conf_id` ,
       `conf_name` ,
       `conf_value`
)
VALUES 
(
       'NULL', 
       'stafflock', 
       'Locked'
);
Link to comment
Share on other sites

Didn't work mate. :(

Errors received -

SQL 1 error -

#1064 - 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 '`ID` int(11) NOT NULL default '0', Â Â `about` varchar(max) NOT NULL, Â Â `exp` ' at line 2

SQL 2 error -

#1064 - 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 '`conf_id` , Â Â Â Â Â Â Â Â `conf_name` , Â Â Â Â Â Â Â Â `conf_value` ) VALUES ' at line 3

Anyone have a clue whats wrong lol?

Thanks Seker for trying. :)

Link to comment
Share on other sites

Didn't work mate. :(

Errors received -

SQL 1 error -

#1064 - 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 '`ID` int(11) NOT NULL default '0', Â Â `about` varchar(max) NOT NULL, Â Â `exp` ' at line 2

SQL 2 error -

#1064 - 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 '`conf_id` , Â Â Â Â Â Â Â Â `conf_name` , Â Â Â Â Â Â Â Â `conf_value` ) VALUES ' at line 3

Anyone have a clue whats wrong lol?

Thanks Seker for trying. :)

Try;

CREATE TABLE IF NOT EXISTS `staffaps` (
   `ID` INT(11) NOT NULL DEFAULT 0,
   `about` TEXT NOT NULL,
   `exp` TEXT NOT NULL,
   `position` INT(11) NOT NULL DEFAULT 0, #Probably don't need int(11) but hey.
);


INSERT INTO `settings` ( `conf_id`, `conf_name`, `conf_value`) VALUES (null, 'stafflock', 'Locked');
Link to comment
Share on other sites

Try;
CREATE TABLE IF NOT EXISTS `staffaps` (
   `ID` INT(11) NOT NULL DEFAULT 0,
   `about` TEXT NOT NULL,
   `exp` TEXT NOT NULL,
   `position` INT(11) NOT NULL DEFAULT 0, #Probably don't need int(11) but hey.
);


INSERT INTO `settings` ( `conf_id`, `conf_name`, `conf_value`) VALUES (null, 'stafflock', 'Locked');

Thanks for trying, but I get another sort of error this time:-

"SQL query:

CREATE TABLE IF NOT EXISTS `staffaps` (

`ID` INT( 11 ) NOT NULL DEFAULT 0,

`about` TEXT NOT NULL ,

`exp` TEXT NOT NULL ,

`position` INT( 11 ) NOT NULL DEFAULT 0,

#Probably don't need int(11) but hey.

);

 

MySQL said:

#1064 - 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 '`ID` INT(11) NOT NULL DEFAULT 0,

    `about` TEXT NOT NULL,

    `exp` TE' at line 2"

Once again, thanks for trying, and this seems to be a picky one eh all? :/

Link to comment
Share on other sites

Thanks for trying, but I get another sort of error this time:-

"SQL query:

CREATE TABLE IF NOT EXISTS `staffaps` (

`ID` INT( 11 ) NOT NULL DEFAULT 0,

`about` TEXT NOT NULL ,

`exp` TEXT NOT NULL ,

`position` INT( 11 ) NOT NULL DEFAULT 0,

#Probably don't need int(11) but hey.

);

 

MySQL said:

#1064 - 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 '`ID` INT(11) NOT NULL DEFAULT 0,

    `about` TEXT NOT NULL,

    `exp` TE' at line 2"

Once again, thanks for trying, and this seems to be a picky one eh all? :/

After NOT NULL on the `about` and `exp` lines, you have a space before the comma. Could be messing with it, maybe.

Link to comment
Share on other sites

Thanks for trying, but I get another sort of error this time:-

"SQL query:

CREATE TABLE IF NOT EXISTS `staffaps` (

`ID` INT( 11 ) NOT NULL DEFAULT 0,

`about` TEXT NOT NULL ,

`exp` TEXT NOT NULL ,

`position` INT( 11 ) NOT NULL DEFAULT 0,

#Probably don't need int(11) but hey.

);

MySQL said:

#1064 - 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 '`ID` INT(11) NOT NULL DEFAULT 0,

    `about` TEXT NOT NULL,

    `exp` TE' at line 2"

Once again, thanks for trying, and this seems to be a picky one eh all? :/

CREATE TABLE IF NOT EXISTS `staffaps` (
   `ID` INT(11) NOT NULL DEFAULT 0,
   `about` TEXT NOT NULL,
   `exp` TEXT NOT NULL,
   `position` INT(11) NOT NULL DEFAULT 0 #Probably don't need int(11) but hey.
);

Seems to work fine.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...