Jump to content

netfrugal

Members
  • Posts

    26
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male

netfrugal's Achievements

Member

Member (2/5)

0

Reputation

  1. I have 2 files. One file is calling the other file with javascript. This is that I have in the header of index.php: <script type="text/javascript"> httpRequest.open("GET", "/status_page.php", true); // grabbing an integer from this page httpRequest.send(null); httpRequest.onreadystatechange = function() { checkState(); }; function checkState() { if (httpRequest.readyState == 4) { if (httpRequest.status == 200) { var statusCheck = httpRequest.responseText; if (statusCheck == "0"){ window.location = "/logout.php"; } } //End status if } //End readyState If } //End CheckState-Function </script> This works fine. However, I wanted to modify this by not writing the redirect url. I am trying to figure out if I can pass the (window.location="/logout.php") to index.php from the status_page.php When I try that, it simply doesn't work. My guess is the javascript must be written to the page after the main page (index.php) has loaded. And therefore, any extra js will be ignored. But again, I don't want to post the url for everyone to see. Does anyone know of a way to pass a js command after the browser has loaded? Or another work-around?
  2. I want to test how much processor power is being used for 2 things. Anything from time to how much effort the server is making to perform each task. Does anyone know how to do a comparison like this?
  3. Is it possible to pass credit card data securely from one website to another (on a totally different server)? Basically, a live data feed of orders from external websites, not hosted on the same server where the info is passed onto the gateway? I can't image passing cc info via the url string and expecting that to be secure. for example: https://somesite.com?fname=jon&lname&ccnumber=4111111111111111&exp=MMYY.......... Am I just being paranoid? Or is this ok to do?
  4. I have a page that shows all the rows from my MySQL database for my contacts table. I would like to replace the Address Column with only a small image. With that image I'd like to only Scroll my mouse over it and have a quick Popup show what the address for that contact is. Is there a way to do this with Ajax? If so, would someone direct me to a tutorials that can teach me this? thanks!
  5. Does anyone know of a good tutorial that allows us to create a rollover image/link that enables a popup box onRollover and disappears onRollout. But the info must be database driven for a list of rows I'm pulling from mysql. So, basically I would like to show a list of rows from mysql for my contacts. And instead of showing the addresses of all contacts, I'd like an image or a link to represent them, and when you scroll your mouse over the image or link, then a popup box shows with the address information. I know that javascript or maybe ajax can be used for this, but I have been unsuccessful with finding one so far. thanks!
  6. I found a tutorial online from this site: [URL=http://www.phpeasystep.com/mysql/10.html]http://www.phpeasystep.com/mysql/10.html[/URL] Now, I have attempted using the code provided, but I consistantly get an error concerning the header() function found on the bottom on the script. What am I not understanding about header information? I always get this error: [B]Warning: Cannot modify header information - headers already sent by (output started at C:\apache\Apache2\htdocs\PHP\update\update.php:9) in C:\apache\Apache2\htdocs\PHP\update\update.php on line 71[/B] Is the tutorial not correct?  Because I've seen similar tutorials that put the header() function in similar places too. Here is the code: <strong>Update multiple rows in mysql</strong><br> <?php $host="localhost"; // Host name $username="root"; // Mysql username $password="password"; // Mysql password $db_name="test"; // Database name $tbl_name="test_mysql"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name"; $result=mysql_query($sql); // Count table rows $count=mysql_num_rows($result); ?> <table width="500" border="0" cellspacing="1" cellpadding="0"> <form name="form1" method="post" action=""> <tr> <td> <table width="500" border="0" cellspacing="1" cellpadding="0"> <tr> <td align="center"><strong>Id</strong></td> <td align="center"><strong>Name</strong></td> <td align="center"><strong>Lastname</strong></td> <td align="center"><strong>Email</strong></td> </tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td align="center"><? $id[]=$rows['id']; ?><? echo $rows['id']; ?></td> <td align="center"><input name="name[]" type="text" id="name" value="<? echo $rows['name']; ?>"></td> <td align="center"><input name="lastname[]" type="text" id="lastname" value="<? echo $rows['lastname']; ?>"></td> <td align="center"><input name="email[]" type="text" id="email" value="<? echo $rows['email']; ?>"></td> </tr> <?php } ?> <tr> <td colspan="4" align="center"><input type="submit" name="Submit" value="Submit"></td> </tr> </table> </td> </tr> </form> </table> <?php // Check if button name "Submit" is active, do this if($Submit){ for($i=0;$i<$count;$i++){ $sql1="UPDATE $tbl_name SET name='$name[$i]', lastname='$lastname[$i]', email='$email[$i]' WHERE id='$id[$i]'"; $result1=mysql_query($sql1); } } [B][COLOR=DarkRed]if($result1){ header("location:update.php"); }[/COLOR][/B] mysql_close();  ?> This is a script to update multiple rows from one form. It is driving me crazy!
  7. I have a list of emails and I want to email only selected people by clicking on a checkbox next to their record. So I created a nice table that shows all records and a checkbox next to each record with the recordID as the value. But, I am not sure where to go from here.  The next page has the mail() function, but I don't know what to do next. [B]here's the code on page 1:[/B] [COLOR=DarkOrange]<form name="form1" method="post" action="mail-to-some.php">[/COLOR]           [COLOR=DarkGreen] <tr>             <td class="nicetableheader">REQUESTOR</td> <td class="nicetableheader">NAME</td> <td class="nicetableheader">checkbox</td>           </tr>[/COLOR] [COLOR=DarkRed]<? while ($row = mysql_fetch_array($sql)) { $recID = $row['recID']; $name = $row['name']; ?>[/COLOR]               <tr> [COLOR=DarkGreen]<td class="nicetablerow">[/COLOR][COLOR=DarkRed]<?php echo $name; ?>[/COLOR][COLOR=DarkGreen]</td>                 <td class="nicetablerow" align="center">[/COLOR][COLOR=DarkOrange]<input name="sendto" type="checkbox" value="[/COLOR][COLOR=DarkRed]<? echo $recID; ?>[/COLOR]" />[COLOR=DarkGreen]</td>               </tr>[/COLOR] [COLOR=DarkRed]<? } ?> [/COLOR]           [COLOR=DarkGreen]<tr>             <td colspan="16" align="right">[/COLOR][COLOR=DarkOrange]<input class="textbox"  type="submit" name="Submit" value="Submit">[/COLOR] [COLOR=DarkGreen]</td>           </tr> [/COLOR] [COLOR=DarkOrange]</form> [/COLOR] [B]And here's the attempted code on the mail-to-some.php.  I am having alot of problems about how to make the query from the db - depending on what records were chosen from the previous page.[/B] include('includes/configure.php'); [COLOR=DarkRed]$sql = mysql_query("[/COLOR]  [B]?[/B]  [COLOR=DarkRed] "); [/COLOR] [COLOR=DarkRed]while ($row = mysql_fetch_array($sql)) { $email = $row['email'];  [/COLOR] [COLOR=DarkGreen]$to = $email; $mailheaders = "Attention!\n"; $Subject = "My subject"; $msg = "My message\r\n"; mail($to, $Subject, $msg, "From: IT Help Desk", $mailheaders); [/COLOR] [COLOR=DarkRed]} [/COLOR] If I am completely off my rocker on how this is performed correctly, I won't be surprised. but any help will be appreciated!
  8. I would like to submit a form with only 2 radio buttons:  On / Off Is there a way to submit the form when I click one of the radio buttons, and not a submit button?
  9. In my database I have a ton of emails that I want to change: For example: mommy@yahoo.com to  mommy@mydomain.com dad@hotmail.com to  dad@mydomain.com uncle@msn.com to uncle@mydomain.com sister@gmail.com to  sister@mydomain.com I am sure there is a search and replace for mysql that can replace everything between the '@' sign and the '.com' to 'mydomain' but I can't find it. Any help would be appreciated! thanks!
  10. I am lost in this.  Is it possible to match the results from a query in php/mysql to the results from php/openldap? My AD has the needed email addresses, while the MySql has the needed survey results. Both have one common field:  "username" Basically I need to match them up, and of course not everyone will need to be matched, only those people who submitted a survey to the MySql database.  And it would be nice to see the results on one webpage. Any help would be appreciated, as I am stumped on how to match these results. So, below is the code for both sides: MYSQL  & AD --------------------------- MYSQL -------------------------- [color=navy]<? include('includes/configure.php'); $sql = mysql_query("SELECT * FROM results"); // Perform MySQL query on only the current page number's results  ?> <html> <head> <title>survey</title> </head> <body> <table width="100%" border="0" cellpadding="0" cellspacing="0">       <tr>         <td width="100%"  valign="top"><table width="100%" border="0">           <tr>             <td>INCIDENT</td>             <td>REQUESTOR</td>             <td>REQUESTOR email</td>             <td>SUBJECT</td>             <td>DATE SUBMITTED</td> <td class="nicetableheader">DATE CLOSED</td>           </tr> <? while ($row = mysql_fetch_array($sql)) { $username= $row['username']; $subject= $row['subject']; ?>               <tr> <td class="nicetablerow"><?php echo $username; ?></td> <td class="nicetablerow"><?php echo $subject; ?></td>               </tr> <? } ?>         </table> </td></tr></table> </body> </html> [/color] --------------------------------------AD  ----------------- [color=green]<html> <head> <title> User Information Look Up </title> </head> <body> <h1>User Information Look Up </h1> <? $ldapserver=ldap_connect("myserver"); if(!$ldapserver) { print "System Error"; exit(0); } $bind = ldap_bind($ldapserver,"cn=XXX,cn=XXX,dc=XXX,dc=com","XXXXXXXX"); if(!bind) { print "System Error"; exit(0); } $base_dn = "DC=XXX,DC=com"; $filter = "sn=*"; $inforequired = array( "username", "description", "mail", "givenName", "sn", "cn"); $result = ldap_search($ldapserver,$base_dn,$filter,$inforequired); $info = ldap_get_entries($ldapserver,$result); if($info["count"] == 0) { print "<p>No information available"; } else {  ?> <table border=2>   <tr> <td>First name</td> <td>Surname</td> <td>Full Name</td> <td>Department</td> <td>Mail</td> <td>Login</td>   </tr> <? for($i=0;$i<$info["count"];$i++) { $row[$i] = "<tr>" . "<td>" . $info[$i]["givenname"][0] . "</td>" . "<td>" . $info[$i]["sn"][0] . "</td>" . "<td>" . $info[$i]["cn"][0] . "</td>" . "<td>" . $info[$i]["description"][0] . "</td>" . "<td>" . $info[$i]["mail"][0]  . "</td>" . "<td>" . $info[$i]["username"][0]; } sort($row); for($i=0;$i<$info["count"];$i++) print $row[$i] . "\n"; print "</table>"; } print "</body></html>"; ?>[/color]
  11. I am trying to separate this:  mydomain\myname To do this I am using the explode function as such: $word = "mydomain\myname"; $separated = explode("\", $word); echo $separated[0]; echo $separated[1]; However, the backslash does not work.  Is there a way to explode backslashes?
  12. Got it figured out! The best way to do this is to create a batch file that includes php.exe and the php file that needs to be executed: C:\php\php.exe C:\apache2\htdocs\emailscript.php then I set up the scheduled task to run the .bat file when I need it. Next thing to figure out is how to set up a cron job on linux to do the same thing.
  13. I would like to run a simple php file that backs up my database.  The file is in one of the virtual directories.  I know I can do it with other ways, but I'm interested in how to do it on a windows OS, and using the windows scheduled tasks wizard - if possible. I've read that parameters need to be set up, but I don't quite understand what that means. Does anyone know how I can do this in a simple step by step fashion? thanks!
  14. I have 2 pages.  Form.php  & Paginate.php I enter the username into the form.php and it sends me over to paginate.php where it looks for records with the username I chose. I can see all the results on Paginate.php, but if I click to go to the next page (paginate.php?page=2)  everything goes blank! Do the search parameters get lost after one page?  Any help would be appreciated! thanks!
  15. Ah yes, I didn't explain the dates.  The form fields: username, begindate, enddate search for certain employees and the dates of their internet usage.  Unless it is not necessary I put the 00:00:00 into the code to search between time of day as well. However, I am very open to anything better!
×
×
  • 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.