Jump to content

alto

Members
  • Posts

    9
  • Joined

  • Last visited

alto's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. thank you you help me a lot. finally i make it work.
  2. I'm again. without your help i will never make script working. I know my english isnt so good but i will explaine what for I'm using script. I have nginx server using it for for streaming with rtmp module. rtmp module suport this command on_publish http://localhost/auth.php; on_play http://localhost/auth.php; notify_method get; for protecting streaming content when user try to watch stream content this comand notify_method get; check it is it user authorized to watch content and its check on this location http://localhost/auth.php; auth.php is script above. its working perfect with one user but i dont now how could I modify script to accsept more users and passwords this script check felix user and felixpassword are they authorized to watch content. as you see in script is included felix user and felixpassword and script aloud for user felix and for password felixpassword to start playing from server my question is how to modify script to add more users and password authorized to play stream one more time i will post script please help me to modify because with my knowlege of php coding i cant do it i think for you its pease of cake and for me its mean maybe in a year. thank you very much <?php// www.server.com/auth.php?user=felix&pass=felixpassword//check if querystrings exist or notif(empty($_GET['user']) || empty($_GET['pass'])) { //no querystrings or wrong syntax echo "wrong query input"; header('HTTP/1.0 404 Not Found'); exit(1); }else { //querystring exist $username = $_GET['user']; $password = $_GET['pass']; }$savedpassword = felixpassword ;$saveduser = felix ;//check pass and user stringif (strcmp($password,$savedpassword)==0 && strcmp($username,$saveduser)==0 ) { echo "Password and Username OK! "; }else { echo "password or username wrong! "; header('HTTP/1.0 404 Not Found'); //kein stream }?>
  3. excuse me but i dont know coding comand im using coppy paste i also try some examples on my own but no succses i try like this not working <?php // www.server.com/auth.php?user=felix&pass=felixpassword //check if querystrings exist or not if(empty($_GET['user']) || empty($_GET['pass'])) { //no querystrings or wrong syntax echo "wrong query input"; header('HTTP/1.0 404 Not Found'); exit(1); } else { $users = array( array("username" => "jim", "password" => "pass1"), array("username" => "john", "password" => "pass12"), array("username" => "julie", "password" => "pass123") ); $username = $_GET["user"]; $password = $_GET["pass"]; for($i = 0; $i < count($users); $i++){ $user = $users[$i]; if($user["username"] === $username && $user["password"] === $password){ echo "successfully logged in as " . $username; } } else { echo "password or username wrong! "; header('HTTP/1.0 404 Not Found'); //kein stream } ?> also this not working <?php // www.server.com/auth.php?user=felix&pass=felixpassword //check if querystrings exist or not if(empty($_GET['user']) || empty($_GET['pass'])) { //no querystrings or wrong syntax echo "wrong query input"; header('HTTP/1.0 404 Not Found'); exit(1); } else { $userPasswordMapper = array( "jim" => "pass1", "john" => "pass12", "julie" => "pass123" ); $username = $_GET["user"]; $password = $_GET["pass"]; //submitted user exists in $users array //and the submitted password matches the value mapped to that user in the array if($userPasswordMapper[$username] && $userPasswordMapper[$username] === $password ){ echo "successfully logged in as " . $username; } else { echo "password or username wrong! "; header('HTTP/1.0 404 Not Found'); //kein stream } ?>
  4. i try like this with array after i doo like in example it not cheking names it play even with single leter as user and password www.server.com/auth.php?user=d&pass=nn what i try to do is to play just with names in script i also try more combination with array but no succes // www.server.com/auth.php?user=felix&pass=felixpassword //check if querystrings exist or not if(empty($_GET['user']) || empty($_GET['pass'])) { //no querystrings or wrong syntax echo "wrong query input"; header('HTTP/1.0 404 Not Found'); exit(1); } else { //querystring exist $username = $_GET['user']; $password = $_GET['pass']; } $savedpassword =array("felixpass","felixpass1","felixpass2"); $saveduser = array("felix","felix1","felix2"); //check pass and user string if (strcmp($password,$savedpassword)==0 && strcmp($username,$saveduser)==0 ) { echo "Password and Username OK! "; } else { echo "password or username wrong! "; header('HTTP/1.0 404 Not Found'); //kein stream } ?>
  5. excuse me but still i dont have luck to get script working with more than one user and passwords. script im using for authorization for stream. my stream from server caring space for user and password and it check in auth.php user and password if exist it play if dont find user and password in auth.php it stop stream. in example here <?php // www.server.com/auth.php?user=felix&pass=felixpassword //check if querystrings exist or not if(empty($_GET['user']) || empty($_GET['pass'])) { //no querystrings or wrong syntax echo "wrong query input"; header('HTTP/1.0 404 Not Found'); exit(1); } else { //querystring exist $username = $_GET['user']; $password = $_GET['pass']; } $savedpassword = felixpassword ; $saveduser = felix ; //check pass and user string if (strcmp($password,$savedpassword)==0 && strcmp($username,$saveduser)==0 ) { echo "Password and Username OK! "; } else { echo "password or username wrong! "; header('HTTP/1.0 404 Not Found'); //kein stream } ?> its working with user felix and password felixpassword anything else will not play stream. stream look like this www.server.com/auth.php?user=felix&pass=felixpassword now i need to add one more user or two to play stream but i dont now how for exaple www.server.com/auth.php?user=felix1&pass=felixpassword1. i try with array but its take every name for user and password without checking for users and passwords in auth.php script. its so confusing for me. plesase if somone have time to try help me make it working to sugest what to do to get script working with more names. perhaps to modify above script thank you very much.
  6. script by self check user and pasword in this form and take password felixpassword and for user take felix nothing else $savedpassword = felixpassword ; $saveduser = felix ; if i put in this form evrythig will take as user and password even single leter $savedpassword =array("felix","pass1","pass2"); $saveduser =array("felix","user1","user2");
  7. with array in example its working but not checking names $savedpassword =array("pass","pass1","pass2"); $saveduser =array("user","user1","user2"); please any idea
  8. thank you for your answer my knolege its very small in php if you can give me some example or im lost.
  9. im using php script in nginx server and its working good but im not able to add more user and passwords please here is example if you can help thank you. <?php // www.server.com/auth.php?user=felix&pass=felixpassword //check if querystrings exist or not if(empty($_GET['user']) || empty($_GET['pass'])) { //no querystrings or wrong syntax echo "wrong query input"; header('HTTP/1.0 404 Not Found'); exit(1); } else { //querystring exist $username = $_GET['user']; $password = $_GET['pass']; } $savedpassword = felixpassword ; $saveduser = felix ; //check pass and user string if (strcmp($password,$savedpassword)==0 && strcmp($username,$saveduser)==0 ) { echo "Password and Username OK! "; } else { echo "password or username wrong! "; header('HTTP/1.0 404 Not Found'); //kein stream } ?>
×
×
  • Create New...