Jump to content

NoUser2U

Members
  • Content Count

    63
  • Joined

  • Last visited

Community Reputation

0 Neutral

About NoUser2U

  • Rank
    Newbie
  1. Thank you for your reply. I read into this Red5 server, and unfortunately, i didn't find an extensive manual or tutorials. I installed it but have trouble finding a good and extensive tutorial or help file. Besides, the original wiki is somehow down, it seems. I was thinking, can't Apache do the task??
  2. Hi, I'd like to stream from a webcam to a server and store it there. It has to be done over the web, so no additional software will be used to stream the data to the server (i.e.: no VLC or consorts. I can manage to capture webcam with JQuery).The video has to be stored on the server for later replay. It has to be possible to stream to the server from any computer (via the webcam). The problem is, I'm a complete newby in the field of multimedia and I don't know what kind of server i need to look for. I have an apache server installed here, but I think I read apache can't do that job well, since it's not designed for that purpose.Requirements for the kind of server: it has to be free, stable, and if possible: popular (in the same way MySQL is very popular under databases). Can you give me directions what to look for? Any search terms, technologies which might come in handy with this? Also, any tutorials in regard with any aspect of this (capturing the webcam, streaming the data to server, storing the data on server, and replaying the data from server) will be much appreciated!
  3. Hi, I use php's header() function for redirection users, using header('Location: some_location');In the php manual, it says: An example of incorrect usage of header() is also given in the same manual:<html><?php/* This will give an error. Note the output* above, which is before the header() call */header('Location: http://www.example.com/');?> BUT, if i paste the exact same code in somefile.php, and then navigate to that file, i do not get an error....Besides, i have used header() in my own site multiple times after outputting content (html elements, text), and yet no error, until today...Today, i inserted a second img using <img src=...> on the same page, and when i try to send the header('Location: ...') now, i get the error of 'headers already sent'. But if i do not include that second <img> element (so only one <img> is used on the site), then no error is given... . I am very confused because of this, the function (and it's corresponding error) is not working as it should... Can somebody please clarify?
  4. Ooh, i didn't know there won't be interference between different users due to each connection being independant. Thank you for your help Ingolme! I will now fix this using mysql_insert_id().
  5. Thnx for the quick reply. I quickly check the php manual to see if there are any pointers to look out for using that method, and i stumbled across these 2 notes: Note: Because mysql_insert_id() acts on the last performed query, be sure to call mysql_insert_id() immediately after the query that generates the value.Note: The value of the MySQL SQL function LAST_INSERT_ID() always contains the most recently generated AUTO_INCREMENT value, and is not reset between queries.(http://php.net/manua...l-insert-id.php) Let's say i use line1: mysql_query(...);Xline2: $appointmentId = mysql_insert_id(); to get the last entered row-id. What if in the miliseconds between line 1 and line 2 (marked X), some other user creates/stores a different appointment (assuming by chance he hit the submit button at the right time). Will line2 then get the id of that other appointment? What are chances of this happening (taking intoaccount a lot of daily active users), if possible? (this was my problem, at least i thought it was possible, and why i didn't implement this method straight away)
  6. Hi ingolme,Thank you for the post. I am already familiar with the use of Foreign Keys and referencing. If i use 3 tables, as you mentioned, then wouldn't it be the same as 'store appointment first, then look up the unique id of it; after that, relate the two'?. I mean, i still would need the unique id of the appointment, and because that id is created as soon as the appointment is stored in the DB, then i would still need to look the appointment up in the DB to get it's unique ID (and the problem here is: what criteria do i use? The solution i see here is: since the unique id is created as soon as the appointment is stored in the database and i don't know this unique id unless i manually look it up in the DB-table, I need to create predefined PHP-unique id, and store that along with the appointment in the same row. This way, this preknown unique-PHP-Id can also be stored along with the invitations that belong to that appointment, and thus there is a direct and precise relationship between appointment and invitations). But there must be another way, right? Or is this a good way? What i also could've done was: Let the user first make the appointment and store it, THEN give him the option of viewing the appointment and sending invitations. He could do this on a page with www.example.com?id=appointmentId for example, where he sees the information about the already stored appointment, and has the option to send invitations. Using this approach, it is simple to relate appointment and invitations, since the appointmentId is in the URL and can be extracted from there easily.And with this approach, it would be easy to use 2 or 3 tables to reference appointments and invitations to eachother, because a unique id of the appoint is known. But I need to do both at the same time (i.e.; create appointment and relate invitation before the appointment is stored in DB).
  7. Hello all, I have a problem which i don't know what the best way to solve is: The situation:A user creates an appointment in an online calendar. While he's filling out the form, he has the option to share this appointment with one or multiple other users (the form is still not submitted).After the form is submitted, the appointment will be stored in the database and the selected users, if any, will be sent an invitation to join the appointment. They are free to accept/deny the invitation. My problem:How do i link the invitations to the appointment, while at the same time the appointment still isn't stored in the database? (it will only be stored once the form is submitted). My first solution:I thought of storing the appointment in the database first, then immediately check for the last database-entry, get the unique-id of the row and send invitations referencing that unique-id. But this won't be accurate if at the same time multiple users create appointments, and appointments can have the same title/name.So i ditched this solution, thinking it wasn't very accurate/precise. My second solution:Then i thought of creating a unique_id with PHP, and using this unique_id to reference the invitations to the appointment. But using this approach, the 'appointments table' will have 2 unique_id's per row; i.e., the appointmentId (INT, PRIMARY KEY, AUTO_INCREMENT) and the php-created unique_id.I believe this trick will do, but it isn't very efficient because you now have 2 unique id's per appointment, and the php_created unique_id's is solely for linking the invitations to the correct appointment. What is the best way to create a fail-safe system, yet effective ??? Thnx in advance
  8. Thank you for your post MrFish (nice nickname btw ). I managed to solve my problem, which was actually pretty simple:The Frontcontroller class get's instantiated on the index page, and it calls the Dispatch() method (see Frontcontroller.php and index.php). Now in the Dispatch() method, a class for a controller (requested from the URL) get's instantiated with the line:// Instantiate Controller $this->object = new $this->controller; So in order for me to call a method INSIDE a view (which is pure html), i have to use: $this->object -> methodname(); My problem was that i had forgotten that a page controller get's instantiated automatically by the Frontcontroller, and all i had to do was use $this->object -> methodname() to call a method of the page controller. Instead, i used controllername::methodname(); which give me the problem of not being able to use '$this' in a method of a page controller.It's a bit confusing, but all in all it was something very straightforward.
  9. Hi,I have a class that has a method which initiates other classes. (problem explanation is below the next snippets of code)Index.php <?phpsession_start();class FrontController{ // properties /* private $view * the view that'll be inserted/called * * * private $frontc_id * ID for METHOD -> which is the selected date from calendarView.php into dayView.php * */ private $controller; private $view; private $frontc_id; private $object; // methods /*Instantiator * */ public static function instantiator() { $instance = new self(); return $instance; } /*Timezone set * */ public function __construct() { // SET TIMEZONE date_default_timezone_set('Europe/Amsterdam'); } /* HANDLER * * Dispatcher * */ public function dispatch() { //localhost/index.php?controller=controller_for_view&method=method_for_controller (this is how my URL's look like) // catch Controllername $controller_catcher = (!empty($_GET['controller'])) ? $_GET['controller'] : 'home'; if(!isset($_SESSION['loggedin'])) { $controller_catcher = 'register'; } $this->controller = $controller_catcher . 'Controller'; // define View $this->view = VIEW_DIR . $controller_catcher . 'View.php'; if(!file_exists($this->view)): die('Page not found, can not find view'); endif; // include Controller $file = CONTR_DIR . $this->controller . '.php'; if(!file_exists($file)): die('Page not found, can not find controller'); endif; require_once($file); // Instantiate Controller $this->object = new $this->controller; // Catch Method if(!empty($_GET['method'])) { $method = 'do' . ucfirst($_GET['method']); // only if method is not empty, do that! // Catch ID's for Method if(empty($_GET['id'])) : $this->object -> $method(); elseif(!empty($_GET['id'])) : $frontc_id = $_GET['id']; $this->object -> $method($frontc_id); endif; } // include View // CHECK FOR LOGGED IN, SEE ALSO DISPATCHER-> catch controller if(!isset($_SESSION['loggedin'])) : require_once(VIEW_DIR . 'config/mainframe2.php'); else : require_once(VIEW_DIR . 'config/mainframe.php'); endif; }}?> Some controller: 'searchresultController.php' <?php// searchresultController.phpclass searchresultController extends Controller{ // properties // methods public function doResult($input=null) { echo searchresultController::doAddfriend(); // THIS IS MY CONCERN, i cannot call this using '$this->doAddfriend()' } private function doAddfriend() { if(isset($_POST['addfriend'])) { return $_POST['addfriend']; } } }?> Basic program flow:Now on the index page the Frontcontroller class gets instantiated and the method 'dispatcher' within that class will be called. The dispatcher method takes parts off of the URL to determine which controller (other classes) and method (from those other classes) to call.So basically, i have a method (dispatcher) in a class (frontcontroller) that instantiates other classes (here: searchresultController). Now inside these other classes i have ofcourse methods and sometimes, i need to call a method from within another method of a controller.In the above 'searchresultController.php' class, i need to call the method doAddfriend() (see: searchresultController.php in method: doResult()). Remember though, an object of the class 'searchresultController' was instantiated by the method 'dispatch()' in the Frontcontroller class.Normally, i call methods using $this->method(). But if i use that in this example, i get an error saying:Fatal error: Call to undefined method FrontController::doAddfriend() in /path/to/my/project/searchresultController.php on line 23 So the only way for me to call these methods is to use controllername::methodname (or self::methodname, which also works), but i cannot use $this->methodname();I am sure the problem lies in the Frontcontroller class, which somehow does not allow me to use '$this->' in other classes (i think it's because i instantiate classes from inside the dispatcher method of the Frontcontroller class).Can somebody please check out the structure and tell me what to change in order for me to use $this->methodname to call methods?
  10. Ooh i see, Thank you for your input, i will adapt to the way of inputting hidden fields!
  11. Thnx for your fast reply Ingolme,I had thought of that and tried it, which worked, but is that the only way possible?How do other sites do it? for example, when you fill in a form and press enter. Then the site redirects you to some page and you see a very long dynamically generated url. It's hard to imagine such a site has a whole load of hidden fields in order to generate the custom url, right?In other words: is there no other 'clean and correct' way to do it?
  12. Dear all,For some time now i'm using the <form> element in this matter:<form method="post" action=?controller=example1&method=example2>I'd like to send data via the 'GET method', but it is essential that the querystring is placed AFTER the action, for example, let's say i have: <form method="get" action="?controller=search&method=getinput"> <input type="text" name="input" /> <input type="text" name="input2"> ... some more inputs etc. etc. ... <input type="submit" value="Submit" /></form> Now what i'd like to have is, after pressing the submit button, my url to look like: "http://example.com?controller=search&method=getinput&input=...&input2=....&etc etc etcThe way it is right now is, when i press the submit button, the url will look like: "http://example.com?input=...&input2=...It somehow completely ignores the 'action' attribute specified in the <form> element.How do i solve this? Thnx in advance!
  13. Thank you so much Deirde! It worked and now i can continue with what i was working on! :)I kind of feel embarrassed since it was actually too easy hehe. Thnx again!
  14. Thank you so much Deirde! It worked and now i can continue with what i was working on! :)I kind of feel embarrassed since it was actually too easy hehe. Thnx again!
  15. Dear all,I have a problem i need to solve which needs to handle functions and missing but specified arguments. Let's say i have a function foo, with argument $bar: <?php function Foo($bar){ echo $bar;}?> When i call this function with an argument inside, for example foo('test'), then output is 'test'....no probs. BUT, I need to be able to call this function without giving argument, for example, calling this function like: <?phpfoo()?> Of course, when called like that, i'll show a custom error page, like one saying 'Argument missing' or so (for example, with die('argument missing!'))....How would i do that? I hope it can be taken care of with __call, but if possible, how would i do that since __call accepts 2 parameters? (see http://www.php.net/manual/en/language.oop5...oading.methods)Much thanks in advance!
×
×
  • Create New...