הרשם שאלות ותשובות רשימת חברים לוח שנה הודעות מהיום

חזור   הוסטס - פורום אחסון האתרים הגדול בישראל > עיצוב גראפי, תכנות על כל שפותיו וקידום ושיווק אתרים > פורום תיכנות

   
|!|

השב
 
כלים לאשכול תצורת הצגה
ישן 31-03-06, 15:35   # 1
חבר|94
Permanently Banned
 
מיני פרופיל
תאריך הצטרפות: Dec 2005
הודעות: 70

חבר|94 לא מחובר  

[עזרה]במערכת ד"שים

PHP קוד:
-- phpMyAdmin SQL Dump
-- version 2.6.1-pl3
-- http://www.phpmyadmin.net
-- 
-- 
מארחlocalhost
-- זמן יצירהאפריל 162005 at 10:51 PM
-- גרסת שרת4.0.17
-- גרסת PHP4.3.10
-- 
-- 
מסד נתונים: `hanan_dash`
-- 

-- --------------------------------------------------------

-- 
-- 
מבנה טבלה לטבלה `admins`
-- 

CREATE TABLE `admins` (
  `
idint(11NOT NULL auto_increment,
  `
uservarchar(254NOT NULL default '',
  `
passvarchar(254NOT NULL default '',
  
KEY `id` (`id`)
TYPE=MyISAM AUTO_INCREMENT=;

-- --------------------------------------------------------

-- 
-- 
מבנה טבלה לטבלה `reg`
-- 

CREATE TABLE `reg` (
  `
idint(11NOT NULL auto_increment,
  `
sendervarchar(254NOT NULL default '',
  `
fortovarchar(254NOT NULL default '',
  `
msgtext NOT NULL,
  `
datetimevarchar(254NOT NULL default '',
  `
timevarchar(254NOT NULL default '',
  `
ipvarchar(254NOT NULL default '',
  
KEY `id` (`id`)
TYPE=MyISAM AUTO_INCREMENT=;

-- --------------------------------------------------------

-- 
-- 
מבנה טבלה לטבלה `settings`
-- 

CREATE TABLE `settings` (
  `
titletextvarchar(254NOT NULL default '',
  `
colortextvarchar(254NOT NULL default '',
  `
backtextvarchar(254NOT NULL default '',
  `
titlelinkvarchar(254NOT NULL default '',
  `
colorlinkvarchar(254NOT NULL default '',
  `
backlinkvarchar(254NOT NULL default '',
  `
dashcolorvarchar(254NOT NULL default '',
  `
backdashcolorvarchar(254NOT NULL default ''
TYPE=MyISAM
לא הבנתי מה השם משתמש והסיסמה ואיפו אני משנה אותם
  Reply With Quote
ישן 31-03-06, 15:38   # 2
Jarhead
חבר מתקדם
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
גיל: 36
הודעות: 529

Jarhead לא מחובר  

`user` varchar(254) NOT NULL default '',
`pass` varchar(254) NOT NULL default
  Reply With Quote
ישן 31-03-06, 17:18   # 3
miniature
חבר וותיק
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
הודעות: 1,754

miniature לא מחובר  

ציטוט:
נכתב במקור על ידי Jarhead
`user` varchar(254) NOT NULL default '',
`pass` varchar(254) NOT NULL default
מה הקשר?

חזרה לפותח האשכול, אתה מחפש את שם המשתמש של המסד? כי אין כאן, אתה צריך להתחבר לפני הרצת השאילתות.
__________________
יואב.

דרכים ליצירת קשר:

אימייל: thebigfire@walla.co.il
הודעה פרטית
  Reply With Quote
ישן 31-03-06, 18:45   # 4
חבר|94
Permanently Banned
 
מיני פרופיל
תאריך הצטרפות: Dec 2005
הודעות: 70

חבר|94 לא מחובר  

סדרתי את זה עכשיו שי עוד בעייה

PHP קוד:
<STYLE type=text/css>BODY {
    PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 10px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; FONT-FAMILY: Tahoma
}
SELECT {
    PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 10px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; FONT-FAMILY: Tahoma
}
INPUT {
    PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 10px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; FONT-FAMILY: Tahoma
}
TD {
    PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 10px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; FONT-FAMILY: Tahoma
}
TD {
    PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; DIRECTION: rtl; PADDING-TOP: 0px
}
BODY {
    SCROLLBAR-FACE-COLOR: white; SCROLLBAR-SHADOW-COLOR: #ffffff; SCROLLBAR-ARROW-COLOR: midnightblue; SCROLLBAR-TRACK-COLOR: #e8e8e8
}
    </STYLE>
<?

/*********************/
/*** The Functions ***/

/* Returns the encrypted password of the given string. */
function CalculatePassword($pass)
{
    
$pass=$pass[0].$pass.$pass[0];  //adding the first letter of the password to the begining and ending of the password string. (For example: "1234" => "112341")
   
$pass=md5($pass);  //encrypts the password
   
return $pass;
}

/* Checks the user and password for match. Returns a STRING of the password if authorized, FALSE if not allowed. */

function CheckUserGroup($uname)
{
    
$sql=@mysql_connect('localhost','idan111_radio','12563254') or die("<BR>ERROR: cannot connect to MySQL server!");  //connect to MySQL server
    
@mysql_select_db("idan111_radio",$sql) or die("<BR>ERROR: cannot use the DB!");  //selects the DB
    
$cheak=mysql_query("SELECT user_group FROM members WHERE uname='$uname' ");
    
$cheak_fetch=mysql_fetch_array($cheak);
    
$group=$cheak_fetch['user_group'];
    return 
$group;
    @
mysql_close($sql);
}

function 
CheckUserPassword($uname,$pass,$with_calc=true)
{
    global 
$protect_user_group;

    if (
$uname=="" || $pass=="")  //if empty user or password
       
return false;

   
/*** CHANGE: host, user, password and db ***/
    
$sql=@mysql_connect('localhost','idan111_radio','12563254') or die("<BR>ERROR: cannot connect to MySQL server!");  //connect to MySQL server
   
@mysql_select_db("idan111_radio",$sql) or die("<BR>ERROR: cannot use the DB!");  //selects the DB

   
$c_pass=($with_calc==true)?CalculatePassword($pass):$pass;  //calculates the password if needed
   
$res=@mysql_query("SELECT uname FROM members WHERE (user_group='".$protect_user_group."' AND uname='".$uname."' AND pass='".$c_pass."')",$sql) or die("<BR>ERROR: incorrect query!");

   if (
mysql_num_rows($res)==1)  //if we got a row, then we got a match
       
return $c_pass;  //returning a string of the password itself
   
return false;  //if we got to here, we got no row, then there is no match

   
@mysql_close($sql);
}


/************************/
/*** The Main Program ***/

session_cache_limiter("nocache");  //sets the cache limiter for the session for the current script run (nocache => avoiding from the browser to save the content of the page in his cache, the page refreshes every time you enter)
session_start();  //starting the session
if (!isset($protect_user_group)||($protect_user_group==0))
{
    if (isset(
$_POST["auth_user_"]))
        
$protect_user_group=CheckUserGroup($_POST["auth_user_"]);
    elseif (isset(
$_SESSION["auth_user_id".'1']))
        
$protect_user_group=CheckUserGroup($_SESSION["auth_user_id".'1']);
    elseif (isset(
$_SESSION["auth_user_id".'0']))
        
$protect_user_group=CheckUserGroup($_SESSION["auth_user_id".'0']);
    else
        
$protect_user_group=0;
}
if (!isset(
$_SESSION["auth_user_id".$protect_user_group]) && !isset($_SESSION["auth_password_id".$protect_user_group]))  //if not authorized
{
    
$us=$_POST["auth_user_"];
    
$ps=CheckUserPassword($_POST["auth_user_"],$_POST["auth_password_"]);
    if (
$ps===false)  //if user-password is not send or incorrect
    
{
        echo 
"<DIV align=\"center\" dir=\"rtl\">\n\n";
        echo 
"<B>אתה חייב להתחבר כדי לצפות בדף זה</B><BR><BR>\n\n";

       
/* Displaying the User-Password Form: */
       
?>
       <FORM action="<?= $_SERVER["PHP_SELF"]; ?>" method="POST">
           <TABLE width="596" cellpadding="5" cellspacing="2" border="0" bgcolor="#F9F9F9">
            <TR>
                <TD colspan="2" bgcolor='#FFFFFF' align="center" width="582">
                <u><i><b><font size="4" face="Arial">התחבר לאתר</font></b></i></u></TD>
            </TR>
              <TR>
                 <TD width="176" bgcolor="#FFFFFF" align="center">משתמש:</TD>
                <TD width="394" bgcolor="#FFFFFF" align="center">
                <font color="#FFFFFF">
                <INPUT name="auth_user_" value="<?= $us?>" style="border:1px dashed #C0C0C0; width:95px; float:right" size="20"></font></TD>
             </TR>
             <TR>
                 <TD width="176" bgcolor="#FFFFFF" align="center">ססמא:</TD>
                <TD width="394" bgcolor="#FFFFFF" align="center">
                <font color="#FFFFFF">
                <INPUT type="password" name="auth_password_" style="border:1px dashed #C0C0C0; width:95px; background-image:url(''); float:right" size="20"></font></TD>
             </TR>
             <TR>
                 <TD colspan="2" align="center" bgcolor="#FFFFFF" width="582">
            <font color="#FFFFFF">
            <INPUT type="submit" name="auth_button_enter" value=" התחבר " style="border-style:dotted; border-width:1px; background-color:#F9F9F9"></font></TD>
             </TR>
          </TABLE>
       </FORM>
       <?

       
if (isset($_POST["auth_button_enter"]))  //if the user-password form was submitted
           
echo "<B><FONT color=\"#FF0000\">שם המשתמש והססמא שגויים!</FONT></B><BR><BR>\n";

        echo 
"<b>חובה להיות שדרן או מנהל כדי להיכנס</b>";
       echo 
"</DIV>\n\n";
       exit();  
//stop the script, avoiding from sending the contents of the page
    
}
   else  
//if the user-password that was entered is correct
   
{
       
$_SESSION["auth_user_id".$protect_user_group]=$us;  //saves session variable
      
$_SESSION["auth_password_id".$protect_user_group]=$ps;  //saves session variable
      
header("Location: ".$_SERVER["PHP_SELF"]);  //reloading the page again, to avoid from the POST data of the form to be sent again on refresh
   
}
}
elseif (
CheckUserPassword($_SESSION["auth_user_id".$protect_user_group],$_SESSION["auth_password_id".$protect_user_group],false)===false)  //checking the user-password from the session
{
    
/* If we got to here, then there are user and password saved in the session, but they do not match. */
    
echo "<DIV align=\"center\" dir=\"rtl\"><H2><FONT color=\"#CC0000\">אינך מורשה להכנס לדף זה !!!</FONT></H2></DIV>\n";
   exit();  
//stop the script
}
elseif (
$_GET["logout"]=="true")  //if we want to logout
{
   
session_unregister("auth_user_id".$protect_user_group);  //removing a session variable
   
session_unregister("auth_password_id".$protect_user_group);  //removing a session variable
   
header("Location: ".$_SERVER["PHP_SELF"]);  //reloading the page again, to display the user-password form
}

/* If you got to here, then you are authorized! */

?>
זה עושה לי תבעייה
PHP קוד:
Warningsession_start(): Cannot send session cache limiter headers already sent (output started at /home/****/domains/******/public_html/dash/admin/protect.php:1in /home/****/domains/****/public_html/dash/admin/protect.php on line 72 

Last edited by חבר|94; 31-03-06 at 18:52..
  Reply With Quote
ישן 31-03-06, 19:02   # 5
d0rix
מתאורר / יצא בחוץ
 
מיני פרופיל
תאריך הצטרפות: Nov 2005
גיל: 33
הודעות: 1,612

d0rix לא מחובר  

אין שם משתמש וסיסמא, אתה צריך להוסיף דרך הphpmyadmin
לך להוספה ואז תרשום שם.
  Reply With Quote
ישן 31-03-06, 23:39   # 6
pini56
מתאורר / יצא בחוץ
 
מיני פרופיל
תאריך הצטרפות: Dec 2005
הודעות: 16

pini56 לא מחובר  

ציטוט:
נכתב במקור על ידי HaFree-serv
סדרתי את זה עכשיו שי עוד בעייה

PHP קוד:
<STYLE type=text/css>BODY {
    PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 10px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; FONT-FAMILY: Tahoma
}
SELECT {
    PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 10px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; FONT-FAMILY: Tahoma
}
INPUT {
    PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 10px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; FONT-FAMILY: Tahoma
}
TD {
    PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 10px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; FONT-FAMILY: Tahoma
}
TD {
    PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; DIRECTION: rtl; PADDING-TOP: 0px
}
BODY {
    SCROLLBAR-FACE-COLOR: white; SCROLLBAR-SHADOW-COLOR: #ffffff; SCROLLBAR-ARROW-COLOR: midnightblue; SCROLLBAR-TRACK-COLOR: #e8e8e8
}
    </STYLE>
<?

/*********************/
/*** The Functions ***/

/* Returns the encrypted password of the given string. */
function CalculatePassword($pass)
{
    
$pass=$pass[0].$pass.$pass[0];  //adding the first letter of the password to the begining and ending of the password string. (For example: "1234" => "112341")
   
$pass=md5($pass);  //encrypts the password
   
return $pass;
}

/* Checks the user and password for match. Returns a STRING of the password if authorized, FALSE if not allowed. */

function CheckUserGroup($uname)
{
    
$sql=@mysql_connect('localhost','idan111_radio','12563254') or die("<BR>ERROR: cannot connect to MySQL server!");  //connect to MySQL server
    
@mysql_select_db("idan111_radio",$sql) or die("<BR>ERROR: cannot use the DB!");  //selects the DB
    
$cheak=mysql_query("SELECT user_group FROM members WHERE uname='$uname' ");
    
$cheak_fetch=mysql_fetch_array($cheak);
    
$group=$cheak_fetch['user_group'];
    return 
$group;
    @
mysql_close($sql);
}

function 
CheckUserPassword($uname,$pass,$with_calc=true)
{
    global 
$protect_user_group;

    if (
$uname=="" || $pass=="")  //if empty user or password
       
return false;

   
/*** CHANGE: host, user, password and db ***/
    
$sql=@mysql_connect('localhost','idan111_radio','12563254') or die("<BR>ERROR: cannot connect to MySQL server!");  //connect to MySQL server
   
@mysql_select_db("idan111_radio",$sql) or die("<BR>ERROR: cannot use the DB!");  //selects the DB

   
$c_pass=($with_calc==true)?CalculatePassword($pass):$pass;  //calculates the password if needed
   
$res=@mysql_query("SELECT uname FROM members WHERE (user_group='".$protect_user_group."' AND uname='".$uname."' AND pass='".$c_pass."')",$sql) or die("<BR>ERROR: incorrect query!");

   if (
mysql_num_rows($res)==1)  //if we got a row, then we got a match
       
return $c_pass;  //returning a string of the password itself
   
return false;  //if we got to here, we got no row, then there is no match

   
@mysql_close($sql);
}


/************************/
/*** The Main Program ***/

session_cache_limiter("nocache");  //sets the cache limiter for the session for the current script run (nocache => avoiding from the browser to save the content of the page in his cache, the page refreshes every time you enter)
session_start();  //starting the session
if (!isset($protect_user_group)||($protect_user_group==0))
{
    if (isset(
$_POST["auth_user_"]))
        
$protect_user_group=CheckUserGroup($_POST["auth_user_"]);
    elseif (isset(
$_SESSION["auth_user_id".'1']))
        
$protect_user_group=CheckUserGroup($_SESSION["auth_user_id".'1']);
    elseif (isset(
$_SESSION["auth_user_id".'0']))
        
$protect_user_group=CheckUserGroup($_SESSION["auth_user_id".'0']);
    else
        
$protect_user_group=0;
}
if (!isset(
$_SESSION["auth_user_id".$protect_user_group]) && !isset($_SESSION["auth_password_id".$protect_user_group]))  //if not authorized
{
    
$us=$_POST["auth_user_"];
    
$ps=CheckUserPassword($_POST["auth_user_"],$_POST["auth_password_"]);
    if (
$ps===false)  //if user-password is not send or incorrect
    
{
        echo 
"<DIV align=\"center\" dir=\"rtl\">\n\n";
        echo 
"<B>אתה חייב להתחבר כדי לצפות בדף זה</B><BR><BR>\n\n";

       
/* Displaying the User-Password Form: */
       
?>
       <FORM action="<?= $_SERVER["PHP_SELF"]; ?>" method="POST">
           <TABLE width="596" cellpadding="5" cellspacing="2" border="0" bgcolor="#F9F9F9">
            <TR>
                <TD colspan="2" bgcolor='#FFFFFF' align="center" width="582">
                <u><i><b><font size="4" face="Arial">התחבר לאתר</font></b></i></u></TD>
            </TR>
              <TR>
                 <TD width="176" bgcolor="#FFFFFF" align="center">משתמש:</TD>
                <TD width="394" bgcolor="#FFFFFF" align="center">
                <font color="#FFFFFF">
                <INPUT name="auth_user_" value="<?= $us?>" style="border:1px dashed #C0C0C0; width:95px; float:right" size="20"></font></TD>
             </TR>
             <TR>
                 <TD width="176" bgcolor="#FFFFFF" align="center">ססמא:</TD>
                <TD width="394" bgcolor="#FFFFFF" align="center">
                <font color="#FFFFFF">
                <INPUT type="password" name="auth_password_" style="border:1px dashed #C0C0C0; width:95px; background-image:url(''); float:right" size="20"></font></TD>
             </TR>
             <TR>
                 <TD colspan="2" align="center" bgcolor="#FFFFFF" width="582">
            <font color="#FFFFFF">
            <INPUT type="submit" name="auth_button_enter" value=" התחבר " style="border-style:dotted; border-width:1px; background-color:#F9F9F9"></font></TD>
             </TR>
          </TABLE>
       </FORM>
       <?

       
if (isset($_POST["auth_button_enter"]))  //if the user-password form was submitted
           
echo "<B><FONT color=\"#FF0000\">שם המשתמש והססמא שגויים!</FONT></B><BR><BR>\n";

        echo 
"<b>חובה להיות שדרן או מנהל כדי להיכנס</b>";
       echo 
"</DIV>\n\n";
       exit();  
//stop the script, avoiding from sending the contents of the page
    
}
   else  
//if the user-password that was entered is correct
   
{
       
$_SESSION["auth_user_id".$protect_user_group]=$us;  //saves session variable
      
$_SESSION["auth_password_id".$protect_user_group]=$ps;  //saves session variable
      
header("Location: ".$_SERVER["PHP_SELF"]);  //reloading the page again, to avoid from the POST data of the form to be sent again on refresh
   
}
}
elseif (
CheckUserPassword($_SESSION["auth_user_id".$protect_user_group],$_SESSION["auth_password_id".$protect_user_group],false)===false)  //checking the user-password from the session
{
    
/* If we got to here, then there are user and password saved in the session, but they do not match. */
    
echo "<DIV align=\"center\" dir=\"rtl\"><H2><FONT color=\"#CC0000\">אינך מורשה להכנס לדף זה !!!</FONT></H2></DIV>\n";
   exit();  
//stop the script
}
elseif (
$_GET["logout"]=="true")  //if we want to logout
{
   
session_unregister("auth_user_id".$protect_user_group);  //removing a session variable
   
session_unregister("auth_password_id".$protect_user_group);  //removing a session variable
   
header("Location: ".$_SERVER["PHP_SELF"]);  //reloading the page again, to display the user-password form
}

/* If you got to here, then you are authorized! */

?>
זה עושה לי תבעייה
PHP קוד:
Warningsession_start(): Cannot send session cache limiter headers already sent (output started at /home/****/domains/******/public_html/dash/admin/protect.php:1in /home/****/domains/****/public_html/dash/admin/protect.php on line 72 
יש לך שגיעה בשורה 72 תנסה לסדר את זה...
  Reply With Quote
ישן 01-04-06, 00:38   # 7
Balrog
חבר בקהילה
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
הודעות: 121

Balrog לא מחובר  

מהצצה מהירה בשגיאה אני רואה בעצם שהוא אומר שהוא לא יכול לבצע את ה session_start כי נשלחו כבר headers.
כאשר אתה רוצה לשמור עוגיות או משתני session (וכנראה גם כשאתה רוצה לעשות session_start) יש צורך לעשות את זה לפני ששולחים קוד HTML כלשהו.

תנסה להעביר את 2 השורות
session_cache_limiter("nocache"); //sets the cache limiter for the session for the current script run (nocache => avoiding from the browser to save the content of the page in his cache, the page refreshes every time you enter)
session_start(); //starting the session

לתחילת המסמך (כמובן בתוך תגי <? ?> )
  Reply With Quote
ישן 01-04-06, 11:26   # 8
AFI
חסום
 
מיני פרופיל
תאריך הצטרפות: Nov 2005
הודעות: 730
שלח הודעה באמצעות ICO אל AFI

AFI לא מחובר  

השגיאה היא בגלל שאתה לא יכול להכניס את הCSS
זה בגלל הsession, תוריד את הCSS וזה יפעל כמו שצריך
  Reply With Quote
ישן 01-04-06, 12:49   # 9
Sagi
חבר וותיק
 
Sagi's Avatar
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
גיל: 34
הודעות: 1,745
שלח הודעה באמצעות ICO אל Sagi

Sagi לא מחובר  

ציטוט:
נכתב במקור על ידי HaFree-serv
סדרתי את זה עכשיו שי עוד בעייה

PHP קוד:
<?
ob_start
();
?>
<STYLE type=text/css>BODY {
    PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 10px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; FONT-FAMILY: Tahoma
}
SELECT {
    PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 10px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; FONT-FAMILY: Tahoma
}
INPUT {
    PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 10px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; FONT-FAMILY: Tahoma
}
TD {
    PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 10px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; FONT-FAMILY: Tahoma
}
TD {
    PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; DIRECTION: rtl; PADDING-TOP: 0px
}
BODY {
    SCROLLBAR-FACE-COLOR: white; SCROLLBAR-SHADOW-COLOR: #ffffff; SCROLLBAR-ARROW-COLOR: midnightblue; SCROLLBAR-TRACK-COLOR: #e8e8e8
}
    </STYLE>
<?

/*********************/
/*** The Functions ***/

/* Returns the encrypted password of the given string. */
function CalculatePassword($pass)
{
    
$pass=$pass[0].$pass.$pass[0];  //adding the first letter of the password to the begining and ending of the password string. (For example: "1234" => "112341")
   
$pass=md5($pass);  //encrypts the password
   
return $pass;
}

/* Checks the user and password for match. Returns a STRING of the password if authorized, FALSE if not allowed. */

function CheckUserGroup($uname)
{
    
$sql=@mysql_connect('localhost','idan111_radio','12563254') or die("<BR>ERROR: cannot connect to MySQL server!");  //connect to MySQL server
    
@mysql_select_db("idan111_radio",$sql) or die("<BR>ERROR: cannot use the DB!");  //selects the DB
    
$cheak=mysql_query("SELECT user_group FROM members WHERE uname='$uname' ");
    
$cheak_fetch=mysql_fetch_array($cheak);
    
$group=$cheak_fetch['user_group'];
    return 
$group;
    @
mysql_close($sql);
}

function 
CheckUserPassword($uname,$pass,$with_calc=true)
{
    global 
$protect_user_group;

    if (
$uname=="" || $pass=="")  //if empty user or password
       
return false;

   
/*** CHANGE: host, user, password and db ***/
    
$sql=@mysql_connect('localhost','idan111_radio','12563254') or die("<BR>ERROR: cannot connect to MySQL server!");  //connect to MySQL server
   
@mysql_select_db("idan111_radio",$sql) or die("<BR>ERROR: cannot use the DB!");  //selects the DB

   
$c_pass=($with_calc==true)?CalculatePassword($pass):$pass;  //calculates the password if needed
   
$res=@mysql_query("SELECT uname FROM members WHERE (user_group='".$protect_user_group."' AND uname='".$uname."' AND pass='".$c_pass."')",$sql) or die("<BR>ERROR: incorrect query!");

   if (
mysql_num_rows($res)==1)  //if we got a row, then we got a match
       
return $c_pass;  //returning a string of the password itself
   
return false;  //if we got to here, we got no row, then there is no match

   
@mysql_close($sql);
}


/************************/
/*** The Main Program ***/

session_cache_limiter("nocache");  //sets the cache limiter for the session for the current script run (nocache => avoiding from the browser to save the content of the page in his cache, the page refreshes every time you enter)
session_start();  //starting the session
if (!isset($protect_user_group)||($protect_user_group==0))
{
    if (isset(
$_POST["auth_user_"]))
        
$protect_user_group=CheckUserGroup($_POST["auth_user_"]);
    elseif (isset(
$_SESSION["auth_user_id".'1']))
        
$protect_user_group=CheckUserGroup($_SESSION["auth_user_id".'1']);
    elseif (isset(
$_SESSION["auth_user_id".'0']))
        
$protect_user_group=CheckUserGroup($_SESSION["auth_user_id".'0']);
    else
        
$protect_user_group=0;
}
if (!isset(
$_SESSION["auth_user_id".$protect_user_group]) && !isset($_SESSION["auth_password_id".$protect_user_group]))  //if not authorized
{
    
$us=$_POST["auth_user_"];
    
$ps=CheckUserPassword($_POST["auth_user_"],$_POST["auth_password_"]);
    if (
$ps===false)  //if user-password is not send or incorrect
    
{
        echo 
"<DIV align=\"center\" dir=\"rtl\">\n\n";
        echo 
"<B>אתה חייב להתחבר כדי לצפות בדף זה</B><BR><BR>\n\n";

       
/* Displaying the User-Password Form: */
       
?>
       <FORM action="<?= $_SERVER["PHP_SELF"]; ?>" method="POST">
           <TABLE width="596" cellpadding="5" cellspacing="2" border="0" bgcolor="#F9F9F9">
            <TR>
                <TD colspan="2" bgcolor='#FFFFFF' align="center" width="582">
                <u><i><b><font size="4" face="Arial">התחבר לאתר</font></b></i></u></TD>
            </TR>
              <TR>
                 <TD width="176" bgcolor="#FFFFFF" align="center">משתמש:</TD>
                <TD width="394" bgcolor="#FFFFFF" align="center">
                <font color="#FFFFFF">
                <INPUT name="auth_user_" value="<?= $us?>" style="border:1px dashed #C0C0C0; width:95px; float:right" size="20"></font></TD>
             </TR>
             <TR>
                 <TD width="176" bgcolor="#FFFFFF" align="center">ססמא:</TD>
                <TD width="394" bgcolor="#FFFFFF" align="center">
                <font color="#FFFFFF">
                <INPUT type="password" name="auth_password_" style="border:1px dashed #C0C0C0; width:95px; background-image:url(''); float:right" size="20"></font></TD>
             </TR>
             <TR>
                 <TD colspan="2" align="center" bgcolor="#FFFFFF" width="582">
            <font color="#FFFFFF">
            <INPUT type="submit" name="auth_button_enter" value=" התחבר " style="border-style:dotted; border-width:1px; background-color:#F9F9F9"></font></TD>
             </TR>
          </TABLE>
       </FORM>
       <?

       
if (isset($_POST["auth_button_enter"]))  //if the user-password form was submitted
           
echo "<B><FONT color=\"#FF0000\">שם המשתמש והססמא שגויים!</FONT></B><BR><BR>\n";

        echo 
"<b>חובה להיות שדרן או מנהל כדי להיכנס</b>";
       echo 
"</DIV>\n\n";
       exit();  
//stop the script, avoiding from sending the contents of the page
    
}
   else  
//if the user-password that was entered is correct
   
{
       
$_SESSION["auth_user_id".$protect_user_group]=$us;  //saves session variable
      
$_SESSION["auth_password_id".$protect_user_group]=$ps;  //saves session variable
      
header("Location: ".$_SERVER["PHP_SELF"]);  //reloading the page again, to avoid from the POST data of the form to be sent again on refresh
   
}
}
elseif (
CheckUserPassword($_SESSION["auth_user_id".$protect_user_group],$_SESSION["auth_password_id".$protect_user_group],false)===false)  //checking the user-password from the session
{
    
/* If we got to here, then there are user and password saved in the session, but they do not match. */
    
echo "<DIV align=\"center\" dir=\"rtl\"><H2><FONT color=\"#CC0000\">אינך מורשה להכנס לדף זה !!!</FONT></H2></DIV>\n";
   exit();  
//stop the script
}
elseif (
$_GET["logout"]=="true")  //if we want to logout
{
   
session_unregister("auth_user_id".$protect_user_group);  //removing a session variable
   
session_unregister("auth_password_id".$protect_user_group);  //removing a session variable
   
header("Location: ".$_SERVER["PHP_SELF"]);  //reloading the page again, to display the user-password form
}

/* If you got to here, then you are authorized! */

?>
זה עושה לי תבעייה
PHP קוד:
Warningsession_start(): Cannot send session cache limiter headers already sent (output started at /home/****/domains/******/public_html/dash/admin/protect.php:1in /home/****/domains/****/public_html/dash/admin/protect.php on line 72 
תנסה זה אמור לפעול
  Reply With Quote
השב

חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים)
 


חוקי פירסום
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 מופעל
סמיילים הם מופעל
[IMG] קוד מופעל
קוד HTML מכובה

קפיצה לפורום


כל הזמנים הם GMT +2. הזמן כעת הוא 17:14.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ