Jump to content

mark103

Members
  • Posts

    268
  • Joined

  • Last visited

Everything posted by mark103

  1. I understand that and I appriecated it, but you don't need to ask about what is the significance of "more than 4" channels. However, I need to find a way for solution. I have created a mysql database to store the website information which I am using this: <?php session_start(); define('DB_HOST', 'localhost'); define('DB_USER', 'myusername'); define('DB_PASSWORD', 'mypassword'); define('DB_DATABASE', 'mydbname'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; echo implode('<br />',$errmsg_arr); } else { $qrytable1="SELECT id, channels FROM tvguide"; $result1=mysql_query($qrytable1) or die('Error:<br />' . $qry . '<br />' . mysql_error()); while ($row = mysql_fetch_array($result1)) { document.getElementById("channel1").style.visibility = "visible"; document.getElementById("channel1").innerHTML = $row['channel']; } } ?> Now I want to link up the php file in html. Do you know how I can do this and how I can output the data from php to html? Do you know how I can get access to each website when I storing the website links in mysql database and how I can compare the range of programme time before I could resize on each image? I don't want to included my username and password in html as I don't want to take the risk to get my website to get hacking.
  2. It is not rude, it is very rude to ask people "what website you are making and what you are using them for". That's rude to ask.
  3. It got nothing to do with you, it is for my own private use. however, I have output the data from mysql to html, but i don't know how to read the php in html. do you know how? And do you know how i can check the program time on the programme website to see how long the programme will last for, e.g the programme start to run 8:00pm to 8:30pm. Do you know how?
  4. Hi guys, I am working on my tv guide website and I start to kick it off. I am going to store the channels name in a mysql database, but I am not sure how to input each channel name in each different div tag like "channel1", "channel2", "channel3", "channel4", "channel5 and "channel6" when I store more than 4 channels in the database. Does anyone know how? The second things I want to know how I can check on the tv guide program website to compare the time how long the program will last for so I can then resize the image and input each program title in each text on each image instead of create the rows? Any advice would be much appreciated. Thanks in advance
  5. Hi guys I need your help. I am writing the list of code in my javascript and now I want to read my php code from my javascript using with loadjscssfile("test1.php", "js") function. function loadjsfile(filename) { var fileref=document.createElement('script'); fileref.setAttribute("type","text/javascript") fileref.setAttribute("src", filename); document.body.appendChild(fileref); } document.onkeydown = function(ev) { var key; ev = ev || event; key = ev.keyCode; var image1 = document.getElementById("image1").getElementsByTagName("img")[0]; if(key == 13) { if (img1.indexOf('image1_yellow.jpg') != -1) { if (img5.indexOf('picture1_yellow.jpg') != -1) { loadjscssfile("test1.php", "js"); } } } Does anyone know how i can read my php code from javascript?
  6. that don't work, you cant use the comparison == operator instead of the assignment = operator. I have tried it and it don't work.
  7. I think I have found the code that will change the image, but i have two problems right here. When I press on the up arrow button, it change the image, but when I press on the up button again, it doesn't change the image. I think the loop did not get pass it. Can you help? And do you know how i can resize the image using with this code? document.getElementById("image1").innerHTML="<img src='"+path1+"'/>"; here is the update code: function checkKey(e) { e = e || window.event; if(e.keyCode == '38') { if (document.getElementById("image1").src="/images/image_blue.jpg") { window.alert('back to yellow') var path ="/images/image_yellow.jpg"; document.getElementById("image1").innerHTML="<img src='"+path+"'/>"; } else { if (document.getElementById("image1").src="/images/tvguide_yellow.jpg") { window.alert('back to blue') var path1 ="/images/image_blue.jpg"; document.getElementById("image1").innerHTML="<img src='"+path1+"'/>"; } } } thanks in advance
  8. when i press on up and down keyboard button, it doesn't change the image.
  9. i want to change the image from blue to yellow when i press on the keyboard. do you have any idea?
  10. I am using javascript so that I can press on the keyboard buttons such as up and down arrow buttons and i also want to use php to check on the image if the image has a file called "blue_image" then change it. I hope this make a sense why i want to use two languages at the same time.
  11. yes i am using both of them at the same time. I tried to input the <?php to work under <script>, but when I press on the keyboard up and down buttons, it doesn't work. If I remove the <?php, the keyboard buttons will start to work here is the code: <html> <body> <style type="text/css"> body {background:url('/images/blue_background.jpg') no-repeat center center fixed;} </style> <div id="image1" style="position:absolute; overflow:hidden; left:415px; top:157px; width:114px; height:81px; z-index:0"><img src="/images/guide_blue.jpg" alt="" title="" border=0 width=114 height=81></div> <script> <?php $file = "/images/guide_blue.jpg"; document.onkeydown = checkKey; function checkKey(e) { e = e || window.event; if (e.keyCode == '38') { window.alert('up arrow') } else if (e.keyCode == '40') { window.alert('down arrow') } } ?> </script> </body> </html> Any idea how i can get the php to work with javascript??
  12. Hi guys, I need your help, I want to create a filename for the image on the webpage and I also want to out how I can check on the if statement to see if the image on the webpage is exist. $image1 = <div id="image1" style="position:absolute; overflow:hidden; left:415px; top:157px; width:114px; height:81px; z-index:0"><img src="/images/tvguide_blue.jpg" alt="" title="" border=0 width=114 height=81></div> On the webpage, it display as "$image =". Does anyone know how i can create a function for a filename so I can write something like this: if ($image = exist) { // do something } Does anyone have any idea? thanks in advance
  13. Hi guys, Can you please help me, I want to find out how I can check on if statement using with javascript to see if the image on the webpage does exist then replace the image. Does anyone know how i can do this? thanks in advance
  14. Do I have to use flash or html that i want to disable mouse cursor while i can move the boxes on up, down, left and right arrow buttons on the keyboard and i want to watch streaming videos through on flash? the reason i want to do this is because i'm planning to make my own epg website for my personal use only and nobody else will access to my website, only me. If i have to use flash, how i can disable the mouse cursor, how i can move the highlight on the boxes using with keyboard arrows button and how i can extra the information from a 3rd party website to input on my website?
  15. Thanks for your reply guys and thanks for your advice. Do you know what type of script that i should use like iframe as I want to stay in the same page without reloading the whole page and what script would let me to disable the mouse point like the website I linked that I could use the keyboard without the mouse?? Do I need to use MooTools, javascript, css or html?
  16. Hi guys, Can you please help me, I want to start off to make a website to design my own tv channels with menu list. I would like to make 6 rectangle boxes to allow me to use the keyboard arrows button to move up and down to mouseover on each box without using the mouse point, not sure if I would need textboxes. And I am not sure that if I would need to code html or flash development. The website I want to make like this: http://labs.worldtv.com/tv Can you please suggest me what development (html or flash) would be the best for me to make a website like the one I post the link on above? Any advice would be much appreciated. Thanks in advance
  17. Hi guys, I need your help. I am checking on a database as I want to see if I have the same value in the url and in the database. <?php session_start(); define('DB_HOST', 'localhost'); define('DB_USER', 'mydbuser'); define('DB_PASSWORD', 'mydbpass'); define('DB_DATABASE', 'mydbtable'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($var){ return mysql_real_escape_string(strip_tags($var)); } $username = clean($_GET['user']); $password = clean($_GET['pass']); $test = clean($_GET['test']); $public = clean($_GET['public']); if (isset($_GET['user']) && (isset($_GET['pass']))) { if($username == '' || $password == '') { $errmsg_arr[] = 'username or password are missing'; $errflag = true; } } elseif (isset($_GET['user']) || (isset($_GET['test'])) || (isset($_GET['public']))) { if($username == '' || $test == '' || $public == '') { $errmsg_arr[] = 'user or others are missing'; $errflag = true; } } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; echo implode('<br />',$errmsg_arr); } else { $qry="SELECT * FROM members WHERE username='$username' AND passwd='$password'"; $result=mysql_query($qry) or die('Error:<br />' . $qry . '<br />' . mysql_error()); if ($username && $password) { if(mysql_num_rows($result) > 0) { $qrytable1="SELECT images, id, test, links, Public FROM user_list WHERE username='$username'"; $result1=mysql_query($qrytable1) or die('Error:<br />' . $qry . '<br />' . mysql_error()); while ($row = mysql_fetch_array($result1)) { echo "<p id='test'>"; echo $row['test'] . "</p>"; echo '<p id="images"> <a href="images.php?test=test&id='.$row['id'].'">Images</a></td> | <a href="http://' . $row["links"] . '">Link</a> </td> | <a href="delete.php?test=test&id='.$row['id'].'">Delete</a> </td> | <span id="test">'.$row['Public'].'</td>'; } } else { echo "user not found"; } } elseif($username && $test && $public) { $qry="SELECT * FROM members WHERE username='$username'"; $result1=mysql_query($qry) or die('Error:<br />' . $qry . '<br />' . mysql_error()); if(mysql_num_rows($result1) > 0) { $qrytable1="SELECT Public FROM user_list WHERE username='$username' && test='$test'"; $result2=mysql_query($qrytable1) or die('Error:<br />' . $qry . '<br />' . mysql_error()); if(mysql_num_rows($result2) > 0) { $row = mysql_fetch_row($result2); mysql_query("UPDATE user_list SET Public=('$_GET[public]') WHERE username='$username' AND test='$test'"); echo "update!"; } else { echo "already updated!"; } } else { echo "user not found"; } } } ?> This is the function I use to check the value in the database: if (mysql_affected_rows($result2) > 0) { mysql_query("UPDATE user_list SET Public=('$_GET[public]') WHERE username='$username' AND test='$test'"); echo "you have update it!"; } else if (mysql_affected_rows($result2) < 0) { echo "it is not on the database"; } else { echo "you have already updated!"; } When i input the different value in a url bar while the records are not the same as the value in the url and in the database, i can't get passed and I am keep getting "you have already updated!!" when the value in a database are different than I have input in a url. Do you know how i can get pass it when I have input the different value in the url while it is not the same in the database? Any advice would be much appreicated. Thanks, Mark
  18. do anyone know how to check in a database to see if it do have the same data that I have input in the url bar??
  19. Hi guys, I need your help. I am checking on a database as I want to see if the records have been updated or not. <?php session_start(); define('DB_HOST', 'localhost'); define('DB_USER', 'mydbuser'); define('DB_PASSWORD', 'mydbpass'); define('DB_DATABASE', 'mydbtable'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($var){ return mysql_real_escape_string(strip_tags($var)); } $username = clean($_GET['user']); $password = clean($_GET['pass']); $test = clean($_GET['test']); $public = clean($_GET['public']); if (isset($_GET['user']) && (isset($_GET['pass']))) { if($username == '' || $password == '') { $errmsg_arr[] = 'username or password are missing'; $errflag = true; } } elseif (isset($_GET['user']) || (isset($_GET['test'])) || (isset($_GET['public']))) { if($username == '' || $test == '' || $public == '') { $errmsg_arr[] = 'user or others are missing'; $errflag = true; } } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; echo implode('<br />',$errmsg_arr); } else { $qry="SELECT * FROM members WHERE username='$username' AND passwd='$password'"; $result=mysql_query($qry) or die('Error:<br />' . $qry . '<br />' . mysql_error()); if ($username && $password) { if(mysql_num_rows($result) > 0) { $qrytable1="SELECT images, id, test, links, Public FROM user_channel_list WHERE username='$username'"; $result1=mysql_query($qrytable1) or die('Error:<br />' . $qry . '<br />' . mysql_error()); while ($row = mysql_fetch_array($result1)) { echo "<p id='test'>"; echo $row['test'] . "</p>"; echo '<p id="images"> <a href="images.php?test=test&id='.$row['id'].'">Images</a></td> | <a href="http://' . $row["links"] . '">Link</a> </td> | <a href="delete.php?test=test&id='.$row['id'].'">Delete</a> </td> | <span id="test">'.$row['Public'].'</td>'; } } else { echo "user not found"; } } elseif($username && $test && $public) { $qry="SELECT * FROM members WHERE username='$username'"; $result1=mysql_query($qry) or die('Error:<br />' . $qry . '<br />' . mysql_error()); if(mysql_num_rows($result1) > 0) { $qrytable1="SELECT Public FROM user_channel_list WHERE username='$username' && test='$test'"; $result2=mysql_query($qrytable1) or die('Error:<br />' . $qry . '<br />' . mysql_error()); if(mysql_num_rows($result2) > 0) { $row = mysql_fetch_row($result2); mysql_query("UPDATE user_list SET Public=('$_GET[public]') WHERE username='$username' AND test='$test'"); echo "update!"; } else { echo "already updated!"; } } else { echo "user not found"; } } } ?> When I run debug the code on my php, if i input the data in a url bar while the records are the same as the data that I enter in the url, i should get the print out on my php "already updated", but I keep getting "update!". Do you know how i can check on mysql database to see if the records have been updated or not??
  20. Thanks, I have added them in my source code, but when I run the debug i can see no difference than what I had. I keep getting the "you can now store". Any idea?
  21. Ok guys, I am working on my code as I am checking the row in a database that if i have got a same row that I insert the functions in the URL then throw the error that says "you can't store". When I am checking as the rows have already exist, i keep getting "you can now store". Do you know how i can check in a database to see if the rows is exist? here's the code: <?php session_start(); define('DB_HOST', 'localhost'); define('DB_USER', 'mydbuser'); define('DB_PASSWORD', 'mydbpass'); define('DB_DATABASE', 'mydbname'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($var){ return mysql_real_escape_string(strip_tags($var)); } $image = clean($_GET['image']); $strings = clean($_GET['strings']); $username = clean($_GET['user']); $password = clean($_GET['pass']); if (isset($_GET['user']) && (isset($_GET['pass']))) { if($username == '' || $password == '') { $errmsg_arr[] = 'username or password are missing'; $errflag = true; } } if (isset($_GET['image']) || (isset($_GET['strings'])) || (isset($_GET['user']))) { if($image == '' || $strings == '' || $username == '') { $errmsg_arr[] = 'image, strings or username are missing'; $errflag = true; } } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; echo implode('<br />',$errmsg_arr); } else { $insert = array(); if(isset($_GET['image'])) { $insert[] = 'image = \'' . clean($_GET['image']) . '\''; } if(isset($_GET['user'])) { $insert[] = 'user = \'' . clean($_GET['user']) .'\''; } if(isset($_GET['pass'])) { $insert[] = 'pass = \'' . clean($_GET['pass']) . '\''; if (count($insert)>0) { $names = implode(',',$insert); if($image && $strings && $from && $username) { $qry="SELECT * FROM members WHERE username='$username'"; $result=mysql_query($qry) or die('Error:<br />' . $qry . '<br />' . mysql_error()); $row=mysql_fetch_assoc($result); if ($row >= 1) { echo 'you cant store.'; } else { echo 'you can now store'; } } elseif($username && $pass) { echo "working 2"; } } } ?>
  22. Thank you very much for your help ReeceSayer. I can see the problem is solved now thanks
  23. Thanks for your suggest. I need to keep the else if statement because if the clients insert the empty array of the user or pass then I want to throw that error. What I want to do is to get checking if the user and password is set from the GET in the URL whether if they are empty then throw the error. The same things that it goes for the image, strings and the user. Here's an example: if the clients insert the user and pass in the URL, i want to get them checking whether if they are empty or not then throw the error that says "username or password are missing". if the clients insert the image, strings and user in the URL without the pass, i want to get them checking whether if they are empty or not then throw the error that says "image, strings or username are missing". I hope you get this.
×
×
  • 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.