Jump to content

Php session help!!


KirstyScott

Recommended Posts

Hiya,

 

Well basically what i wanted to do, was for the below code to be only accessable useable for the registered members and any other unregistered members would be either re-directed to the /index.php or not able to access/view the file, but i'm stuck on this as i'm really new to php and sql, and if anyone can give me some advice or help me do this, it'll be much appreciated - it'll keep you busy for like, at least 1 min  :P

 

 

 

 

The almighty php code

 

 

<?
include('./settings.php');
if ($security == 1) {
		$loginform = '
<hr color="#9f7401">
Logged in as :  '.$_SESSION['sesuser'].', ($_SESSION['sesadmin']
<table border="0" width="100%">
<tr width="100%">
<td align="left" width="25%">

<td align="left" width="70%">
                                                        
..::
<a href="/index.php">Home</a>
|
<a href="/index.php?act=user&actu=support">Read rules</a>
|
<a href="/index.php?act=logout">Logout</a>
::..
</td>					
</tr>


</table><hr color="#9f7401">








<table width="556" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3"><img src="./news_top.gif" width="556" height="49"></td>
</tr>
<tr>
<td width="13" valign="bottom" background="./news_slice_left.gif"> </td>
<td width="530" align="left" valign="top" bgcolor="#e7dbc3">
<table width="530" border="0" cellspacing="0" cellpadding="6">
<tr>
<td width="143" height="35" colspan="2" bgcolor="#25120B" class="textwhite"></font><font color="#bd8e00">Contact owner</font></td>
<td width="296" height="35" bgcolor="#25120B" class="textwhite"></font><font color="#bd8e00"></font></td>
</tr>
<tr>
<td width="546" colspan="3" rowspan="6" valign="top" bgcolor="#e7dbc3" class="bodytextnews">
<br />
<form action="/web_dialogs" method="POST"><table border="0" cellpadding="3"><tr><td valign="top"><font face="times" color="black" size="2">Send to which department?</td><td><label><input name="web_dialog[client_department_id]" type="radio" id="web_dialog_client_department_id_119" value="119"><font face="times" color="black" size="2">report</label><br><label><input name="web_dialog[client_department_id]" type="radio" id="web_dialog_client_department_id_120" value="120">Website bug</label><br><label><input name="web_dialog[client_department_id]" type="radio" id="web_dialog_client_department_id_121" value="121"><font face="times" color="black" size="2">problem</label><br><label><input name="web_dialog[client_department_id]" type="radio" id="web_dialog_client_department_id_122" value="122"><font face="times" color="black" size="2">(Other)</label><br><p></td></tr><tr><td><font face="times" color="black" size="2"><i>Characters</i> name:</td><td><input name="web_dialog[fname]" size="30" type="text" id="web_dialog_fname"></td></tr><tr><td><font face="times" color="black" size="2">Account secret code:</td><td><input name="web_dialog[lname]" size="30" type="text" id="web_dialog_lname"></td></tr><tr><td><font face="times" color="black" size="2">Valid e-mail - <font face="times" color="black" size="1">so we can contact you<br></td><td><input name="web_dialog[email]" size="30" type="text" id="web_dialog_email"></td></tr><tr><td colspan="2"><hr></td></tr><tr><td><font face="times" color="black" size="2">Subject:</td><td><input name="web_dialog[visitor_subject]" size="39" type="text" id="web_dialog_visitor_subject"></td></tr><tr><td valign="top"><font face="times" color="black" size="2">Message:</td><td><textarea name="web_dialog[message]" id="web_dialog_message" rows="10" cols="30"></textarea></td></tr><tr><td colspan="2"><hr></td></tr><tr><td colspan="2"><font face="times" color="red" size="2">
</td></tr><tr><td></center><p><br><input name="commit" type="submit" value="Send message" onclick="this.setAttribute('originalValue', this.value);this.disabled=true;this.value='Processing...';;result = (this.form.onsubmit ? (this.form.onsubmit() ? this.form.submit() : false) : this.form.submit());if (result == false) { this.value = this.getAttribute('originalValue'); this.disabled = false };return result"></td></tr></table><input name="store" type="hidden" id="store" value="62"><input name="rand" type="hidden" id="rand" value=""><input name="web_dialog[visitor_language_id]" type="hidden" id="web_dialog_visitor_language_id" value="1"></form><script src="/javascripts/loadcaptcha.js" type="text/javascript"></script><script type="text/javascript" language="JavaScript">LoadCaptcha(875,"5f6070a9f53935b04b6e54033fa28e08");</script><br>
</td>
</tr>
<tr></tr>
<tr height="15"></tr>
<tr height="15"></tr>
<tr height="15"></tr>
<tr height="184"></tr>
<tr height="14">
<td class="bodytextnews" colspan="3" valign="top" bgcolor="#e7dbc3" width="446" height="14">

</td>
</tr>
</table>
</td>
<td width="13" valign="bottom" background="./news_slice_right.gif"> </td>
</tr>
</table>
<img src="./tble_btm.gif" width="556" height="49">
</form>

<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>

</table>

</p>
</td>
</tr>
</table></td>
</tr>
<tr>
<td height="57" colspan="2" style="background-image:url(./content_bottom2.gif);background-repeat:no-repeat;"></td>
</tr>;

}
?>

 

 

 

Thanks, and if you could please explain what was wrong, cause as i said, i'm really new to php and all stuff, so would appreciate it all, so i won't make the mistake again! (hopefully) :P

Link to comment
Share on other sites

Then post the actual code. 

 

Opps, i forgot to say, i do have the session_start(); at the top of each page, and i tried what yah said ngreenwood6, i put that just below the session_start(); and i'm still able to view this even being logged out  ???

 

Help  :'(

Link to comment
Share on other sites

Thanks for all your replys and help.  This is my new code below

 

 

 

 

<?session_start();?>





<head>
<title>Website report</title>
</head>



<body  style="margin:0;background-color:#000000;">

<?
include('./config.php');
if (!$_SESSION['sesuser'] == 1)
{header(index.php);}
else
{
$userform="






<table bgcolor='black' cellpadding='0' cellspacing='0' border='0' align='center'>
<tr>

    <td width='726' height='300' valign='top' background='./content_bkgrd.gif'>
<img src='./content_top2.gif' width='726' height='71' />
      <table width='560' border='0' align='center' cellpadding='0' cellspacing='0'>
        <tr>
<td>




<hr color='#9f7401'>
<table border='0' width='100%'>
<tr width='100%'>
<td align='left' width='25%'>

<td align='left' width='70%'>
                                                        
..::
<a href='/index.php'>Home</a>
|
<a href='/index.php?act=user&actu=support'>Read rules</a>
|
<a href='/index.php?act=logout'>Logout</a>
::..
</td>					
</tr>


</table><hr color='#9f7401'>








<table width='556' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td colspan='3'><img src='./news_top.gif' width='556' height='49'></td>
</tr>
<tr>
<td width='13' valign='bottom' background='./news_slice_left.gif'> </td>
<td width='530' align='left' valign='top' bgcolor='#e7dbc3'>
<table width='530' border='0' cellspacing='0' cellpadding='6'>
<tr>
<td width='143' height='35' colspan='2' bgcolor='#25120B' class='textwhite'></font><font color='#bd8e00'>Contact us</font></td>
<td width='296' height='35' bgcolor='#25120B' class='textwhite'></font><font color='#bd8e00'></font></td>
</tr>
<tr>
<td width='546' colspan='3' rowspan='6' valign='top' bgcolor='#e7dbc3' class='bodytextnews'>
<br />
<form action='/web_dialogs' method='POST'><table border='0' cellpadding='3'><tr><td valign='top'><font face='times' color='black' size='2'>Send to which department?</td><td><label><input name='web_dialog[client_department_id]' type='radio' id='web_dialog_client_department_id_119' value='119'><font face='times' color='black' size='2'>Website question</label><br><label><input name='web_dialog[client_department_id]' type='radio' id='web_dialog_client_department_id_120' value='120'>Account deletion</label><br><label><input name='web_dialog[client_department_id]' type='radio' id='web_dialog_client_department_id_121' value='121'><font face='times' color='black' size='2'>Website report</label><br><label><input name='web_dialog[client_department_id]' type='radio' id='web_dialog_client_department_id_122' value='122'><font face='times' color='black' size='2'>(Other)</label><br><p></td></tr><tr><td><font face='times' color='black' size='2'><i>First</i> name:</td><td><input name='web_dialog[fname]' size='30' type='text' id='web_dialog_fname'></td></tr><tr><td><font face='times' color='black' size='2'>Account secret code:</td><td><input name='web_dialog[lname]' size='30' type='text' id='web_dialog_lname'></td></tr><tr><td><font face='times' color='black' size='2'>Valid e-mail - <font face='times' color='black' size='1'><br></td><td><input name='web_dialog[email]' size='30' type='text' id='web_dialog_email'></td></tr><tr><td colspan='2'><hr></td></tr><tr><td><font face='times' color='black' size='2'>Subject:</td><td><input name='web_dialog[visitor_subject]' size='39' type='text' id='web_dialog_visitor_subject'></td></tr><tr><td valign='top'><font face='times' color='black' size='2'>Message:</td><td><textarea name='web_dialog[message]' id='web_dialog_message' rows='10' cols='30'></textarea></td></tr><tr><td colspan='2'><hr></td></tr><tr><td colspan='2'><font face='times' color='red' size='2'>




</td></tr><tr><td><font face='times' color='black' size='2'>Verification code<font face='times' color='red' size='1'> - Case sensitive  </td><td><img name='CaptchaImage' src='' id='CaptchaImage' height='40' alt='Verification' width='150'></td></tr><tr><td><font face='times' color='black' size='2'>Enter code</td><td><input name='code' size='8' type='text' id='code'>
<font face='times' color='red' size='1'> case sensitive


</td></tr><tr><td colspan='2'><center><br><center></center><p><br>

<input name='commit' type='submit' value='Send message' onclick='this.setAttribute('originalValue', this.value);this.disabled=true;this.value='Processing...';;result = (this.form.onsubmit ? (this.form.onsubmit() ? this.form.submit() : false) : this.form.submit());if (result == false) { this.value = t






his.getAttribute('originalValue'); this.disabled = false };return result'></td></tr></table><input name='store' type='hidden' id='store' value='62'><input name='rand' type='hidden' id='rand' value=''><input name='web_dialog[visitor_language_id]' type='hidden' id='web_dialog_visitor_language_id' value='1'></form><script src='/javascripts/loadcaptcha.js' type='text/javascript'></script><script type='text/javascript' language='JavaScript'>LoadCaptcha(875,'5f6070a9f53935b04b6e54033fa28e08');</script><br>
</td>
</tr>
<tr></tr>
<tr height='15'></tr>
<tr height='15'></tr>
<tr height='15'></tr>
<tr height='184'></tr>
<tr height='14'>
<td class='bodytextnews' colspan='3' valign='top' bgcolor='#e7dbc3' width='446' height='14'>

</td>
</tr>
</table>
</td>
<td width='13' valign='bottom' background='./news_slice_right.gif'> </td>
</tr>
</table>
<img src='./tble_btm.gif' width='556' height='49'>
</form>

<table width='95%' border='0' cellspacing='0' cellpadding='0'>
<tr>

</table>

</p>
</td>
</tr>
</table></td>
</tr>
<tr>
<td height='57' colspan='2' style='background-image:url(./content_bottom2.gif);background-repeat:no-repeat;'></td>
</tr>"

//display page
}

 

 

 

 

 

I'm pretty sure i've done it all right, but the above code is giving me "Parse error: syntax error, unexpected '}' in filename.php on line 136"

 

I'm struggling with this  :-\, and would appreciate help to fix the above code

Link to comment
Share on other sites

Do you know which line is line 136?

 

Just wondering which editor you're using as I use Edit+ and Notepad++ and both show me line numbers.

 

Error messages from PHP aren't always caused at the line given. The majority are the previous line, most are somewhere earlier in the code and not many are on the actual line.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.