Jump to content

zeidhaddadin

Members
  • Posts

    86
  • Joined

  • Last visited

Everything posted by zeidhaddadin

  1. man the search = search.replace doesn't work .. but the validateRequest worked fine.Thanks
  2. Hi all, I have two questions I hope someone will help me with them:Question 1Whenever Someone enteres to my "database search engine using ADO.NET" a query contains: ' or < it show an ASP.NET compilation page, So here I'm trying to handle the situation by replacing these characters with a space like this: Sub CheckString(ByVal search As String)search = Trim(Replace(search, " ", " "))search = Replace(search,"'","")search = Replace(search,"<","")search = Replace(search,">","")search = Replace(search,"*","")End Sub Also it's being called immediately after Request.QueryString .. using CheckString(search) .. But still the string is not being changed.Question 2I want to declare in my ADO connection the database reader which is called: "dbread" in my application .. So just a question .. I declare it as what.Thanks very much!,zeid======== UPDATE ======= Since I can't reply as first postConcerning the first question ... I noticed not using ByRef .. But Still when searching for: "<script>" or something like this .. It gives me the following error: Can I handle this kind of quieries?Thanks,zeid
  3. yeah thank you did it like this:Public search As StringThanks,zeid
  4. Man same error:Compiler Error Message: BC30451: Name 'search' is not declared
  5. Yeah sure..This is my normal form (index.aspx): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><title>zeid1</title><meta http-equiv="content-type" content="text/html; charset=UTF-8" /><link type="text/css" rel="stylesheet" href="STYLE.css" /></head><body><form method="get" action="SEARCH.aspx"><table cellpadding="0" cellspacing="0" border="0"><tr><td><img src="images/zeid1.gif" alt="zeid1" /></td></tr><tr><td class="td1"> </td></tr><tr><td class="td1"><input type="text" name="search" size="32" /> <input type="submit" value="Search Db" /></td></tr><tr><td class="td1"> </td></tr></table></form><p class="p1">Developed and programmed using <span class="span1">ASP.NET</span> language</p><p class="p2">© 2007, <a href="INDEX.aspx">HOME PAGE</a> - <a href="SUBMIT.aspx">SUBMIT PAGE</a></p></body></html> And this is my Results page (search.aspx): <html><head><title>zeid1</title><meta http-equiv="content-type" content="text/html; charset=UTF-8" /><style type="text/css"><!--p { font-family : Verdana; font-size : 12px; } .p1 { font-size : 11px; text-align : center; } .p2 { font-size : 11px; text-align : justify; } .td1 { background-color : #F6F6F6; } .span1 { font-size : 11px; color : green; } a:link, a:active, a:visited, a:hover { color : #0000FF; }--></style></head><body><br /><center><table cellpadding="0" cellspacing="0" border="0"><tr><td width="750" height="25" class="td1"><p class="p2"> THE SEARCH PROCESS RETURNED WITH THE FOLLOWING RESULTS:</p></td></tr><tr><td width="750" height="25"> </td></tr><configuration><system.web><compilation debug="true" /></system.web></configuration><%@ Import Namespace="System.Data.OleDb" %><%@ Page Language="VB" Debug="true" %><script runat="server">Sub Page_Load()Dim search As StringDim strsearchDim count As IntegerDim sql As Stringsearch = Request.QueryString("search")strsearch = Split(search, " ")CheckLength(search)For count = 0 To UBound(strsearch)sql = "SELECT Url, Description, Date FROM Table1 WHERE Description LIKE '%" & strsearch(0) & "%' AND Description LIKE '%" & strsearch(count) & "%' OR Url LIKE '%" & search & "%' ORDER BY Date DESC"NextDim dbconn As OleDbConnectionDim dbcomm As OleDbCommandDim dbreaddbconn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & server.mappath("db/Database1.mdb"))dbcomm = New OleDbCommand(sql, dbconn)dbconn.Open()dbread = dbcomm.ExecuteReader()CheckHasRows(dbread)dbconn.Close()End subSub CheckHasRows(ByVal dbread)If dbread.hasrows ThenTable1.DataSource = dbreadTable1.DataBind()dbread.Close()ElseResponse.Redirect("/INDEX.aspx")End ifEnd subSub CheckLength(ByVal search As String)If Len(search) < 2 ThenResponse.Redirect("/INDEX.aspx")End ifEnd sub</script><form runat="server"><asp:Repeater id="Table1" runat="server"><ItemTemplate><tr><td width="750" height="17"><p><a href="<%#Container.DataItem("Url")%>"><%#Container.DataItem("Url")%></a></p></td></tr><tr><td width="750" height="17"><p><%#Container.DataItem("Description")%></p></td></tr><tr><td width="750" height="17"><p><span class="span1">INDEXED ON <%#Container.DataItem("Date")%></span></p></td></tr><tr><td width="750" height="10"> </td></tr></ItemTemplate></asp:Repeater></form><tr><td width="750" height="25" class="td1"> </td></tr></table></center><p class="p1">© 2007, <a href="INDEX.aspx">HOME PAGE</a></p></body></html> Thank you very much,zeid
  6. Hi thank you for answering..I tried <%#Container.DataItem("Description").ToString.Replace("search", "<b>search</b>")%>But it only makes any keyword "search" be bold.. But I want it dynamical .. I mean I want it to be Replace(search, "<b>search</b>")so it changes any keyword the user search for..I tried it like this and still gave me search is not defined.Thank you!,zeid
  7. Hi all,I'm trying to replace a word in the container.data when showing my database records like this: <%#Replace(Container.DataItem("Description"), search, <b>search</b>%> but it is giving me that search is not declared.. But I declared it before in the Sub page_load()Can someone tell me how to fix this,zeid
  8. yeah man thank you .. It worked like this:table {margin : auto;text-align : center;}Thanks
  9. Hi all,I want to know which is the best way to align tables in an Strict XHTML site:1- If I used <center> </center> it doesn't validate it as strict.2- Aslo using align="center" ..3- I'm using the following css code to make it in the center:.table { margin-left : 300px; }But its not good..This is my html code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><title>zeid1</title><meta http-equiv="content-type" content="text/html; charset=UTF-8" /><link type="text/css" rel="stylesheet" href="STYLE.css" /></head><body><p><br /><br /><br /></p><p class="p1">Merry Chirstmas and happy new year 2007</p><form method="get" action="SEARCH.aspx"><center><table cellpadding="0" cellspacing="0" border="0"><tr><td class="td1"> </td></tr><tr><td class="td1"><input type="text" name="search" size="32" /> <input type="submit" value="Search Db" /></td></tr><tr><td class="td1"> </td></tr></table></center></form><p class="p1">Programmed using <span class="span1">ASP.NET</span></p></body></html>
  10. Hi all, I have the following page that have a function to show a value ..... I'm trying to get it to work but it doesn't work.. it just refresh the page when I click on the button. <html><head><title>Distances</title><link type="text/css" rel="stylesheet" href="CSS.css" /><script type="text/javascript"><!--function distance(){var city = F1.T1.value;var value;switch (city){case "aqaba" :value = "Distance between Amman and Aqaba is: 280km";break;case "madaba" :value = "Distance between Amman and Madaba is: 27km";break;case "deadsea" :value = "Distance between Amman and Deadsea is: 37km";break;case "kerak" :value = "Distance between Amman and Kerak is: 88km";break;default :value = "Please choose one from these cities: aqaba,madaba,deadsea,kerak";break;}F1.T2.value = value;}--></script></head><body><p>Here on this page you can find the real distance between any city (Cities in this website) in Jordan and the capital of Jordan "Amman", You just have to enter the name of the city and then click on the button "Find distance" to print the distance from that city to Amman in kilometers, (These distances are taken from Google earth).</p><form name="F1"><p><b>Enter name:</b> <input type="text" name="T1" size="30" /> <input type="submit" name="S1" value="Find distance" onclick="distance()" /></p><br /><p><b>Distance is:</b> <input type="text" name="T2" size="30" /></p></form><p><br />To go back to the main page, Click <a href="Main.html">Here</a>.</p></body></html>
  11. any help?? .. btw this program is giving me the length of the string ( a ) not the count of ( b ) string in ( a)..
  12. Q1- Hi all, I have a project that there is a page with textbox and textarea and 2 buttons, I should write a string (word or more) in the textbox then when I click on the "Search" button it should open a window.prompt, which I should enter a char or word and then it should return how many times this word or character is found in the string entered in the textbox and then show it in the textarea, Here is what I have but it's not working: <html><head><title>Page 1</title><script type="text/javascript">function search(){ var a = window.prompt("Enter the string you want to search for:",0); var b = F1.T1.value; var count = 0; for (var i = 0; i <= b.length -1; i++) { if (b.indexOf(a,i)) { count = count + 1; } } F1.A1.value = count;}</script></head><body><br /><br /><form name="F1"><p>Enter value:</p><input type="text" name="T1" size="20" /><input type="button" name="S1" value="Search" onclick="search()" /><input type="button" name="S2" value="Show" onclick="show()" /><br /><p>This is the result:</p><textarea cols="30" rows="6" name="A1" /></textarea></form></body></html> Q2- There is another button named as "Show" .. it should take the string in the textbox and return it like this: (using a function called "show()"..Ex: if the string is "world" then it should write the following in the textarea:wwoworworlworldSo can someone help me please with these two questions,Thanks in advance,zeid
  13. Hi all, How can I do the following:I have an array, each element of this array contains a string which is a site URL such as:myarray[0] = "http://www.google.com"so how can I print it (the whole string) and make it a link to the url it contains, I have got this but it is not working: document.write("<a href=\"urlsarray[x]\">" + urlsarray[x] + "</a>" + "<br />") Thanks in advance,zeid
  14. Hi all, I have a project which the main idea is: to recieve a string variable from the first page and pass it to the second page, Then I should make it run inside a loop for an array of strings, and if it match any part of that (element) string then it should print it, This is what I have till now for example: var search = "news"var myarray = new Array(3)myarray[0] = "news world"myarray[1] = "computer"myarray[2] = "my news world"for (var x = 0, var max = myarray.length; x < max; x++){if myarray[x].match(search){document.write(myarray[x] + "<br />");}} So here it should print myarray[0] and myarray[2] strings? if there is any error can u tell me about it please..Also I want to know if I can do something like (REQUEST.QUERYSTRING) to request the variable passed from the first page to the second page.Thanks in advance,zeid
  15. Thank you very much.. yeah these are the answers :)Thank you again.zeid
  16. Hi, I just want to know:1- What is the different between "position:relative" and "position:absolute", I mean when to use each of them.2- What is the differance between "margin" and "padding", I mean when to use each of them.Thanks,zeid
  17. zeidhaddadin

    CSS / EM & EX

    Hi all, I have a "Web app development" exam 2morrow and I have this question about em and ex relative mesurement:Em is defined in w3schools as: one em is equal to the current font size of the current element.I didn't understand,, I mean what is the current font size of the current element?also the ex.and also can anyone tell me how to compare the em for example with pt..Thanks in advance,zeid
  18. Hi all,I have a search engine, and on the main page there is a text box with two command buttons, Each one should go to a separated Results page ( for example: Form 1 --> Results1.asp and Form2 --> Results2.asp )And this is the code which is not working with me: <div align="center"> <table cellspacing="0" cellpadding="0" border="0"> <tr><td width="400" height="25"><p align="center"><img src="images/zeid1.gif" alt="BETA SEARCH" /></p></td></tr> <tr><td width="400" height="25"><p align="center"><input type="text" size="45" name="Search" /></p></td></tr> <tr><td width="10" height="25"><p align="center"><FORM name="F1" action="SEARCH.asp" method="GET"><input type="submit" value=" Web Search " /></FORM><FORM name="F2" action="SEARCHDB.asp" method="GET"><input type="submit" value=" Db Search " /></FORM></p></td></tr> </table> </div>
  19. now me I didn't get it hehe..ok my problem when using the span only it shows everything inside the table in the left side of it... ( I mean the xhtml page up up )..So what should I change to get it working and showing the content of the table in the center as I want..Considering that I'm using XHTML TRANSIONAL not the STRICT.
  20. I think the the width and height things are ok in the XHTML transalso the div... anyways i tried using <div style="margin: 0 auto;"> but it shows the table in the left of the page...
  21. hi this is my xhtml page <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><title>zeid</title><meta http-equiv="content-type" content="text/html; charset=UTF-8" /><style type="text/css"><!--span {text-align : center;font-family : Verdana;font-size : 10px;} a:link, a:active, a:visited, a:hover {color : #0000ff;}.td1 {background-color : #f6f6f6;}--></style></head><body><form action="SEARCH.ASP" method="get"><div align="center"><table border="0" cellpadding="0" cellspacing="0"> <tr> <td width="415" height="120"></td> </tr> <tr> <td width="415" height="60" class="td1"><span><input type="text" name="SEARCH" size="34" /> <input type="submit" value=" Search " /></span></td> </tr> <tr> <td width="415" height="8"></td> </tr> <tr> <td width="415" height="19"><span>SEARCHING ZEID'S INDEPENDENT DATABASE OVER <!--#INCLUDE FILE="RECORDS.ASP"--> PAGE.</span></td> </tr> <tr> <td width="415" height="18"><span>(C) 2006, <a href="ABOUT.ASP">ABOUT US</a> - <a href="SUBMIT.ASP">SUBMIT PAGE</a> - <a href="INDEX.ASP">HOME PAGE</a></span></td> </tr></table></div></form></body></html> It looks fine when using IE browser, but when using Firefox the texts in the table and all the texts look if the align is on the left not in the center of the page, So can someone please tell me what is the problem..Thanks in advance,zeid
  22. sorry but can you show me an example on the span thing
  23. Hi all, This is my XHTML page: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"><html><head><title>zeid</title><meta http-equiv="content-type" content="text/html; charset=UTF-8"><link rel="stylesheet" type="text/css" href="/STYLE.CSS" /></head><body><form action="SEARCH.ASP" method="get"><div align="center"> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td width="415" height="120"></td> </tr> <tr> <td width="415" height="60" id="td1"><p><input type="text" name="SEARCH" size="34" /> <input type="submit" value=" Search " /></p></td> </tr> <tr> <td width="415" height="8"></td> </tr> <tr> <td width="415" height="19"><p>ZEID IS SEARCHING AN INDEPENDENT DATABASE OVER <!--#INCLUDE FILE="RECORDS.ASP"--> PAGE.</p></td> </tr> <tr> <td width="415" height="18"><p>(C) 2006, <a href="ABOUT.ASP">ABOUT US</a> - <a href="SUBMIT.ASP">SUBMIT PAGE</a> - <a href="INDEX.ASP">HOME PAGE</a></p></td> </tr> </table></div></form></body></html> or you can see: http://www.zeid.us which is only html validated not xhtml site.When I validate it as XHTML everything look fine using IE browser, but when using the Firefox browser.. there is different heights for the <td>'s I mean my table look different or the space between each row is heigher than when using IE browser...So can someone please tell me what is the problem.Thanks in advance,zeid
  24. no there is many td's in the page and I want just one of them to be like this..
×
×
  • Create New...