Jump to content

bine.heckmann

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Everything posted by bine.heckmann

  1. Hello, i've got some shop script which has 2 payment modules which i'd like to use for something else, the payment modules only work if the user is logged in though, i tried to make them standalone scripts but that didn't work out too well. So now i decided to go another way and just let everyone have the same session so everyone will be using the same username&password automatically. the index file looks like this: <?php include('./inc/config.php'); include('./inc/functions.php'); include('./lang/'.$language.'.lng'); $id = addslashes($_REQUEST["id"]); $user = addslashes($_REQUEST["username"]); $pass = addslashes($_REQUEST["password"]); $language = strtolower($language); if(empty($id)) $id =1; $file = mysql_query('SELECT * FROM navi_'.$language.' WHERE id="'.$id.'"'); if(mysql_num_rows($file)>0) $file = mysql_fetch_array($file); else $file = mysql_fetch_array(mysql_query('SELECT * FROM navi_'.$language.' WHERE id="404"')); if(!empty($user) AND !empty($pass)) {$query = mysql_query('SELECT * FROM users WHERE username="'.$user.'" AND pass="'.md6($pass).'"'); if(mysql_num_rows($query) == 1) {$_SESSION[$session_prefix."user"] = ucfirst($user); echo'<meta http-equiv="refresh" content="0; url=index.php?id=8">';} else $error = 'Username oder Passwort ist falsch.';} include('./designe/'.$designe.'/head.tpl'); include('./designe/'.$designe.'/navi.php'); include('./designe/'.$designe.'/middle.tpl'); if(file_exists('./pages/'.$file["file"])) {echo'<h1>'.ucfirst($file["title"]).'</h1>'; include('./pages/'.$file["file"]);} if(!empty($error)) echo '<font color="red">'.$error.'</font>'; include('./designe/'.$designe.'/foot.tpl'); ?> Now i tried alot of things including adding: session_start(); $_SESSION["username"] = "peter"; $_SESSION["user"] = "peter"; $_SESSION["id"] = "1"; $_SESSION["pass"] = "peter"; $_SESSION["password"] = "peter"; or $id = "1"; $user = "peter"; $username = "peter"; $pass = "peter"; $password = "peter"; also a combination of both, nothing works, but i don't understand why ? Any help is appreciated. /Edit, i tried adding it to the paymentmodule .php aswell, but no luck.
  2. Hi there i'm using php&curl to fetch some data from another site, this sometimes takes up to 30 seconds but you don't actually see anything happen on the screen, i tried to implement the cURL progressbar but i didn't really get it to work, can someone help me out here ? This is my code: <?php if(!empty($_SESSION[$session_prefix."user"])) { //Functions function middlestring($string,$start,$stop){ $pos = strpos($string,$start)+strlen($start); $retstr = substr($string,$pos); $pos = strpos($retstr,$stop); $retstr = substr($retstr,0,$pos); return $retstr; } function curl_get($url, $head, $cook, $ssl){ $ch = curl_init($url); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,$ssl); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,$ssl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, $head); if($cook == 1) curl_setopt($ch, CURLOPT_COOKIE, $_SESSION["cookies"]); return curl_exec($ch); } function curl_post($url, $datas, $cook, $ssl){ $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS, $datas); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14"); if($cook == 1) curl_setopt($ch, CURLOPT_COOKIE, $_SESSION["cookies"]); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,$ssl); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,$ssl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 1); return curl_exec($ch); } function getcookies($text, $startstr, $endstr){ $start = strpos($text, $startstr); $end = strpos($text, $endstr); $parts = split("Set-Cookie: ",substr($text, $start, $end-$start)); $cookies = ''; foreach ($parts as $co) { $cd = split(";",$co); if (!empty($cd[0])) { if(strpos($cd[0], "deleted")) {} else $cookies .= $cd[0].';'; } } return $cookies; } $mail = $ukuser; $pass = $ukpw; $code = $_REQUEST["code"]; $wert = $_REQUEST["guthaben"]; $captcha = $_REQUEST["captcha"]; if(empty($captcha)) { $text = curl_get('http://www.ukash.com/global/en/login.aspx', 1, 0, 1); $_SESSION["viewstate"] = urlencode(middlestring($text, '__VIEWSTATE" value="', '" />')); $text = curl_post('http://www.ukash.com/global/en/login.aspx', '__EVENTTARGET=ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginCentral_10%24loginButton&__EVENTARGUMENT=&__VIEWSTATE='.$_SESSION["viewstate"].'&sIFR_replacement_0=&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginCentral_10%24txtEmail='.$mail.'&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginCentral_10%24txtPassword='.$pass.'&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginRegForm_11%24txtR1FirstName=&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginRegForm_11%24txtR1LastName=&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginRegForm_11%24txtR1Email=&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginRegForm_11%24ddlDOBday=01&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginRegForm_11%24ddlDOBmonth=01&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpMainHolder%24loginRegForm_11%24ddlDOByear=1980&%23=%2Fservices%2FlocaleRedirector.aspx%3FnodeId%3D156095%26languageCode%3Den&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpSideHolder%24sideRegisterLogin_15%24txtR1FirstName=&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpSideHolder%24sideRegisterLogin_15%24txtR1LastName=&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpSideHolder%24sideRegisterLogin_15%24txtR1Email=&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpSideHolder%24sideRegisterLogin_15%24ddlDOBday=01&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpSideHolder%24sideRegisterLogin_15%24ddlDOBmonth=01&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24cpSideHolder%24sideRegisterLogin_15%24ddlDOByear=1980&ctl00%24ctl00%24ctl00%24ContentPlaceHolderDefault%24footerTellAFriend_23%24txtStFemail=&__SCROLLPOSITIONX=0&__SCROLLPOSITIONY=0', 0, 1); $_SESSION["cookies"] = getcookies($text, 'Set-Cookie:', 'Cache-Control: '); $text = curl_get('http://www.ukash.com/global/en/my-ukash.aspx', 1, 1, 1); if(strpos($text, 'My Used Codes')) { $text = curl_get('https://direct.ukash.com/de/tools/combine/logic/step1.aspx?email=&culture=de&country=de&lang=de', 1, 1, 0); $_SESSION["cookies"] .= 'ASP.NET_SessionId='.middlestring($text, 'Set-Cookie: ASP.NET_SessionId=', ' path=/; HttpOnly'); $_SESSION["event"] = urlencode(middlestring($text, 'EVENTVALIDATION" value="', '" />')); $_SESSION["viewstate"] = urlencode(middlestring($text, 'VIEWSTATE" value="', '" />')); $text = curl_get('https://direct.ukash.com/de/tools/combine/utils/PhishingImage.aspx', 0, 1, 0); echo '<form action="" method="post"> <table id="items"> <tr><td>'.$uka1lng.'</td><td><input type="text" name="code"></td></tr> <tr><td>'.$uka2lng.'</td><td><input type="text" name="guthaben" value="20" readonly="readonly"></td></tr> <tr><td><img src="data:image/jpg;base64,'.base64_encode($text).'"></td><td><input type="text" name="captcha"></td></tr> <tr><td></td><td><input type="submit" value="'.$uka3lng.'"></td></tr> </table> </form><br> <font color="red">'.$uka4lng.'</font>'.$uka5lng.'<br>'.$uka6lng; } else $ukerror = $uka7lng; } else { if($wert < 10) $ukerror = $uka8lng; else { $text = curl_post('https://direct.ukash.com/de/tools/combine/logic/step1.aspx', '__VIEWSTATE='.$_SESSION["viewstate"].'&__EVENTVALIDATION='.$_SESSION["event"].'&tbxVoucherNo1='.$code.'&tbxVoucherVal1='.$wert.'&tbxVoucherNo2='.$code.'&tbxVoucherVal2=0&tbxVoucherNo3=&tbxVoucherVal3=&tbxVoucherNo4=&tbxVoucherVal4=&tbxVoucherNo5=&tbxVoucherVal5=&tbxVoucherNo6=&tbxVoucherVal6=&tbxVoucherNo7=&tbxVoucherVal7=&tbxVoucherNo8=&tbxVoucherVal8=&tbxVoucherNo9=&tbxVoucherVal9=&tbxVoucherNo10=&tbxVoucherVal10=&tbxBaseCurrency=EUR&tbxVerContent='.$captcha.'&chkTerms=on&btnConsolidate=', 1, 0); if(strpos($text, 'stimmt nicht mit dem Systemcode')) $ukerror = $uka9lng; else { $text = curl_get('https://direct.ukash.com/de/tools/combine/logic/step2.aspx?lang=de', 1, 1, 0); $_SESSION["viewstate"] = urlencode(middlestring($text, 'VIEWSTATE" value="', '" />')); $_SESSION["event"] = urlencode(middlestring($text, 'EVENTVALIDATION" value="', '" />')); if(strpos($text, 'Ihre Ukash Referenznummer')) { $text = curl_post('https://direct.ukash.com/de/tools/combine/logic/step2.aspx?lang=de', '__VIEWSTATE='.$_SESSION["viewstate"].'&__EVENTVALIDATION='.$_SESSION["event"].'&btnProceed=', 1, 0); $text = curl_get('https://direct.ukash.com/de/tools/combine/logic/Step4.aspx', 1, 1, 0); $newukash = middlestring($text, 'span id="lblVoucherDetailValue"', '</table>'); $newukash = middlestring($newukash, '<tr><td>', '</td></tr>'); $newukash = split('</td><td>', $newukash); $newcode = $newukash[0]; $ukguthaben = $newukash[2]; $user = mysql_fetch_array(mysql_query('SELECT * FROM users WHERE username="'.$_SESSION[$session_prefix."user"].'"')); $geld = floor($user["guthaben"] + $ukguthaben); mysql_query('UPDATE users SET guthaben="'.$geld.'" WHERE username="'.$_SESSION[$session_prefix."user"].'"'); mysql_query('INSERT into ukash (user, code1, code2, value) VALUES ("'.$_SESSION[$session_prefix."user"].'", '.$newcode.', 0, '.$ukguthaben.')'); echo floor($ukguthaben).' '.$guthaben.$uka10lng; } else $ukerror = $uka11lng; } } } echo $ukerror; } else echo'<font color="red">'.$uka12lng.'</font>'; ?>
  3. Thank you for your reply, is the code you corrected / posted just meant to be an example, or would that actually work? Sabine
  4. Hello everyone, i'm trying to get the following scenario done: I've got a shop system which is kind of a cms and shop in one thing but that's not really important here, now there's some kind of vouchers which can be used in my shop to fund the account balance aka "Credits", now everything works fine, my script checks the voucher for validity and balance and the user gets the voucher balance credited as his account balance, in short: User1 uses Voucher with amount 10$ Script sets User1 Shop-Credits/Balance to 10$ Now what i want to achieve is, that the user get's only 50% of the original voucher amount credited to his shop-credits/balance basically just divide the voucher amount by 2 before it get's credited to the account. My code to write/update the credits in mySQL looks like this: $query2 = "UPDATE `shop_user` SET `credits` = `credits`+'".$psc->value."' WHERE `userid` = '".$_SESSION["userid"]."' AND `username` = '".$_SESSION["username"]."'"; Now this .$psc->value. is the part where it checks for the value first and then sets the same amount as "credits" in the shop. Now isn't there just some simple piece of code that would let me divide this by 2, which would be 50% obviously. something like .$psc->value /2. which obviously doesn't work, but should give you an idea of what i need. Any help is greatly appreciated. Sabine
  5. Hello, i've got some trouble with one of my scripts which is some kind of a CMS which includes a support function which allows the user to create support tickets. Now those tickets are saved in a MySQL db, which all works fine, my problem is some special german characters which are mandatory for my support won't properly save in the DB. I tried everything from setting headers to UTF-8 Charset to changing the Collation in phpmyadmin, but nothing works. I also set mysql_real_escape_string in my script but i'm not sure if i did it right. the special characters in question are "Öö, Ää and Üü" the code: Index.php <?php ##################### # index.php # ##################### ob_start(); session_start(); include('libs/mysql_config.php'); include('libs/class_user.php'); include('libs/class_bbcode.php'); $mysql_connect = mysql_connect($mysql_host, $mysql_username, $mysql_password); mysql_select_db($mysql_database, $mysql_connect); $user = new user; $bbcode = new SimpleBBCode; ?> <!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> <link rel="shortcut icon" href="/favicon.ico" > <?php $title = mysql_query("SELECT `cms_title` FROM `shop_options`") OR die(mysql_error()); $title_row = mysql_fetch_assoc($title); echo "<title>".$title_row['cms_title']."</title>\n"; ?> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="style/_style.css" media="all" /> <script type="text/javascript"> <!-- function MM_swapImgRestore() { var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } function Border () { var box1 = document.getElementById("left"); var box2 = document.getElementById("right"); var height = Math.max(box1.offsetHeight, box2.offsetHeight); box1.style.height = height + "px"; box2.style.height = height + "px"; } //--> </script> </head> <body onload="Border()"> <div id="head_login"> </div> <div id="header"> <div class="left"> <?php if ($user->check_login() == false) { echo 'Hello, Guest <a href="index.php?site=login"><strong>Login</strong></a> or <a href="index.php?site=register"><strong>Register</strong></a>'; } elseif ($user->check_login() == true) { if(strlen($_SESSION["username"]) > 7) { $username = substr($_SESSION["username"], 0, 6) . '..'; } else { $username = $_SESSION["username"]; } echo "Hello, <a href='index.php?site=account'><strong>".$username."</strong></a> (".$user->check_credits($_SESSION["userid"])." €) <a href='index.php?site=logout'><strong>Logout</strong></a>"; } ?> </div> <div style="margin-left: 220px;"><img src="style/images/header.PNG" border="0"></div> </div> <div id="body"> <div class="navigation_head"> <div style="margin-left: 125px; float: left;"><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Home','','style/images/home_2.JPG',1)"><img src="style/images/home.JPG" border="0" name="Home"></a></div> <div style="margin-left: 15px; float: left;"><a href="index.php?site=cashin" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Cashin','','style/images/cashin_2.JPG',1)"><img src="style/images/cashin.JPG" border="0" name="Cashin"></a></div> <div style="margin-left: 15px; float: left;"><a href="index.php?site=account" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Account','','style/images/account_2.JPG',1)"><img src="style/images/account.JPG" border="0" name="Account"></a></div> <div style="margin-left: 15px; float: left;"><a href="index.php?site=faq" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Faq','','style/images/faq_2.JPG',1)"><img src="style/images/faq.JPG" border="0" name="Faq"></a></div> <div style="margin-left: 15px; float: left;"><a href="index.php?site=support" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Support','','style/images/support_2.JPG',1)"><img src="style/images/support.JPG" border="0" name="Support"></a></div> <?php $status = mysql_query("SELECT `status` FROM `shop_user` WHERE `userid` = '".$_SESSION["userid"]."' AND `username` = '".$_SESSION["username"]."'") OR die(mysql_error()); $status_r = mysql_fetch_assoc($status); if($status_r["status"] == 3) { echo "<a href='admin/'><strong>Admin</strong></a>"; } elseif($status_r["status"] != 3) { #nothing; } ?> </div> <div id="left"> <div style="margin-top: 5px;margin-left: -6px;"><img src="style/images/warenkorb.JPG" border="0"></div> <?php $w_n = mysql_query("SELECT `userid` FROM `shop_basket` WHERE `userid` = '".$_SESSION["userid"]."'") OR die(mysql_error()); $w_r = mysql_num_rows($w_n); ?> <div style="margin-top: 8px; margin-left: 15px; color: #808080; float: left;">Waren: <strong><?php echo $w_r; ?></strong></div> <div style="margin-left: 80px; margin-top: 20px; float: left;"><a href="index.php?site=basket"><img src="style/images/checkout.JPG" border="0"></a></div> <div style="margin-left: -6px;"><img src="style/images/produkte.JPG" border="0"></div> <?php $navigation = "SELECT * FROM `shop_navigation` ORDER BY `sort` ASC"; $do = mysql_query($navigation) OR die(mysql_error()); while($n_row = mysql_fetch_assoc($do)) { echo "<div style='margin-left: 10px; margin-top: 10px; color: #808080;'><a href='index.php?site=cat&id=".$n_row["id"]."'>".$n_row["name"]."</a></div><hr style='width: 225px; color: #2a2a2a;'>\n"; } ?> <div style="margin-left: -6px; margin-top: 20px;"><img src="style/images/zahlung.JPG" border="0"></div> </div> <div id="right"> <?php $site = $_GET["site"]; if($site == "login") { include('login.php'); } elseif($site == "register") { include('register.php'); } elseif($site == "account") { include('account.php'); } elseif($site == "faq") { include('faq.php'); } elseif($site == "support") { include('support.php'); } elseif($site == "error") { include('error.php'); } elseif($site == "logout") { include('logout.php'); } elseif($site == "cat") { include('category.php'); } elseif($site == "prod") { include('product.php'); } elseif($site == "basket") { include('basket.php'); } elseif($site == "checkout") { include('checkout.php'); } else { ?> <div class="topnews"><img src="style/images/news.JPG" border="0"></div> <div class="news"> <?php $limit = mysql_query("SELECT `index_news` FROM `shop_options`") OR die(mysql_error()); $limit_r = mysql_fetch_assoc($limit); $news = mysql_query("SELECT * FROM `shop_news` ORDER BY `date` DESC LIMIT ".$limit_r["index_news"]."") OR die(mysql_error()); while($ne_row = mysql_fetch_array($news)) { $tmp = explode("-", $ne_row["date"]); $newdate = $tmp[2].".".$tmp[1].".".$tmp[0]; echo "<div style='padding-top: 5px; margin-left: 15px; color: #7d7d7d; font-size: 16px;'><strong>"; echo str_replace(array('&#196;', '&#228;', '&#214;', '&#246;', '&#220;', '&#252;', '&#223;'), array("Ä", "ä", "Ö", "ö", "Ü", "ü", "ß"), $ne_row['title']); echo "</strong></div><hr style='width:580px; color: #FFFFFF;'>"; echo "<div style='margin-top: 5px; margin-left: 25px; color: #707070; font-size: 14px;'><strong>"; echo nl2br(str_replace(array('&#196;', '&#228;', '&#214;', '&#246;', '&#220;', '&#252;', '&#223;'), array("Ä", "ä", "Ö", "ö", "Ü", "ü", "ß"), $ne_row['text'])); echo "</strong></div>"; } ?> <div class="bottom"></div> </div> <?php } ?> <div style="clear:both;"></div> </div> <br /> <br /> </body> </html> <?php ob_end_flush(); ?> Support.php <?php ##################### # support.php # ##################### if ($user->check_login() == false) { header("location: index.php?site=login"); } elseif($user->check_login() == true) { $background_color = array( 1 => "#ffd7d7", //rot 2 => "#fffe92", //gelb 3 => "#d4ffe3"); //grün $ticket_status = array( 1 => "unbearbeitet", 2 => "in bearbeitung", 3 => "bearbeitet"); if($_GET["show"] == "ticket") { $support = "SELECT * FROM `shop_tickets` WHERE `userid` = '".$_SESSION["userid"]."' AND `id` = '".intval($_GET["ticketid"])."'"; $support_r = mysql_query($support) OR die(mysql_error()); $support_num = mysql_num_rows($support_r); if($support_num == 0) { header("location: index.php?site=support"); } elseif($support_num != 0) { $support_row = mysql_fetch_assoc($support_r); echo "<div style='margin-left:15px; padding-top:10px; font-size: 14px;'><strong>Ticket #".$support_row["id"]."</strong></div>"; echo "<div style='margin-left:15px; margin-top:25px; font-size: 12px;'>Datum: <strong>".$support_row["date"]."</strong></div>"; echo "<div style='margin-left:15px; margin-top:5px; font-size: 12px;'>Betreff: <strong>".$support_row["title"]."</strong></div>"; echo "<div style='margin-left:15px; margin-top:5px; font-size: 12px;'>Status: <strong>".$ticket_status[$support_row["status"]]."</strong></div>"; echo "<div style='margin-left:15px; margin-top:20px; font-size: 14px;'><strong>Beschreibung</strong></div>"; echo "<div style='width: 450px; min-height: 100px; height: auto; background-color: #f6f6f6; margin-left: 15px; margin-top: 15px; font-size: 12px; border: 1px solid #b5c2d5;'>"; echo nl2br($support_row["ticket"]); echo "</div>"; echo "<div style='margin-left:15px; margin-top:20px; font-size: 14px;'><strong>Antwort</strong></div>"; echo "<div style='width: 450px; min-height: 100px; height: auto; background-color: #f6f6f6; margin-left: 15px; margin-top: 15px; font-size: 12px; border: 1px solid #b5c2d5;'>"; echo nl2br($support_row["answer"]); echo "</div>"; echo "<br /><br /><div style='margin-left: 15px;'><a href='index.php?site=support'><img src='style/images/arrow_left.PNG' border='0'> <strong>zur Ticketübersicht</strong></a></div><br /><br/><br/>"; } } elseif($_GET["do"] == "create") { echo "<form action='support_do.php' method='post'>"; echo "<div style='margin-left:15px; padding-top:10px; font-size: 14px;'><strong>Neues Ticket erstellen</strong></div>"; echo "<div style='margin-left:15px; margin-top:25px; font-size: 12px;'><strong>Betreff: </strong><input type='text' name='title' style='width: 288px;'></div>"; echo "<div style='margin-left:15px; margin-top:5px; font-size: 12px;'><textarea name='text' rows='10' cols='40'></textarea></div>"; echo "<div style='margin-left:15px; margin-top:10px; font-size: 12px;'><input type='submit' name='submit' value='Ticket erstellen'></div>"; echo "</form>"; } else { echo '<div class="topnews"><img src="style/images/tsupport.JPG" border="0"></div>'; echo '<div class="news">'; echo "<div style='margin-left: 15px; font-size: 14px;'><a href='index.php?site=support&do=create'><img src='style/images/add.PNG' border='0'> <strong>Neues Ticket erstellen</strong></a></div>"; echo "<br />"; echo "<div class='support'>"; echo "<div style='width: 40px; height: 20px; text-align: center; background-color: #f6f6f6; float: left; border-left: 1px solid #b5c2d5; border-top: 1px solid #b5c2d5; border-bottom: 1px solid #b5c2d5; font-size: 14px;'>ID</div>"; echo "<div style='width: 248px; height: 20px; background-color: #f6f6f6; float: left; border-left: 1px solid #b5c2d5; border-top: 1px solid #b5c2d5; border-bottom: 1px solid #b5c2d5; font-size: 14px;'> Betreff</div>"; echo "<div style='width: 87px; height: 20px; background-color: #f6f6f6; float: left; border-left: 1px solid #b5c2d5; border-top: 1px solid #b5c2d5; border-bottom: 1px solid #b5c2d5; font-size: 14px;'> Status</div>"; echo "<div style='width: 98px; height: 20px; text-align: center; background-color: #f6f6f6; float: left; border-left: 1px solid #b5c2d5; border-top: 1px solid #b5c2d5; border-bottom: 1px solid #b5c2d5; border-right: 1px solid #b5c2d5; font-size: 14px;'>Datum</div>"; echo "</div>"; echo "<div style='clear:both;'></div>"; $support = "SELECT * FROM `shop_tickets` WHERE `userid` = '".$_SESSION["userid"]."' ORDER BY `date` DESC"; $support_r = mysql_query($support) OR die(mysql_error()); while($support_row = mysql_fetch_assoc($support_r)) { if(strlen($support_row["title"]) > 27) $support_row["title"] = substr($support_row["title"], 0, 26) . '..'; echo "<a href='index.php?site=support&show=ticket&ticketid=".$support_row["id"]."'><div class='support'>"; echo "<div style='width: 40px; height: 20px; line-height: 20px; text-align: center; background-color: ".$background_color[$support_row["status"]]."; ; float: left; border-left: 1px solid #b5c2d5; border-bottom: 1px solid #b5c2d5; font-size: 12px;'>".$support_row["id"]."</div>"; echo "<div style='width: 248px; height: 20px; line-height: 20px; background-color: ".$background_color[$support_row["status"]]."; ; float: left; border-left: 1px solid #b5c2d5; border-bottom: 1px solid #b5c2d5; font-size: 12px;'> ".$support_row["title"]."</div>"; echo "<div style='width: 87px; height: 20px; line-height: 20px; background-color: ".$background_color[$support_row["status"]]."; ; float: left; border-left: 1px solid #b5c2d5; border-bottom: 1px solid #b5c2d5; font-size: 12px;'> ".$ticket_status[$support_row["status"]]."</div>"; echo "<div style='width: 98px; height: 20px; line-height: 20px; text-align: center; background-color: ".$background_color[$support_row["status"]]."; ; float: left; border-left: 1px solid #b5c2d5; border-bottom: 1px solid #b5c2d5; border-right: 1px solid #b5c2d5; font-size: 12px;'>".$support_row["date"]."</div>"; echo "</div></a>"; echo "<div style='clear:both;'></div>"; } } } echo "</div>"; echo "<div class='bottom'></div>"; ?> Support.do.php <?php ##################### # support_do.php # ##################### session_start(); include('libs/mysql_config.php'); include('libs/class_user.php'); $mysql_connect = mysql_connect($mysql_host, $mysql_username, $mysql_password); mysql_select_db($mysql_database, $mysql_connect); $user = new user; if ($user->check_login() == false) { header("location: index.php?site=login"); } elseif($user->check_login() == true) { $title = htmlspecialchars(mysql_real_escape_string($_POST["title"])); $text = htmlspecialchars(mysql_real_escape_string($_POST["text"])); $date = date("Y-m-d"); if(empty($title) || empty($text)) { header("location: index.php?site=support&do=create"); } else { $insert = "INSERT INTO `shop_tickets` (`userid`, `title`, `ticket`, `status`, `date`) VALUES ('".$_SESSION["userid"]."', '".$title."', '".$text."', '1', '".$date."')"; $insert_do = mysql_query($insert) OR die(mysql_error()); header("location: index.php?site=support"); } } ?>
  6. Ok then, my form: <select name="fahrzeug" class="dropdownform" id="fahrzeug"> <option value="Audi" selected>Audi</option> <option value="BMW">BMW</option> <option value="Porsche">Porsche</option> </select> I'm not using any Database. I'm thinking about something like this: <?php $picture= array("BMW"=>"pictureurl", "Porsche"=>"pictureurl", "Audi"=>"pictureurl"); $fahrzeug = $_POST['fahrzeug']; echo $picture[$fahrzeug]; ?> Would that work ? And how would i have to put the pictureurl in that code, sorry i'm quite a noobie.
  7. I just thought, maybe could this be done with arrays ? I tried some things but without any luck Any help is greatly appreciated !
  8. Hello there, I'm trying to show a picture based on the value that was chosen in the dropdown menu of the page before the submit. Let's say i'm having a drop down form with 3 values: Porsche, BMW, Audi, the form also consists of a button to submit form and some other text fields but these aren't really relevant. So what i want is, you choose whatever car, let's say BMW, fill in all the other data of the form, hit submit, and on the next page it should show a Picture which i define for each car. I hope i explained that somehow understandable. Thanks in advance, Sabine
  9. This did work for me, thank you so much ! I would have another question about something which i'm not quite sure about if this would work at all, i have no code to show or something so i'm trying to explain what i'm trying to achieve the best i can. I'll choose a rental scenario, let's say i have 2 Drop-Down menus, 1st one shows the rental time for example: 1 day, 2 days, 3 days and so on. The 2nd Drop-Down Menu shows whatever is for rent, let's take cars, so the menu shows, BMW 3 series and Mercedes C-Class. Now i have prices attached to those cars like that <?php $arrayvalue = array("BMW"=>"50", "Mercedes"=>"60"); $value1 = $_POST['value1']; echo $arrayvalue[$value1]; ?> So that will show me the Price for 1 Day of Rental time, now the 1st drop down menu is set to 3 days or whatever, how could i link those menus together like, the echo will check first how many days have been selected and will show the appropiate price for the selection, like BMW selected which is 50bottle caps or whatever, and time selected is 3 Days, so it should show 150 Bottle caps. Is that even possible without usage of a DB ? Thanks in advance, Sabrina
  10. Hello everyone, i'm kinda stuck here although i had this working before, i don't know what's wrong here. Basically i've got a form with a drop-down menu, that menu has 3 values, x,y and z. Now that form is working with post, sending me to the next page where i have a set of arrays and a echo which should print some text based on the option chosen from the drop down menu. my code in the form is this: <select name="value1" id="value1"> <option value="x">x</option> <option value="y">y</option> <option value="z">z</option> </select> the array on the next page: $arrayvalue = array("x"=>"test1", "y"=>"test2", "z"=>"test3"); and the echo: <?php echo $arrayvalue["value1"];?> That leaves me with an empty page. What am i doing wrong here ? am i missing something ? any help is greatly appreciated. Sabrina
×
×
  • 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.