Jump to content

Search the Community

Showing results for tags 'php'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. Hey php developers. I'm Brent from Beanstream. We just recently opened up some code bounties to create a PHP SDK that uses our payment gateway API. Each bounty is around 1-5 hours work and their reward is between $150 and $400. The SDK is open source (MIT license) and will be hosted on GitHub. There are already 2 other SDKs written in Java and C# that use the same RESTful payments API, so a lot of the code and functionality can be copied over to the PHP SDK. If you are interested in helping out you can sign up here. You can also check out Beanstream's Payments API to see what the SDK will be implementing: http://developer.beanstream.com Feel free to message me if you have questions. Cheers, Brent Beanstream Internet Commerce
  2. Hey guys, As my name refers, I am a beginner at school. I had a project in which I had to make a database. The database contains movies which you can search for. However in the beginning, the results only appeared when the name of the movie was fully written. I solved it by using 'LIKE' in the query. But now I got the problem of results being shown before you searched for the results. The form is on the same file as the result. I could seperate them but in this case, it's no option (for some reasons which doesn't matter). Can this problem get solved in an other way? This is the part of the code of my php file: <form id="form1" name="form1" method="post" action="Website2.php"> <div id="Zoekend"> <p> <label for="textfield"></label> <label for="Zoek"></label> <input type="text" name="Zoek" id="Zoek" /> </p> <p> <label> <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_0" /> Genre</label> <br /> <label> <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_1" /> Naam</label> <br /> <label> <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_2" /> Jaar</label> <br /> <label> <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_3" /> Regisseur</label> <br /> <input type="submit" name="Zoeken" id="Zoeken" value="Zoeken" /> <br /> </p> </form> </div> <div id="Resultaat"> <h1> Zoekresultaten: </h1> <?php $zoekterm = $_POST['Zoek']; $username = '1509506_dyon'; $wachtwoord = 'u2pv6stvk'; $host = 'fdb6.awardspace.net'; $database = '1509506_dyon'; mysql_connect($host, $username, $wachtwoord); mysql_select_db ($database); $sql = "SELECT * FROM Movies WHERE Genre LIKE '%$zoekterm%'"; $resultaat = mysql_query ($sql); while ( $row = mysql_fetch_assoc($resultaat) ) { echo $row['Genre'] . " - " . $row['Naam'] . " - " . $row ['Jaar'] . " - " . $row ['Regisseur'] .'<br>' ; } $sql = "SELECT * FROM Movies WHERE Naam LIKE '%$zoekterm%'"; $resultaat = mysql_query ($sql); while ( $row = mysql_fetch_assoc($resultaat) ) { echo $row['Genre'] . " - " . $row['Naam'] . " - " . $row ['Jaar'] . " - " . $row ['Regisseur'].'<br>' ; } $sql = "SELECT * FROM Movies WHERE Jaar LIKE '%$zoekterm%'"; $resultaat = mysql_query ($sql); while ( $row = mysql_fetch_assoc($resultaat) ) { echo $row['Genre'] . " - " . $row['Naam'] . " - " . $row ['Jaar'] . " - " . $row ['Regisseur'].'<br>' ; } $sql = "SELECT * FROM Movies WHERE Regisseur LIKE '%$zoekterm%'"; $resultaat = mysql_query ($sql); while ( $row = mysql_fetch_assoc($resultaat) ) { echo $row['Genre'] . " - " . $row['Naam'] . " - " . $row ['Jaar'] . " - " . $row ['Regisseur'] .'<br>'; } ?> </div>
  3. Hi everyone, as the title stated, I would like to know how I could submit a form in one page(cart) and unset a session variable on other page. Right now my form is setting a variable within the page back to 0, however I would like the form to unset the session variable from other page as well. The issue with my code is that every time I attempt to clear out all items, my code can empty out the cart. But whenever I close and reopen the cart, the same content will show up again. So I need to unset the session variable. Please let me know what should I do in order to solve the problem and I greatly appreciate your help. My code is currently looking like this: cart.php if(!empty($_GET['aID'])) { $aID = $_GET['aID']; echo $aID; if(isset($_POST['removeAll'])) { $aID = "0"; } $cartSQL = "SELECT * from article where aID in ($aID)"; echo "cart sql :$cartSQL"; $cartQuery = mysqli_query($dbc, $cartSQL) or die (mysqli_error($dbc)); while($row = mysqli_fetch_array($cartQuery, MYSQLI_BOTH)) { $aTitle[] = $row[ 'name' ]; } } <form action = "" method = "POST"> <td style = "width = 200px"><input type="submit" value="Empty cart" name="removeAll"></td> </form> And this is the session variable from other page where I would like it to be unset upon submitting the form. if(!empty($cartSubmit)) $_SESSION["cartSubmit"] = $cartSubmit; else $cart = $_SESSION["cartSubmit"]; <a href="javascript:popup('cart.php?aID=<?php if(empty($cartSubmit)) echo "$cart"; else echo "$cartSubmit";?>')">Cart</a>
  4. Create a data form that should accept odd number of words in a particular sentence Input Example: I am working in retailon. and should display the output as reversing first and last word and second word to fourth word and so on and the middle word should be same and should also display the number of words. Output Example: retailon in working am i. words=5. Input:I am Working in Google. Output:Google in Working am I. Words:5
  5. Hi guys .. please help me .. I don't know how to do this and I tried but there were no satisfied results.. I want to retrieve a Title (ing_title) from a database called k_db2 , in a table called content_langs depending on its ID , which called ing_contID example: if ing_contID=1 , then show the ing_title with this id ing_contID the above code should be in a php file .. then I want to include this php file inside the header of my website.. by importing the ing_contID from the database and depending on it the title should be shown.. I really tried but I couldn't find any solution .. if you could help me in the first part of this problem I'll be glad ..
  6. Hello. I need help. It is posible to make php file.. index. The main page on website like <?php //sillence is golden I want this but i want to know it is posible? Please help
  7. database.php ________________________________________________________________________________________ $res = pg_query ($conn, "SELECT artist, composer, genre, title, album, label, price, description FROM music"); echo "<table border='1'>"; while($a = pg_fetch_array($res)){ echo "<td>" . $a['1'] . "</td>"; echo "<td>" . $a['2'] . "</td>"; echo "<td>" . $a['3'] . "</td>"; echo "<td>" . $a['4'] . "</td>"; echo "<td>" . $a['5'] . "</td>"; echo "<td>" . $a['6'] . "</td>"; echo "<td>" . $a['7'] . "</td>"; echo '<td><input type="checkbox" name="music[]" value="$ref"' . $row['0'] . $row['1'] . $row['2'] . $row['3'] . $row['4'] . $row['5'] . $row['6'] . $row['7'] . '"/></td>'; echo"</tr>"; } echo "</table>\n"; ?> _____________________________________________________________________________- shoppingbasket.php _____________________________________________________________________________- <form action="shoppingbasket.php" method="POST"> Send To Basket: <name="music"> <input type="submit" value="submit"> </form> cant get it to send data from database to this page shoppingbasket.php if(isset($_POST['music'])){ if (is_array($_POST['music'])) { foreach($_POST['music'] as $row){ echo $row; } } else { $row = $_POST['music']; echo $row; } }
  8. I use this code to open the contents of my Menu Links inside my <div id="main"> so I do not need to reload the whole page each time: .delegate('a.difflink', 'click', function(){ $('#content').empty(); var page = $(this).attr('id'); $('#content').load("page_scripts/loop_a.php?page="+ page); Problem created is that by using the above method my browser's address bar always shows www.myXample.com so I cannot create sitemap for SEO. And as I understood (not sure if I am correct) the way I made it work is like there are no new urls to show (since I am just changing div content). QUESTION: Is there a way to make my page work as it should e.g when I press "Downloads" --- address will show: www.myXample.com/downloads and still no need to reload the whole page? A solution would be to use this in my code: window.history.pushState('','','/downloads'); it changes the url to the desired BUT if I manually enter on my browser www.myXample.com/downloads I get just the contents of the div without any page formatting or menus, which is natural result. So is there a work around to achieve my goal or is it one of two: Reloading the whole page Vs No reloading and no URLs for SEO.
  9. hi to all.Im currently displaying the images from my upload directory but the image does not display.please help thanks <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form enctype="multipart/form-data"> <?php include 'connect.php'; $dir = '/images/advisory'; $res = mysql_query("Select * from image_advisory INNER JOIN main_advisory ON image_advisory.advisory_id = main_advisory.id "); echo"<table border='1px'>"; while($row=mysql_fetch_array($res)) { echo"<tr>"; echo"<td>"; echo $row['advisory']; echo "</td>"; echo"<td>";?><img src="<?php echo images/advisory/'.$row["ad_img"].'; ?>" height="100" width ="100" > <?php echo "</td>";//this is the error please help echo"</tr>"; } echo "</table>"; ?> </form> </body> </html>
  10. Hello everyone, I am working on a form that is similar to a shopping cart system and I am thinking of creating a button that submits the checked value and saves them to a $_SESSION variable. And also a link that links to a cart.html that takes the values of a $_SESSION variable. I am have trouble figuring what tag/attribute should I use in order to achieve that. Right now my code attached below submits the checked values to cart.html directly. However I want my submit button to save the checked box to a $_SESSION variable and STAY on the same page. And then I will implement a <a> to link to the cart.php. I researched a little bit about this subject and I know it's somewhat related to ajax/jquery. I just wanted to know more about it from you guys. I appreciate your attention for reading the post and Thanks! Below is the form that I currently have: <form name= "finalForm" method="POST" action="cart.php"> <input type="Submit" name="finalSelected"/> <?php foreach($FinalName as $key => $item) {?> <tr> <td><input type="checkbox" name="fSelected[]" value="<?php echo htmlspecialchars($FinalID[$key])?>" /> <?php echo "$FinalID[$key] & $item";?> </td> </tr> <?php } ;?> Below is the code for cart.php <?php require ('connect_db.php'); if(isset($_POST['finalSelected'])) { if(!empty($_POST['fSelected'])) { $chosen = $_POST['fSelected']; foreach ($chosen as $item) echo "aID selected: $item </br>"; $delimit = implode(", ", $chosen); print_r($delimit); } } if(isset($delimit)) { $cartSQL = "SELECT * from article where aID in ($delimit)"; $cartQuery = mysqli_query($dbc, $cartSQL) or die (mysqli_error($dbc)); while($row = mysqli_fetch_array($cartQuery, MYSQLI_BOTH)) { $aTitle[] = $row[ 'name' ]; } } ?> <table> <?php if(isset($delimit)) { $c=0; foreach($aTitle as $item) {?> <tr> <td> <?php echo $aTitle[$c]; $c++;?> </td> </tr> <?php }}?> </table>
  11. How should i input language file into db and then output it with user selected language? $username = 'KELLY'; $offerName = 'Crowd Flower'; $amount = '30'; $currency = 'points'; $lang['text']['a_001'] = '%a has just completed the %b offer worth %c %d.';// ENGLISH // $input = str_replace(array('%a','%b','%c','%d'), array($username, $offerName, $amount, $currency), $lang['text']['a_001']); print $input;
  12. I am using multiple levels of JSON data coming into php from a C# application, as in: return new RootObject() { ID_Project = 4, Name_Project = "Test", Receiver_ID = 4, Receiver_Name = "ABCDE", UserID = 20, UserRole = new User_Role() { ID_User = 20, Role_User = "level 3", User_Role_Description = "U", UserGroup = new List<user_group>() { new User_Group() { ID_UserGroup = 30, Name_UserGroup = "usergroup8", UserID = 20 }, new User_Group() { ID_UserGroup = 31, Name_UserGroup = "usergroup9", UserID = 21 }, new User_Group() { ID_UserGroup = 32, Name_UserGroup = "usergroup10", UserID = 22 } } } }; i am having troubles accessing the second level: UserRole and 3rd level: User_Group in my php script. im currently trying like this: foreach ($phpArray as $key => $value) { echo "<h2>$key</h2>"; foreach ($value as $k => $v) { echo "$k | $v "; foreach ($v as $key1) { echo "$key1 "; } } } does anyone have an idea? :confused: Thanks, Revathy
  13. I get all the results displayed but how can I echo the total value for for all rows found for under column 'duration' which only contains numbers (seconds). $query = "SELECT * FROM asterisk_cdr WHERE calldate LIKE '%$calldate%' AND channel LIKE '%$channel%' AND duration"; $result = mysqli_query($dbcon, $query) or die('Error getting data'); $num_rows = mysqli_num_rows($result);
  14. I'm experimenting with a basic CRUD App. The table created by the code below renders, however when I view source, the last tag is the closing </tr> after the while loop finishes. There's nothing after that. No closing table, html, or body tags. I can't see what I've done wrong. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Eric's PHP CRUD App</title> <style type="text/css"> table { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; text-align: center; margin: 0 auto; } table td { text-align:center; border: 1px solid #dfdfdf; } tr:nth-child(odd) { background: #fdfdfd; } tr:nth-child(even) { background: #B8D3FF; } th { background-color:#ccc; } .center { width: 1050px; margin:0px auto; } h1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; padding-bottom: 15px; text-align: center; margin: 0 auto; color: white; } </style> </head> <body bgcolor="#999"> <?php require_once("db_connect.php"); echo "<h1>Update Student Records</h1>"; echo "<table cellpadding='10'>"; echo "<tr bgcolor='#cccccc'>"; echo "<th>First Name</th>"; echo "<th>Last Name</th>"; echo "<th>Test 1 Grade</th>"; echo "<th>Test 2 Grade</th>"; echo "<th>Test 3 Grade</th>"; echo "<th>Test 4 Grade</th>"; echo "<th>Final Exam Grade</th>"; echo "<th>Average Grade</th>"; echo "<th>Final Grade</th>"; echo "<th>delete</th>"; echo "<th>edit</th>"; echo "</tr>"; $sql = "SELECT * FROM students"; $result = mysqli_query($link, $sql) or die(mysql_error()); while($row = mysqli_fetch_array($result, MYSQLI_ASSOC) or die(mysql_error())) { $final = ""; $average = (($row["test1Grade"]) + ($row["test2Grade"]) + ($row["test3Grade"]) + ($row["test4Grade"]) + ($row["finalExamGrade"])) / 5; if ($average >= 90) { $final = "A"; } else if ($average >= 80) { $final = "B"; } else if ($average >= 70) { $final = "C"; } else if ($average >= 60) { $final = "D"; } else if ($average < 60) { $final = "F"; } echo "<tr>"; echo "<td>" . $row["firstName"] . "</td>"; echo "<td>" . $row["lastName"] . "</td>"; echo "<td>" . $row["test1Grade"] . "</td>"; echo "<td>" . $row["test2Grade"] . "</td>"; echo "<td>" . $row["test3Grade"] . "</td>"; echo "<td>" . $row["test4Grade"] . "</td>"; echo "<td>" . $row["finalExamGrade"] . "</td>"; echo "<td>" . round($average) . "</td>"; echo "<td>" . $final . "</td>"; echo "<td><a href='delete.php?id=" . $row['studentID'] . "'>›</a></td>"; echo "<td><a href='update.php?id=" . $row['studentID'] . "'>›</a></td>"; echo "</tr>"; } echo "</table>"; ?> <a href='insert.php'>Add new student</a> </body> </html>
  15. I'll start by apologizing for the stupid decision that led to this question. A few years ago, I created a PHP/Myysql site with a login system and I created a field in the MySQL called "password" and it stored literally the exact password people entered (I know, I know). The site has proven to have nice traffic potential, so I am going to re-vamp everything, including storing passwords properly (i.e. hashed). My first question... Is there a way to convert regular text passwords to hashed passwords? For example, I could create a new field in the "User" table for "hashedpassword" and write a script that takes all the insecure passwords and turns them into hashed passwords. Then deleted the previous "bad" password field from the database. This would allow me to do it without the customer every knowing anything changed. Quick googling appears to support that it IS doable rather easily, with something like... UPDATE mytable SET password = MD5(password) If not, I guess I would have to create a thing where the first time omeone logged in after I put hashing in place, the site would force them to change their password. I'd rather not annoy the visitors if it all possible. Second question, what is the proper/recommended hashing method to use? Some people seem to poo-poo MD5. If you agree, should I use: MD5 SHA MD5 with a salt SHA with a salt Something else i never heard of NOTE: My site is a fantasy sports site, so the data involved is not overly important. Maybe a salt is overkill? Or is being overly safe never a bad thing? Lastly, don't need to address this, but if anyone can explain it like I'm 5 that would be great because i must be missing something... if you can easily turn a regular password into a hashed password, couldn't hackers easily do the reverse, which would render the hashing almost useless? I get that salting helps, but before salting (i.e. doing ONLY MD5), I don't see how hashing helped that much (if you could reverese figure out the password). What am I missing? Thanks! Greg
  16. i am trying to create a small script that will let you 1. Create a PDF from form fields then email that pdf without saving it (was using fpdf for this) 2. within that form there is a file upload - i want to send these along with the pdf crerated in the same email. this is my code so far, the php sends fine but it is sending in 2 seperate emails and i want it all to send in one any help would be much apprichated as i am a compleat noob at PHP! <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Email Attachment Without Upload - Excellent Web World</title> <style> body{ font-family:Arial, Helvetica, sans-serif; font-size:13px;} th{ background:#999999; text-align:right; vertical-align:top;} input{ width:181px;} </style> </head> <body> <form action="emailSend.php" method="post" name="mainform" enctype="multipart/form-data"> <table width="500" border="0" cellpadding="5" cellspacing="5"> <tr> <th>Your Name</th> <td><input name="fieldFormName" type="text"></td> </tr> <tr> <tr> <th>Your Email</th> <td><input name="fieldFormEmail" type="text"></td> </tr> <tr> <th>To Email</th> <td><input name="toEmail" type="text"></td> </tr> <tr> <th>Subject</th> <td><input name="fieldSubject" type="text" id="fieldSubject"></td> </tr> <tr> <th>Comments</th> <td><textarea name="fieldDescription" cols="20" rows="4" id="fieldDescription"></textarea></td> </tr> <tr> <th>Attach Your File</th> <td><input name="attachment" type="file"></td> </tr> <tr> <td colspan="2" style="text-align:center;"><input type="submit" name="Submit" value="Send"><input type="reset" name="Reset" value="Reset"></td> </tr> </table> </form> </body> </html> <?php //create PDF and send // download fpdf class (http://fpdf.org) require("fpdf.php"); // fpdf object $pdf = new FPDF(); // generate a simple PDF (for more info, see http://fpdf.org/en/tutorial/) $pdf->AddPage(); $pdf->SetFont("Arial","B",14); $pdf->Cell(40,10, "this is a pdf example"); // email stuff (change data below) $to = "me@domain.com"; $from = "me@domain.com"; $subject = "send email with pdf attachment"; $message = "<p>Please see the attachment.</p>"; // a random hash will be necessary to send mixed content $separator = md5(time()); // carriage return type (we use a PHP end of line constant) $eol = PHP_EOL; // attachment name $filename = "example.pdf"; // encode data (puts attachment in proper format) $pdfdoc = $pdf->Output("", "S"); $attachment = chunk_split(base64_encode($pdfdoc)); // main header (multipart mandatory) $headers = "From: ".$from.$eol; $headers .= "MIME-Version: 1.0".$eol; $headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\"".$eol.$eol; $headers .= "Content-Transfer-Encoding: 7bit".$eol; $headers .= "This is a MIME encoded message.".$eol.$eol; // message $headers .= "--".$separator.$eol; $headers .= "Content-Type: text/html; charset=\"iso-8859-1\"".$eol; $headers .= "Content-Transfer-Encoding: 8bit".$eol.$eol; $headers .= $message.$eol.$eol; // attachment $headers .= "--".$separator.$eol; $headers .= "Content-Type: application/octet-stream; name=\"".$filename."\"".$eol; $headers .= "Content-Transfer-Encoding: base64".$eol; $headers .= "Content-Disposition: attachment".$eol.$eol; $headers .= $attachment.$eol.$eol; $headers .= "--".$separator."--"; // send message mail($to, $subject, "", $headers); //send uploaded attachments via email $to = $_POST['toEmail']; $fromEmail = $_POST['fieldFormEmail']; $fromName = $_POST['fieldFormName']; $subject = $_POST['fieldSubject']; $message = $_POST['fieldDescription']; /* GET File Variables */ $tmpName = $_FILES['attachment']['tmp_name']; $fileType = $_FILES['attachment']['type']; $fileName = $_FILES['attachment']['name']; /* Start of headers */ $headers = "From: $fromName"; if (file($tmpName)) { /* Reading file ('rb' = read binary) */ $file = fopen($tmpName,'rb'); $data = fread($file,filesize($tmpName)); fclose($file); /* a boundary string */ $randomVal = md5(time()); $mimeBoundary = "==Multipart_Boundary_x{$randomVal}x"; /* Header for File Attachment */ $headers .= "\nMIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/mixed;\n" ; $headers .= " boundary=\"{$mimeBoundary}\""; /* Multipart Boundary above message */ $message = "This is a multi-part message in MIME format.\n\n" . "--{$mimeBoundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; /* Encoding file data */ $data = chunk_split(base64_encode($data)); /* Adding attchment-file to message*/ $message .= "--{$mimeBoundary}\n" . "Content-Type: {$fileType};\n" . " name=\"{$fileName}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mimeBoundary}--\n"; } $flgchk = mail ("$to", "$subject", "$message", "$headers"); if($flgchk){ echo "A email has been sent to: $to"; } else{ echo "Error in Email sending"; } ?>
  17. Hi I am having troubles inserting item into a table with a primary key in it. My problem is that every time I added a row into a table without specifying the primary key, mysql will not add it to the next available id. For example, I have 5 rows initially and I added 10 rows into my table by using the insert into query. However when I delete the 10 rows and add another row in, the id of the additional row will become 16 instead of 6. FYI, this is a php page that inserts my data into the table.
  18. Notice: Undefined index: category in C:\xampp\htdocs\content\cron\check_deposits.php on line 18 Notice: Undefined index: confirmations in C:\xampp\htdocs\content\cron\check_deposits.php on line 19 Notice: Undefined index: address in C:\xampp\htdocs\content\cron\check_deposits.php on line 20 Notice: Undefined index: amount in C:\xampp\htdocs\content\cron\check_deposits.php on line 21 Notice: Undefined index: txid in C:\xampp\htdocs\content\cron\check_deposits.php on line 22 <?php // CRON must be running every minute! $included=true; include '../../inc/db-conf.php'; include '../../inc/wallet_driver.php'; $wallet=new jsonRPCClient($driver_login); include '../../inc/functions.php'; $deposits=mysql_query("SELECT * FROM `deposits`"); while ($dp=mysql_fetch_array($deposits)) { $received=0; $txid=''; $txs=$wallet->listtransactions('',2000); $txs=array_reverse($txs); foreach ($txs as $tx) { if ($tx['category']!='receive') continue; if ($tx['confirmations']<1) continue; if ($tx['address']!=$dp['address']) continue; $received=$tx['amount']; $txid=$tx['txid']; break; } if ($received<0.00000001) continue; $txid=($txid=='')?'[unknown]':$txid; if ($dp['received']==1) { mysql_query("UPDATE `deposits` SET `confirmations`=`confirmations`+1 WHERE `id`=$dp[id] LIMIT 1"); if (++$dp['confirmations']>=6) { $delExed=false; do { $delExed=mysql_query("DELETE FROM `deposits` WHERE `id`=$dp[id] LIMIT 1"); } while ($delExed==false); mysql_query("UPDATE `players` SET `balance`=TRUNCATE(ROUND((`balance`+$received),9), WHERE `id`=$dp[player_id] LIMIT 1"); mysql_query("INSERT INTO `transactions` (`player_id`,`amount`,`txid`) VALUES ($dp[player_id],$dp[amount],'$dp[txid]')"); } continue; } mysql_query("UPDATE `deposits` SET `received`=1,`amount`=$received,`txid`='$txid' WHERE `id`=$dp[id] LIMIT 1"); } mysql_query("DELETE FROM `deposits` WHERE `time_generated`<NOW()-INTERVAL 7 DAY"); ?> For some reason I am getting all these errors, and I cannot figure out why? Is there anyone out there that thinks they know what is wrong with it? check_deposits.php
  19. Hi everyone, I am having trouble passing/displaying the values inside of a selected list. I created a add/remove list using Jquery and I tried to display the values passed using foreach and for loops but it is still not working. The values I am trying to get are $existing_mID[$j], which is inside of the option value attribute. Please kindly let me know what should I do in order to get the values and I really appreciate your help. <?php $selected = $_POST['selectto']; if(isset($selected)) { echo "something in selected<br />"; for ($i=0;$i<count($selected);$i++) echo "selected #1 : $selected[$i]"; foreach ($selected as $item) echo "selected: item: $item"; } ?> This is the form <form> <select name="selectfrom[]" id="select-from" multiple="" size="10"> <?php $j=0; foreach($existing_mTitle as $item) { ;?> <option value="<?php $existing_mID[$j];?>" > <?php echo "$existing_mID[$j] & $item";$j++;?> </option> <?php }?> </select> <a href="JavaScript:void(0);" id="btn-add">Add »</a> <a href="JavaScript:void(0);" id="btn-remove">« Remove</a> <select name="selectto[]" id="select-to" multiple="" size="10"></label> </select> <input type="submit" name="addArticle" value="Add" /> </form> Below is my Jquery code that I implemented. $(document).ready(function() { $('#btn-add').click(function(){ $('#select-from option:selected').each( function() { $('#select-to').append("<option value='"+$(this).val()+"'>"+$(this).text()+"</option>"); $('#select-to option').attr('selected',true); $(this).remove(); }); }); $('#btn-remove').click(function(){ $('#select-to option:selected').each( function() { $('#select-from').append("<option value='"+$(this).val()+"'>"+$(this).text()+"</option>"); $('#select-to option[value=' +$(this).val()+ ']').attr('selected',true); $(this).remove(); }); }); });
  20. Hi I've been stuck trying to execute a script for a few weeks now and I really need help. The script is supposed to schedule social media posts via functions.php and wp-load.php but I get errors. Can someone do me a favour? Drop your email and I'll send you the details to connect to my database. Thanks
  21. Hi, I have a cron job that executes this script every 2 minutes: <?php // LOAD WP-LOAD.PHP require('/opt/bitnami/apps/wordpress/htdocs/wp-load.php'); // INCLUDE AND EXECUTE SCHEDULER.PHP include('/opt/bitnami/apps/wordpress/htdocs/wp-content/themes/yeelloe/scheduler.php'); ?> When I try to include; /opt/bitnami/apps/wordpress/htdocs/wp-content/themes/yeelloe/scheduler.php: <?php // EXPLODE AND PARSE WP-CONTENT; FUNCTIONS.PHP $parse_uri = explode( '/opt/bitnami/apps/wordpress/htdocs/wp-content', $_SERVER['SCRIPT_FILENAME'] ); // LOAD WP-LOAD.PHP require_once( $parse_uri[0] . '/opt/bitnami/apps/wordpress/htdocs/wp-load.php' ); // LOAD TEMPLATE FUNCTION CheckFunction(); ?> I get the output: ): failed to open stream: No such file or directory in /opt/bitnami/apps/wordpress/htdocs/wp-content/themes/yeelloe/cron.php on line 5 PHP Warning: include(): Failed opening '<?php //PLEASE do NOT move me around. I get cranky when I get moved around //get the wp-load in for the wordpress functions $parse_uri = explode( '/opt/bitnami/apps/wordpress/htdocs/wp-content', $_SERVER['SCRIPT_FILENAME'] ); require_once( $parse_uri[0] . '/opt/bitnami/apps/wordpress/htdocs/wp-load.php' ); //now try calling template function CheckFunction(); ?>' for inclusion (include_path='.:/opt/bitnami/php/lib/php:/opt/bitnami/frameworks/smarty/libs') in /opt/bitnami/apps/wordpress/htdocs/wp-content/themes/yeelloe/cron.php Any ideas on how to execute this file. Any help would be appreciated.
  22. Good Day guys I need some help with something that I am busy with. I have a wallpaper that need to get weather effects on it but it has to be according to the current weather status and time. The wallpaper is in the attached. I have searched the net the whole day now and cant find what I am looking for. Let me give an example: If it rains the background wallpaper must have the rainy look and be wet, when its sunny there need to be a sun and the background must be brighter. Please help me with this.
  23. Hi all, The code creates 4 select boxes.The user clicks on one item in each of the boxes and these are entered into the SQL statement.Trouble is I keep getting error after error all referring to line 59(the SQL statement line) can any keen eyed PHP freak see what I am doing wrong(or even if the whole of the code is any good)..Not too experienced with php so any comments suggestions(or laughs) greatly appreciated. <!DOCTYPE HTML> <html> <body> <select name = "author"> <option value="kendavies">ken davies</option> <option value="arthursmith">arthur smith</option> <option value="gillrafferty">gill rafferty</option> <option value="mollybrown">molly brown</option> <option value="gilbert riley">gilbert riley</option> <option value="colinwilson">colin wilson</option> <option value="jamesgreen">james green</option> <option value="arnoldlaing">arnold laing</option> <option value="cathyellis">cathy ellis</option> <option value="carolreed">carol reed</option> </select> <select name = "publisher"> <option value="yonkers">yonkers</option> <option value="blueparrot">blue parrot</option> <option value="zoot">zoot</option> </select> <select name = "yearpublished"> <option value="2003">2003</option> <option value="2004">2004</option> <option value="2005">2005</option> <option value="2006">2006</option> <option value="2007">2007</option> <option value="2008">2008</option> </select> <select name = "genre"> <option value="adventure">adventure</option> <option value="thriller">thriller</option> <option value="crime">crime</option> <option value="biography">biography</option> <option value="romance">romance</option> </select> $aa = "author" $bb = "publisher" $cc = "yearpublished" $dd = "genre" <?php $aa = "author"; $bb = "publisher"; $cc = "yearpublished"; $dd = "genre"; mysql_connect ("localhost","root","") or die(mysql_error()); mysql_select_db ("authors") or die(mysql_error()); $strSQL = SELECT * FROM `books` WHERE author = '".$aa."' AND publisher = '".$bb."' AND yearpublished = '".$cc."' AND genre ='".$dd."'" "; $rs = mysql_query($strSQL;); while($row = mysql_fetch_array($rs) ) { print $row ['ID']."<br/>"; print $row ['author']."<br/>"; print $row ['booktitle']."<br/>"; print $row ['publisher']."<br/>"; print $row ['yearpublished']."<br/>"; print $row ['genre']."<br/>"; print $row ['copiessold']."<br/>"; } mysql_close(); ?> </body> </html>
  24. I'm trying to use checkbox to choose multiple data and submit(button 'Send SMS') them and direct them to another page, which will send text SMS to the numbers chosen. But when I try to click on one checkbox, it automatically directs me to the next page, without having to click on the 'Send SMS' button. I tried to see which part is the problem, but I can't determine which one is wrong. Please help! Thank you. <script type="text/javascript"> function checkedAll (frm1) {var aa= document.getElementById('frm1'); if (checked == false) { checked = true } else { checked = false }for (var i =0; i < aa.elements.length; i++){ aa.elements[i].checked = checked;} } </script> <TABLE width="1106" border="1" align="center" cellpadding="5" cellspacing="2" > <tr> <td colspan="9"> <form id ="frm1" action="sms_latecomers.php"> <input type='checkbox' name='checkall' onclick='checkedAll(frm1);' value=""> <input type="submit" name="Submit" id="button" value="SMS Reminder" style="background:#FFCC33"/> </td> </tr> <TR bgcolor="#996699"> <?php $count=0; ?> <TH width="32"></TH> <TH width="37"> <span class="style1"> <div align="center">No. </div></span></TH> <th width="101"><span class="style1">SUPERVISOR ID</span></th> <th width="101"><span class="style1">EMPLOYEE ID</span></th> <th width="153"><span class="style1">EMPLOYEE NAME</span></th> <th width="124"><span class="style1">DATE</span></th> <th width="153"><span class="style1">LATE CHECK IN</span></th> </TR> <?php while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { ?> <TR> <TD><input type="checkbox" name="chk1" value="<?php echo $row['supervisor_telno']; ?>" onClick="window.open('sms_latecomers.php?employee_id=<?php echo $row['employee_id']; ?>&supervisor_telno=<?php echo $row['supervisor_telno']; ?>');"></TD> <TD height="66">[bad html removed]<input type="checkbox" name="chk1" >--> <?php $count=$count+1; print($count);?></TD> <TD><div align="center"><?php echo $row['supervisor_id']; ?></div></TD> <TD><div align="center"><?php echo $row['employee_id']; ?></div></TD> <TD><div align="center"><?php echo $row['employee_name']; ?></div></TD> <TD><div align="center"><?php echo $row['DATE']; ?></div></TD> <TD><div align="center"><?php echo $row['TIME']; ?></div></TD> </TR> <?php } ?>[bad html removed]</form>--> </TABLE>
  25. Here is my code which i use to recieve uploaded files. $filepath = $_SERVER['DOCUMENT_ROOT'] . "file/"; $fileunzippath = $filepath."unzipped/"; $exclude_list = array(".", "..", "...", "index.php", ".php", ".htaccess"); if($_FILES["zip_file"]["name"]) { $filename = $_FILES["zip_file"]["name"]; $source = $_FILES["zip_file"]["tmp_name"]; $type = $_FILES["zip_file"]["type"]; $name = explode(".", $filename); $accepted_types = array('application/zip', 'application/x-zip-compressed', 'multipart/x-zip', 'application/x-compressed'); foreach($accepted_types as $mime_type) { if($mime_type == $type) { $okay = true; break; } } $continue = strtolower($name[1]) == 'zip' ? true : false; if(!$continue) { $message = "The file you are trying to upload is not a .zip file. Please try again."; } $string = preg_replace(array('/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), $filename); $clean_name = strtr($string, array('Š' => 'S','Ž' => 'Z','š' => 's','ž' => 'z','Ÿ' => 'Y','À' => 'A','Á' => 'A','Â' => 'A','Ã' => 'A','Ä' => 'A','Å' => 'A','Ç' => 'C','È' => 'E','É' => 'E','Ê' => 'E','Ë' => 'E','Ì' => 'I','Í' => 'I','Î' => 'I','Ï' => 'I','Ñ' => 'N','Ò' => 'O','Ó' => 'O','Ô' => 'O','Õ' => 'O','Ö' => 'O','Ø' => 'O','Ù' => 'U','Ú' => 'U','Û' => 'U','Ü' => 'U','Ý' => 'Y','à' => 'a','á' => 'a','â' => 'a','ã' => 'a','ä' => 'a','å' => 'a','ç' => 'c','è' => 'e','é' => 'e','ê' => 'e','ë' => 'e','ì' => 'i','í' => 'i','î' => 'i','ï' => 'i','ñ' => 'n','ò' => 'o','ó' => 'o','ô' => 'o','õ' => 'o','ö' => 'o','ø' => 'o','ù' => 'u','ú' => 'u','û' => 'u','ü' => 'u','ý' => 'y','ÿ' => 'y')); $clean_name = strtr($clean_name, array('Þ' => 'TH', 'þ' => 'th', 'Ð' => 'DH', 'ð' => 'dh', 'ß' => 'ss', 'Œ' => 'OE', 'œ' => 'oe', 'Æ' => 'AE', 'æ' => 'ae', 'µ' => 'u')); $clean_name = preg_replace(array('/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), $clean_name); $target_path = $filepath.$clean_name; // change this to the correct site path if(move_uploaded_file($source, $target_path)) { echo "Source: ".$source."<br/>"; echo "Type: ".$type."<br/>"; echo "Filename: ".$filename."<br/>"; $zip = new ZipArchive(); $x = $zip->open($target_path); if ($x === true) { $zip->extractTo($fileunzippath.$clean_name); // change this to the correct site path $zip->close(); $exclude_list; $dir_path = $_SERVER['DOCUMENT_ROOT']; $dir_path .= "/file/unzipped/"; $directories = array_diff(scandir($fileunzippath.$clean_name), $exclude_list); foreach($directories as $entry) { if(is_dir($dir_path.$entry)) { if($entry != 'part0' || $entry !='part1') { rmdir($entry); } } } } $message = "Your .zip file was uploaded and unpacked."; } else { $message = "There was a problem with the upload. Please try again."; } } Specifically i want to highlight this part: $exclude_list; $dir_path = $_SERVER['DOCUMENT_ROOT']; $dir_path .= "/file/unzipped/"; $directories = array_diff(scandir($fileunzippath.$clean_name), $exclude_list); foreach($directories as $entry) { if(is_dir($dir_path.$entry)) { if($entry != 'part0' || $entry !='part1') { rmdir($entry); } } } When I upload a zip file containing 2 directories(one called 'part0', and one called 'bad'), they get unzipped correctly and it gives no errors, however the fake directories(not called part0 or part1) I put in there are still there. Any 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.