Jump to content

crims0nluv

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.alldogsworld.com

Profile Information

  • Gender
    Not Telling

crims0nluv's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Oh man, The output is there all the while. I missed the level at the str_repeat. So sorry and million of thanks. Greatly appreciated =)
  2. Hi all, I have this login form , but it relies on session which gives me the error Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled How can I modify my script so that this error will not appear? I do not want to set the register_globals enabled. Please help. Thanks! <? if($_POST['sublogin']) { $login_error=array(); session_register("login_error"); $flag=0; /* Checks that username is in database and password is correct */ $md5pass = md5($_POST['pass']); $result = confirmUser($_POST['email'], $md5pass); /* Check error codes */ if($result == 1){ $flag=1; array_push($login_error, 'Email address doesn\'t exist.'); } else if($result == 2){ $flag=1; array_push($login_error, 'Incorrect password, please try again.'); } if($flag==0) { session_unregister('login_error'); /* Username and password correct, register session variables */ $_POST['email'] = stripslashes($_POST['email']); $_SESSION['username'] = $_POST['email']; $_SESSION['password'] = $md5pass; if(isset($_POST['remember'])){ setcookie("cookname", $_SESSION['username'], time()+60*60*24*100, "/"); setcookie("cookpass", $_SESSION['password'], time()+60*60*24*100, "/"); setcookie("cookid", $_SESSION['userid'], time()+60*60*24*100, "/"); } echo "<meta http-equiv=\"Refresh\" content=\"0;url=index.php\">"; return; } } ?> <?php if(!$username) { ?> <form name="login" action="<? $PHP_SELF ?>" method="post"> <input type="hidden" value="sublogin" name="sublogin"> <b>LOGIN</b> <br><br> <?php if($flag==1) { foreach($_SESSION['login_error'] as $error) { echo "<font color='#FF0000'>".$error."</font>"; } echo "<br><br>"; } ?> <table> <tr><td>EMAIL ADDRESS :</td><td><input type="text" name="email"></td></tr> <tr><td>PASSWORD: </td><td><input type="password" name="pass"></td></tr> <tr><td colspan="2"><a href="forgot-password.php">FORGOT PASSWORD</a></td></tr> <tr><td colspan="2"><input type="checkbox" name="remember" >REMEMBER ME </td></tr> </table>
  3. Hi Barand, Thanks so much for your reply =) I tried the query you gave me, however, the output is wrong. Reversing will give me the level from 0-4, but some might be 2nd level, some might be 3rd, and there are duplication. For example, Peter and Doe both are in level 2. I couldn't manage to find out which level they are at. Thanks!!
  4. Hi all, I have been trying to solve this, but I couldn't seem to get it right. Hope someone can help with my script. Seems like i'm not getting the logic right. I tried to do while loop in it, but it will be infinite loop Below is the question and my scripts. Thanks there are two tables, Names(ID INT primary key, Name varchar(255)) Relationships(NameID INT, Parent_NameID INT) Linked via Names.ID=Relationships.NameID and where top-most name has a Parent_NameID=0 Show a nested list of names including Level, NameID and Name, where Level indicates the nest level(or depth) from the top as indicated in the expected output below. Sample : ID Name 1 John 2 Mary 3 Doe 4 Jane 5 Peter Relationships table content NameID Parent_NameID 1 0 2 1 3 2 4 1 5 2 Expected output The sequence of the output, in which child elements appear immediately beneath their respective parent elements Level ID Name 0 1 John 1 2 Mary 2 5 Peter 2 3 Doe 1 4 Jane $query=mysql_query("SELECT * FROM Names a, Relationships b WHERE a.ID=b.NameID") or die(mysql_error()); $row=mysql_fetch_array($query); $count=mysql_query("SELECT count(*) as num FROM Relationships"); $count_rel=mysql_fetch_array($count); $num= $count_rel['num']; $level=0; for($i=0; $i<$num; $i++) { $parent=mysql_query($cmd="SELECT * FROM Relationships WHERE NameID='".$row['Parent_NameID']."'") or die(mysql_error()); $row2=mysql_fetch_array($parent); if($row2['Parent_NameID']!='0') { $level=$level+1; } echo $level; }
  5. Hi all, I know this is a very simple question but I can't seem to get it right. Is there anyway I wanted the user to type inside the textarea aligning from top 5px and left indent 5px ? Indented from the textarea border top and left. Any possible way to do it? I wanted it to be indented because I have textarea background image which will block the wordings if it is too close to the borders <textarea cols="68" name="category" rows="6" wrap="virtual" /> Thanks!
  6. I have just noticed another thing. The value cannot be passed when only one contact is in the group after filtering. Means there is only one record in the array. Weird....
  7. Thanks for your reply! =] Really appreciate it. It didn't work as well. I think it's at the javascript part. It works when I use the code below: ( I do not know how you embed the script =} ) This script doesn't work after the filtering. The one you gave to me only allow user to select one checkbox, but it doesn't work after the filtering too. The reason why i put a new line break at the end because all the values selected (which may be more than one checkbox value) will be pass to a textarea at the parent window. Any advise ? Thanks ! function post_value(){ var c_value = ""; for (var i=0; i < document.form1.select_contact.length; i++) { if (document.form1.select_contact.checked) { c_value = c_value + document.form1.select_contact.value + "\n"; } } opener.document.form.sendto.value=c_value; self.close(); }
  8. Hi there, I have a page that user click on a link "Select from address book". then it pops up a child window that display a list of members. This is my query //gid is when user click on a group in the address book, then will filter out all the users in the group if($_GET['gid']) { $gid=$_GET['gid']; $contacts=mysql_query("SELECT c.*,cg.* FROM contact c, contact_group cg WHERE user__id='$userid' and cg.contact__id=c.contact_id and cg.group__id='$gid'"); } else { $contacts=mysql_query("SELECT * FROM contact WHERE user__id='$userid'"); } //display the result while($row=mysql_fetch_array($contacts)) { ?> <str><td width="26" align="left" height="20"><input type="checkbox" name="select_contact" value="<?= $row['contact_number'] ?>"></td> <td width="298" align="left"><? echo $row['contact_firstname']; ?></td> </tr> <? } ?> This is my submit button. Should pass down the value to the parent page. <input type="button" name="submit" value="Submit" onclick="post_value();"> function post_value(){ var c_value = ""; for (var i=0; i < document.form1.select_contact.length; i++) { if (document.form1.select_contact.checked) { c_value = c_value + document.form1.select_contact.value + "\n"; } } opener.document.form.sendto.value=c_value; self.close(); } This script works if the all the members in the address book is listed out, but when user clicked on a group and click submit, the javascript couldn't aget "document.form1.select_contact.length". it gives me undefined variable when I tried to print. Any solution?? Thanks!!
  9. Hi all, I have this problem with my ajax. I'm very new in ajax and I hope someone can help me out with this. This is my HTML button : <input value="Go" type="button" onclick='javascript:xmlhttpPost("http://www.alldogsworld.com")'> And this is my javascript <script language="Javascript"> function xmlhttpPost(url) { http_request = false; http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); } if (!http_request) { alert('Cannot create XMLHTTP instance'); return false; } http_request.onreadystatechange = alertContents; http_request.open('POST', url, true); var form = document.forms['form1']; var sms_count = form.sms_count.value; var sms = form.Mobile.value; var mobile=sms.split(" "); var ID = form.ID.value; var Password = form.Password.value; var Type = form.Type.value; var Message = form.Message.value; qstr = 'ID=' + ID + '&Password=' + escape(Password) + '&Type=' + Type + '&Message=' + Message; var i=0; for(i=0;i<sms_count;i++) { var Mobile=mobile; alert(qstr+'&Mobile='+Mobile); http_request.send(null); } </script> I have tried modifying the prefs.js file,but then it only works for localhost, and I get the same error when I uploaded the file into the webserver. What should I do to eliminate the error ? These are 3 lines I put in the prefs.js file in my own computer. user_pref("capability.policy.XMLHttpRequestToAnySite.XMLHttpRequest.open","allAccess"); user_pref("capability.policy.XMLHttpRequestToAnySite.sites", "http://localhost"); user_pref("capability.policy.policynames", "XMLHttpRequestToAnySite"); Please help. Thanks so much!
  10. Hii, I am integrating an SMS gateway and I am trying to loop the submit form. For example, when the user clicks submit, and detects that they are 5 recipients, the form action will run 5 times. How can we achieve that ? Any help greatly appreciated. Thanks! =]
  11. Hi, Thanks for your reply Actually what I'm trying to do it to get the function simplexml_load_string works in PHP4. So what I did is that , ( I got the code from somewhere else) include('xmlobject.php'); $xml = new Xml; $source = $str; $out = $xml->parse($source, NULL); print_r($out); foreach ($out->contact as $contact) { $result[] = array('name' => (string) $contact['name'], 'email' => (string) $contact['email']); } return $result; } the $out gives me the array : Array ( * => [1] => [2] => [3] => Array ( [contact] => {{1}} [contact-ATTR] => Array ( * => Array ( [name] => rose => rose@gmail.com ) [1] => Array ( [name] => Sylph => sylph@gmail.com ) ) ) ) I put the xmlobject.php at http://www.alldogsworld.com/xmlobject.txt The code is quite long. Or do you have any other method to replace the function simplexml_load_string in php4 ? Thanks again
  12. Hi all, I know this sounds easy but I'm a newbie and I can't seem to be able to get the value in an array. The result is the array that I got $result= Array ( [0] => [1] => [2] => [3] => Array ( [contact] => {{1}} [contact-ATTR] => Array ( [0] => Array ( [name] => rose => rose@gmail.com ) [1] => Array ( [name] => Sylph => sylph@gmail.com ) ) ) ) $result = array(); foreach ($result as $contact) { $result[] = array('name' => (string) $contact['name'], 'email' => (string) $contact['email']); } return $result; However, I get the error "Invalid argument supplied for foreach() " . Anyone can help me here? Thanks in advance
  13. ohh i see. =) How is it if I want to insert the whole junk into database, without going through to insert one value by one value? Is it possible? Thanks!
  14. Hello~ I have been trying to insert the post data into the database together with other some other information, but i couldn't seem to be able to insert it. I hope you all can help me Here is my coding. $this->post = $GLOBALS[HTTP_POST_VARS]; if (count($this->post)) { $item=$this->post; foreach ($item as $value) echo ($value.'<br>'); $tstring = implode(',' , $item); $item_query=INSERT INTO idea_bank ($item) VALUES ('$tstring'); mysql_query ($item_query); Other than this, I would like to insert another value which is $cid=$_GET['cid']; So I would to insert this to. how do I go about?? Thanks!!!
  15. Hi, thanks for your reply. i have downloaded it, and start the service. however, the service started for a moment and automatically stops. it can't seem to start. i set it as auto start but still i have to manually set it. it's written that it does not compatible with windows 98 and win Me only but i am using winXP
×
×
  • 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.