Jump to content

jj-dr

Members
  • Posts

    23
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jj-dr's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks KingPhillip for your input. I am not quite sure as to how do I do this, and more importantly how do I connect it to a particular video player.
  2. Hi guys. I am trying to implement a video playlist for my church website: http://maranatha.tv ... Click on "CULTOS." Currently, I am using the JW Player for videos and this one uses an XML playlist to show the videos or LiveStream. I would like to implement a MySQL playlist, so the content can be managed dynamically rather than manually, as is in the case using the XML playlist. Whether I can implement this for the JW player, or another player, I have no idea where to start and how to go about it. Can someone share some light as to how to implement a PHP & MYSQL video playlist? Any help will be greatly appreciated. Thanks!
  3. One last thing, You can also see it online at maranatha.tv. I use jQUERY to render the contents pages. If you click BIBLE, you will only see maranatha.tv on the address bar and not martaha.tv/bible/search.php but thats fine. However if click on any of the links on BIBLE page, it will show the broken link as so: http://maranatha.tv/readbible.php?version=kjv&book=Genesis
  4. OK, guys, I think I need to rephrase my question to clarify. I believe the issue I am facing is how to use PHP include(); This is what exactly happening: I am working in my local machine using WAMP Server. 1) My main index.php file is located in: http://localhost/MARANATHA.tv/index.php 2) This is my folder hierarchy: a) http://localhost/MARANATHA.tv/]index.php b) http://localhost/MARANATHA.tv/_functions/functions.php c) http://localhost/MARANATHA.tv/bible/search.php functions.php is added as an include() in index.php, and it contains the code to include to include the search.php file: include ('bible/search.php'); When I click on the BIBLE button, the right the content of search.php in rendered on the page. We are good up to here. However, when I click on any of the links in search.php, they are broken. For instance if I click on genesis, I am directed to http://localhost/MARANATHA.tv/readbible.php?version=kjv&book=Genesis, which is broken. What's happening, in this case, is that PHP engineis is looking at readbible.php as if this file is included in the main root folder (http://localhost/MARANATHA.tv/readbible.php), and not in the bible folder (http://localhost/MARANATHA.tv/bible/readbible.php) as is supposed to happen. In summary, I need understand how to use includes more properly. I hope this is a bit more clear. Thanks.
  5. Happy New Year, folks! I am having an issue that's been dragging my life for quite some time. I am creating a website for my church maranatha.tv The site's Menu and Content are pulled from a MySQL database I created. As far as this goes, everything is fine; content is pulled from my database with no issues. My problem is as follow: I am including an online bible, which is a third party script I downloaded. This scripts comes with its own database, which I have installed for use in my web server. I used Include() to include the index.php file of the online bible script, from its folder. I just don't know if this the right way to do it. Of course, this script has its own folder and a set of files which makes up the entire bible script. I use an if condition so that when the user clicks on the menu button BIBLE, the script's index.php file is included instead of text from my database. This way of adding the third party script is rendering some unwanted results such as layout distortion (which I don't care at this point), broken links (main issue), and links (although broken) are sent to new pages, instead of staying within my site's CONTENT page template. I need to find a way to make my script more modular so everything renders as intended. Here's my content function: function content(){ // DETERMINE which page ID to USE in our query below ******************** if (!isset($_GET['jesusid'])) { $pageid = '1'; } else { $pageid = preg_replace('#[^0-9]#i', '', $_GET['jesusid']);} // filter everything but numbers for security) //preg_replace($pattern, $replacement, $string);//preg_replace() Function structure // Query the body section for the proper page $query = mysql_query ("SELECT body_text,title,linklabel, author FROM content WHERE id = '$pageid' LIMIT 1 ") or die (mysql_error()); while ($row = mysql_fetch_array($query)) { echo ucwords($row['title']).' por '; echo '<b>'.$row['author']. '</b><br>'; echo ucwords($row['body_text']); //Add Bible Script if (ucwords($row['title'])=='Biblia') //use row title -- UPPERCASED word { include ('bible/__WINDOWS/search.php'); } } } ?> Just click on the BIBLE button, and then on any link within that page and you will see what I mean. I am still learning PHP and I don't have any background integrating third party scripts to an existing PHP website. I hope someone can help me. Thanks in advance for your assistance.
  6. Thank you, Zane. the <br> tag was the one causeing the issue. The css was work, but its being broken by that tag.
  7. Hi guys. I am creating website for my church and I am using PHP MySQL generated menu. I am having a CSS parsing issues (I guess). You can see here http://www.maranatha.tv a regular menu list with a nice horizontal layout. This one is a manual list, and not PHP MySQL generated. However, when I use PHP to generate the list, the menu buttons don't see to float. In this example I use a menu generated from the database and apply the css class ".nav" to stylize. And just for testing purposes, I put another manual list (test 1, Test 2, Test 3) right next to the DB list and this one floats properly: http://www.maranatha.tv/index02.php So I guess the issue lies in the way PHP is handling the CSS when importing from MySQL. Here's my code: 1) The HTML <div id="MENU"> <ul class="nav"> <li><?php menu();?></li> <!NON-DB Manual List--> <li><a href="#">test 1</li> <li><a href="#">test 2</li> <li><a href="#">test 3</li> </ul> </div> 2) The function to genarate the Menu "menu()" function menu(){ echo '<link href="css/jesus_02.css" rel="stylesheet" type="text/css" media="screen"/>'; $query = mysql_query("SELECT id, linklabel FROM content WHERE showing ='1' ORDER BY id ASC") or die(mysql_error()); // *****DETERMINE which page ID to USE in our query below ****** if (!isset($_GET['jesusid'])) { $pageid = '1'; } else { $pageid = preg_replace('#[^0-9]#i', '', $_GET['jesusid']); // filter everything but numbers for security(new) } $menuDisplay = ''; while ($row = mysql_fetch_assoc($query)) { $jesusid = $row['id']; $postLinkLabel = strtolower($row['linklabel']); //strtolower() lowercase buttons //Prepare to Show and Highlight buttons if($jesusid){ //SHOW NORMAL STATE BUTTON $menuDisplay .= '<ul class="nav"><li class="nav"><a href="content.php?jesusid='.$jesusid. '">' . $postLinkLabel. '</a></li></ul><br />';}//EXTERNAL FILE displayed using jQuery } echo $menuDisplay; } 3) The CSS .nav ul{ display:inline-block;} .nav li { font-family:Arial, Helvetica, sans-serif; font-size:11px; line-height:20px; padding:4px; list-style:none; list-style-type:none; float:left; display:block; } .nav li a { font-family:Arial, Helvetica, sans-serif; height:30px; padding:3px; list-style:none; list-style-type:none; text-align:center; text-decoration:none; } .nav li a:hover { font-family:Arial, Helvetica, sans-serif; clear:right; height:30px; padding:3px; list-style:none; list-style-type:none; text-align:center; text-decoration:none; overflow: hidden; color:#35A266; } This is driving me crazy because no matter what I do, the menu list will not float horizontally if it comes from a php function. Thanks in advance for your help
  8. Thank you so much for your help. At this point I am taking a break as I am having lot of pain due to my carpal tunnel syndrome. I will get back to this at some point. Again, your support has been much appreciated.
  9. OK, I updated as recommended. I did, however discovered that we were no putting the commas in the UPDATE query sefter SETting the values. Here's the updated function: function editUser($userUsername, $userPassword, $userEmail, $userRealname, $id) { //Escape input for DB queries $userUsername = mysql_real_escape_string(trim($userUsername)); $userPassword = mysql_real_escape_string(trim($userPassword)); $userEmail = mysql_real_escape_string(trim($userEmail)); $userRealname = mysql_real_escape_string(trim($userRealname)); $id = (int) $id; //See if there is ANOTHER user with same username $query = "SELECT * FROM authorized_users WHERE username = '$userUsername' AND id <> '$id'"; $result = mysql_query($query) or die(mysql_error()) ; if (mysql_num_rows($result) > 0) { /* Username already exists */ echo "<p><p><span class='current_admin'>Username already exists</span>"; echo '<p>Please <a href="javascript:history.go(-1)">Go Back</a> and complete the form<br>'; echo '<META HTTP-EQUIV="Refresh" CONTENT="800; URL=users_authorized.php">'; ## START DEBUGGING CODE echo "Query: $query<br>\n"; echo "Results: <pre>"; while($row = mysql_fetch_assoc($result)) { print_r($row); } echo "<pre>\n"; ## END DEBUGGING CODE } //There is not another user with same username (or user didn't select to change username) $query = "UPDATE authorized_users SET username = '$userUsername', password = '$userPassword', email = '$userEmail', realname = '$userRealname' WHERE id = $id"; $result = mysql_query($query) or die(mysql_error()); if(mysql_affected_rows()==0) { //No matching record found echo "The user does not exist"; } else { echo "The record was successfully updated"; } } and here's what I am getting now when: a) the user name is NOT edited Username already exists Please Go Back and complete the form Query: SELECT * FROM authorized_users WHERE username = 'ko' AND id <> '0' Results: Array ( [id] => 428 [username] => ko [password] => ed73f6b46391b95e1d03c6818a73b8b9 => ko [realname] => ko ) and b) when the username is edited: The user does not exist I definitively think we are getting closer. However, no record is being updated at all in the database.
  10. Ok, here's the update error message I am getting now. Username already exists Please Go Back and complete the form Query: SELECT * FROM authorized_users WHERE username = 'ko' AND id <> '0' Results: Warning: mysql_fetch_assoc() expects parameter 1 to be resource, string given in F:\wamp\www\JavierBooks\website - Back-Up\administrar\includes\functions.php on line 354 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 'password = 'ed73f6b46391b95e1d03c6818a73b8b9' email = 'ko'' at line 3 I fixed several typos I noticed when escaping the form inputs - mysql_real_escape_string(); Thanks.
  11. I found this priceless piece of code. It detects whether javascript is disabled in your browser, and if so it can refresh to or redirect to an alternate javascript-safe page. This is great because now you don't have to worry about using javascript or how you code it, as long as you are willing to create an alternate page for that 3-5% user population that may have javascript disabled (our using a browser that does not support it). You must place the script in between the <head></head> tags of your page. Here's the code: <head> <!--Re-Direct if javascript is disabled on browser--> <noscript> <meta http-equiv="refresh" content="6; URL= myalternatepage.php"><!--THIS IS ALL YOU NEED--> <center><p><table cellpadding="0" cellspacing="0" border="0" width="550" class="redirect"> <tr><td width="100%" valign="top" class="redirect"><p>Your browser does not support JavaScript or you have javascript disabled.</td></tr> <tr><td width="100%" valign="top">You must re-enable JavaScript for a richer experience of this site</td></tr> <tr><td width="100%" valign="top"><b><p>You will be redirected to a javascript-safe website in about 5 SECONDS!</b></td></tr> <tr><td><a href="http://www.plus2net.com/javascript_tutorial/enable_javascript.php" target="_blank"><p>Learn how to enable javascript</a></td> </table> </noscript> <!--END Re-Direct if javascript IS DISABLED--> </head> It all happens in a single line of code, enclosed by the <noscript>tag: <noscript> <meta http-equiv="refresh" content="6; URL= myalternatepage.php"> </noscript> Then you can add any html valid code to let the users know of what's happening (This is optional). Also, you can change the refresh time you want the message to be displayed before it jumps to the new no javascript page. This No Script code will alert visitors about being redirected to a new page. This comes in especially handy for web designers and developers using javascript/jQuery/AJAX. So now your site can be as dynamic and sleek as you want it to be. Good Luck!
  12. Hi mjdamato. I am sorry for the delay in my reply. I have dealing with a lot of pain in my hands lately, due to a severe case of carpal tunnel syndrom. I used the cod eas you suggested : function editUser($userUsername, $userPassword, $userEmail, $userRealname, $id) { //See if there is ANOTHER user with same username $query = "SELECT * FROM authorized_users WHERE username = '$userUsername' AND id <> '$id'"; $query = mysql_query($query) or die(mysql_error()) ; if (mysql_num_rows($query) !== 0) { /* Username already exists */ echo "<p><p><span class='current_admin'>Username already exists</span>"; echo '<p>Please <a href="javascript:history.go(-1)">Go Back</a> and complete the form<br>'; echo '<META HTTP-EQUIV="Refresh" CONTENT="8; URL=users_authorized.php">'; ## START DEBUGGING CODE echo "Query: $query<br>\n"; echo "Results: <pre>"; while($row = mysql_fetch_assoc($query)) { print_r($row); } echo "<pre>\n"; ## END DEBUGGING CODE } } ?> Two things I noticed: 1) If I edit the username, it seems to execute, but takes me to a blank page. 2) If edit anything other than the username, I get the following: Username already exists Please Go Back and complete the form Query: Resource id #6 Results: Array ( [id] => 428 [username] => ko [password] => ed73f6b46391b95e1d03c6818a73b8b9 => ko [realname] => ko ) Did I place your new code in the right place? Thanks for your help.
  13. Here's a nice, yet simple youtube tutorial that I used for the foundation of my cms website: http://www.youtube.com/watch?v=u3ry84gg0fw&feature=relmfu. I used this tutorial to build the back-end of the website. And I used this one for the front end. . I just Love the Dynamic Menu he created. By the end of the third video, should have the front end completed. Even though he builds a full cms website, the first one is much easier to follow for the back-end/control panel. and this the website I created based on what I learned from them: http://www.javierbooks.com. It's database driven!
  14. Really.... maybe I didn't explain myself well enough. Remember that you are testing the Manage Users, not Manage Posts. OK, test the following and you will see: 1) Click on Manage Users, then click Edit on the first user (a). The update form will load. Just for testing purposes click SAVE without changing anything. One of Two things should happen in the database: a) DB should be updated, but since you haven't changed anything, all data will stay the same. (Currently this is no happening. Since the current user is the one trying to update the database, it should no give you and User Exist error) b) Or nothing should happen since there was no change. 2) Click on Manage Users, then click Edit on the first user (a). Change anything, excluding the username, and the following should happen: a) The database should be updated, and since the username wasn't changed, this will stay the same. (For this test, you are also getting the Username Exist Error text, and this should no happen). 3) Finally, Click on Manage Users, then click Edit on the first user (a). Change anything, including the username, and the following should happen: a) All information should be updated accordingly, and 4 seconds after the User Updated message is displayed, you should see the changes in the Mange Users page. (Again this is not happening. Even when the User Updated message is displayed, you will see that no actual changes occurred in the database when you check the Manage Users page). So there's something in the structure of the code that is wrong because are getting any database errors. I hope this is a bit more clear. Thank you so much for help. It's very appreciated. Here's the link again, http://javierbooks.comuf.com/administrar
  15. Actually, single quotes were missing in both WHERE clauses, in the '$id' variable. I fixed that, and I am not getting that error anymore. However, the bahavior of the script has changed as follow: 1) Again, the unknow column error is gone. 2) If I try to edit anything other than the username, it will display the "Username already exists" text, and no update will take place in the database. 3) If I edit the username (along with any other items), it will display the text User Updated, but the actual update will not take place. One last thing, I noticed you used "not equal to:" !== as opposed to !=. I did test it with a sigle iqual sign, but results did not vary. Here's the updated function: function editUser($userUsername, $userPassword, $userEmail, $userRealname, $id) { //See if there is ANOTHER user with same username $query = "SELECT * FROM authorized_users WHERE username = '$userUsername' AND id <> '$id'"; $query = mysql_query($query) or die(mysql_error()) ; if (mysql_num_rows($query) !== 0) { /* Username already exists */ echo "<p><p><span class='current_admin'>Username already exists</span>"; echo '<p>Please <a href="javascript:history.go(-1)">Go Back</a> and complete the form<br>'; echo '<META HTTP-EQUIV="Refresh" CONTENT="8; URL=users_authorized.php">'; } else { /* Username doesn't exist */ $query = "UPDATE authorized_users SET username ='$userUsername', password = '$userPassword', email = '$userEmail', realname = '$userRealname' WHERE id = '$id'"; $query = mysql_query($query) or die (mysql_error()); echo '<p><p><b> 1 User Updated</b>'; echo '<META HTTP-EQUIV="Refresh" CONTENT="4; URL=users_authorized.php">'; } } You can view it in action in this test site: http://javierbooks.comuf.com/administrar/ Just cick on Manage Users and use test for both username and password. Thank you so much for your help!
×
×
  • 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.