mertch Posted September 7, 2010 Share Posted September 7, 2010 Hi everyone, Here's the part of the script I think is wrong : <?php include "util/log.php"; include "util/connect.php"; if (loggedin() == $NO) { header("Location: login.php"); exit(); } else if (isset($_GET["p"])) { $udata = explode("-", $_COOKIE["log"]); $query = "SELECT * FROM l_users WHERE user='$udata[0]'"; $usrsql = mysql_query($query) or handledberror(mysql_error()); $usrdata = mysql_fetch_array($usrsql); switch ($_GET["p"]) { case "delete": include "util/linkfunc.php"; if (isset($_GET['id'])) delete_link($_GET['id']); else delete_all(); $CONTENT = "pages/urls.php"; break; case "approve": include "util/approve.php"; $CONTENT = "pages/approve.php"; break; case "urlview": case "add": case "edit": include "pages/modify.php"; $CONTENT = "pages/edit.php"; break; case "reset": include "util/linkfunc.php"; if (isset($_GET['id'])) reset_link($_GET['id']); else reset_all(); $CONTENT = "pages/urls.php"; break; case "urls": default: $CONTENT = "pages/urls.php"; } } else { $udata = explode("-", $_COOKIE["log"]); $query = "SELECT * FROM l_users WHERE user='$udata[0]'"; $usrsql = mysql_query($query) or handledberror(mysql_error()); $usrdata = mysql_fetch_array($usrsql); $CONTENT = "pages/urls.php"; } ?> <html> <head><title>EzyLinkExpire :: Member's Area</title><head> <body bgcolor="#1D2B60" link=#CCFFFF vlink=#CCFFFF> <table align="center" cellspacing="0" width=90% bgcolor="white" bordercolordark="black" bordercolorlight="black"> <tr> <td bgcolor="#1D2B60"> <img src="images/logo.gif" border="0"></td> <td valign=top bgcolor="#1D2B60" align=right><font color="white" size="1" face="Verdana">Welcome <? print $usrdata["fname"] . " ". $usrdata["lname"]; ?>!<br>User Since: <? print date("F d Y",$usrdata["since"]); ?><br>Server Time:<? print date("r"); ?><br><a href="login.php?a=logout" color=#CCFFFF>Click Here To Logout</a><br><a href="members.php" color=#CCFFFF>Click Here To Goto the Main Page</a></font></td> </tr> <tr><td colspan=2 height=14 bgcolor="#1D2B60"></td></tr> <tr> <td width="100%" height="100%" colspan=2 bgcolor="white" bordercolordark="black" align="center" bordercolorlight="black" border=1 valign="top"> <br><? include $CONTENT; ?><br><br> </td> </tr> </table> </body> <style type="text/css"> table.t {border: thin solid #000000; background-color: #FFFFFF} td.th {border: thin solid #000000; background-color:#FFFFFF; font-style: bold 12px; text-align:center; font-size: 12px; font-weight:bold} td.t {border: thin solid #000000; background-color:#FFFFFF; font-style: bold 12px; text-align:center; font-size: 12px; font-weight:bold} td.te {border: thin solid #000000; background-color:#FFFFFF; text-align:center; } td.ac1 {border: thin solid #000000; background-color:#FFFFFF; text-align:left; } td.ac2 {border: thin solid #000000; background-color:#FFFFFF; text-align:left; } a.t {color: #3366FF} a.msg {color: #3366FF} font.msg {font-style: bold 12px; font-size: 12px; font-weight:bold} </style> <script language='javascript'> function deleteconfirm() { if (confirm("Are you sure you want to delete all links?")) document.location = "members.php?p=delete"; } function resetconfirm() { if (confirm("Are you sure you want to reset the hit count for all links?")) document.location = "members.php?p=reset"; } </script> </html> Thank you, Sylvain Link to comment https://forums.phpfreaks.com/topic/212720-i-looked-in-my-data-base-and-nothing-was-sent-to-write/ Share on other sites More sharing options...
taquitosensei Posted September 7, 2010 Share Posted September 7, 2010 in this code you don't have any part of it that writes to the database. Link to comment https://forums.phpfreaks.com/topic/212720-i-looked-in-my-data-base-and-nothing-was-sent-to-write/#findComment-1108075 Share on other sites More sharing options...
mertch Posted September 7, 2010 Author Share Posted September 7, 2010 Thank you for telling me. May I ask you to do this ? Go to this URL and register to see what's wrong with this script ? http://www.mersyl.com/cgi-bin/c/t.cgi?fp It was gaven to me. Thanx Link to comment https://forums.phpfreaks.com/topic/212720-i-looked-in-my-data-base-and-nothing-was-sent-to-write/#findComment-1108098 Share on other sites More sharing options...
mertch Posted September 7, 2010 Author Share Posted September 7, 2010 Hi again, Are these codes ok ? <? if ($usrdata['level'] ==1 && $usrdata['urls'] >= $MAX_URLS_LEVEL_1) header("Location:upgrade.php"); $urltest="^(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.[a-zA-Z]{2,4})(\:[0-9]+)*(/[^/][a-zA-Z0-9\.\,\?\'\\/\+&%\$#\=~_\-]*)*$"; if (isset($_POST["esub"])) { $n_alias=false; $e_alias=false; $n_goto=false; $e_goto = false; $e_maxhits=false; $e_mhu=false; $e_mtu=false; $e_mwu=false; $urldata["id"] = $_POST["id"]; if ((!isset($_POST["alias"]) || $_POST["alias"] == "") && $n_alias=true) $urldata["alias"] = ""; else if (!ereg("[a-zA-Z0-9\-\_]",$_POST["alias"]) && $e_alias=true) $urldata["alias"] = ""; else $urldata["alias"] = $_POST["alias"]; if ((!isset($_POST["goto"]) || $_POST["goto"] == "" || $_POST["goto"] == "http://") && $n_goto=true) $urldata["goto"] = "http://"; else if (!ereg($urltest,$_POST["goto"]) && $e_goto=true) $urldata["goto"] = $_POST["goto"]; else $urldata["goto"] = $_POST["goto"]; if (!isset($_POST["maxhits"]) || $_POST["maxhits"] == "") $urldata["maxhits"] = ""; else if (!ereg("[0-9]",$_POST["maxhits"]) && $e_maxhits=true) $urldata["maxhits"] = ""; else $urldata["maxhits"] = $_POST["maxhits"]; if (!isset($_POST["max_hits_url"]) || $_POST["max_hits_url"] == "http://") $urldata["max_hits_url"] = "http://"; else if (!ereg($urltest,$_POST["max_hits_url"]) && $e_mhu=true) $urldata["max_hits_url"] = "http://"; else $urldata["max_hits_url"] = $_POST["max_hits_url"]; if (!isset($_POST["max_time_url"]) || $_POST["max_time_url"] == "http://") $urldata["max_time_url"] = "http://"; else if (!ereg($urltest,$_POST["max_time_url"]) && $e_mtu=true) $urldata["max_time_url"] = "http://"; else $urldata["max_time_url"] = $_POST["max_time_url"]; if (!isset($_POST["web_spider_url"]) || $_POST["web_spider_url"] == "http://") $urldata["web_spider_url"] = "http://"; else if (!ereg($urltest,$_POST["web_spider_url"]) && $e_mwu=true) $urldata["web_spider_url"] = "http://"; else $urldata["web_spider_url"] = $_POST["web_spider_url"]; if ($_POST["gmt"] != date("O") / 100) { $_POST["hour"] = $_POST["hour"] + ((date("O")/100) - $_POST["gmt"]); } $urldata["maxtime"]=mktime($_POST['hour'], $_POST['min'], $_POST['sec'], $_POST['month'], $_POST['day'],$_POST['year']); //print date("r",$urldata["maxtime"]) . "<br>"; //print date("r",mktime(0,0,0,1,1,2004)) . "=" . date("r",mktime($_POST['hour'], $_POST['min'], $_POST['sec'], $_POST['month'], $_POST['day'],$_POST['year'])); if ($n_alias || $e_alias || $n_goto || $e_goto || $e_maxhits || $e_mhu || $e_mtu || $e_mwu) { if ($_GET["a"] == "add") $act = "Add"; else if ($_GET["a"] == "edit") $act = "Edit"; } else if ($_GET["a"] == "add") { if ($usrdata["level"] ==1 && $usrdata["urls"] >= $MAX_URLS_LEVEL_1) header("Location:" . $MET_URL_LIMIT_URL); if ($urldata["maxhits"] == "" || $urldata["maxhits"] < 0) $urldata["maxhits"] = -1; //$urldata["maxtime"]=mktime($_POST['hour'], $_POST['min'], $_POST['sec'], $_POST['month'], $_POST['day'],$_POST['year'],0); if ($urldata["maxtime"] == mktime(0,0,0,1,1,2004)) $urldata["maxtime"] =-1; $query = "INSERT INTO l_links (alias,goto,maxhits,maxtime,max_hits_url,max_time_url,web_spider_url, owner) VALUES ('$urldata[alias]' , '$urldata[goto]' , '$urldata[maxhits]' , '$urldata[maxtime]' , '$urldata[max_hits_url]' , '$urldata[max_time_url]' , '$urldata[web_spider_url]', '$usrdata[id]')"; $inssql = mysql_query($query) or handledberror(mysql_error()); $query = "UPDATE l_users SET urls=urls+1 WHERE id='$usrdata[id]'"; $upsql = mysql_query($query) or handledberror(mysql_error()); header("Location: members.php"); } else if ($_GET["a"] == "edit") { if ($urldata["maxhits"] == "" || $urldata["maxhits"] < 0) $urldata["maxhits"] = -1; //$urldata["maxtime"]=mktime($_POST['hour'], $_POST['min'], $_POST['sec'], $_POST['month'], $_POST['day'],$_POST['year'],1); if ($urldata["maxtime"] == mktime(0,0,0,1,1,2004)) $urldata["maxtime"] =-1; $query = "UPDATE l_links SET alias='$urldata[alias]', goto='$urldata[goto]', maxhits='$urldata[maxhits]', maxtime='$urldata[maxtime]', max_hits_url='$urldata[max_hits_url]', max_time_url='$urldata[max_time_url]', web_spider_url='$urldata[web_spider_url]' WHERE id='$urldata[id]' AND owner='$usrdata[id]'"; $upsql = mysql_query($query) or handledberror(mysql_error()); header("Location: members.php"); } } ?> And this one : <?php global $URL_TO_MAIN_FOLDER; function td($a, $b) { $s = $b-$a; $m = floor($s/60.); $s -= ($m*60); $h = floor($m/60.); $m -= ($h*60); $d = floor($h/24.); $h -= ($d*24); $y = floor($d/365.); $d -= ($y*365); $str=""; if ($y>0) $str = $str . $y . "yrs "; if ($d>0) $str = $str . $d . "days "; if ($h>0) $str = $str . $h . "hrs "; if ($m>0) $str = $str . $m . "min "; if ($s>0) $str = $str . $s . "s "; return $str; } function print_options($id) { print "<td class='te'><a href='members.php?p=urlview&a=edit&id=$id'><img src='images/edit.gif' border=0></a><a href='members.php?p=reset&id=$id'><img src='images/refresh1.gif' border=0></a><a href='members.php?p=delete&id=$id'><img src='images/trash2.gif' border=0></a></td>"; } $query = "SELECT * FROM l_links WHERE owner='$usrdata[id]' ORDER BY alias ASC"; $lnksql = mysql_query($query) or handledberror(mysql_error()); if ( $usrdata["level"] == 1 && $MAX_URLS_LEVEL_1 - $usrdata['urls'] == 0) { print "<center><font class='msg'>You have run out of URLs. Click <a href='upgrade.php' class='msg'>here</a> to get unlimited URLS! </font><br></center>"; print "<center><form action='members.php' method='POST'><input type='button' value='+add url' name='add' onClick=\"document.location='members.php?p=add&a=add'\" disabled>"; } else if ( $usrdata["level"] == 1 && $MAX_URLS_LEVEL_1 - $usrdata['urls'] > 0 ) { print "<center><font class='msg'>You have only " . ($MAX_URLS_LEVEL_1 - $usrdata['urls']) . " URLs left! Click <a href='upgrade.php' class='msg'>here</a> to get unlimited URLS! </font><br></center>"; print "<center><form action='members.php' method='POST'><input type='button' value='+add url' name='add' onClick=\"document.location='members.php?p=add&a=add'\">"; } else if ($usrdata["level"] == 2 && $MAX_URLS_LEVEL_1 - $usrdata['urls'] > 0 && $usrdata['paid'] == 0) { print "<center><font class='msg'>Your payment for this month has not been received/validated yet. Until it is validated, your account will only be able to handle up to $MAX_URLS_LEVEL_1 URLS at a time.<br>If you canceled your payment and would like to upgrade, click <a href='upgrade.php' class='msg'>here</a>. </font><br></center>"; print "<center><form action='members.php' method='POST'><input type='button' value='+add url' name='add' onClick=\"document.location='members.php?p=add&a=add'\">"; } else if ($usrdata["level"] == 2 && $MAX_URLS_LEVEL_1 - $usrdata['urls'] < 1 && $usrdata['paid'] == 0) { print "<center><font class='msg'>Your payment for this month has not been received/validated yet. Until it is validated, your account will only be able to handle up to $MAX_URLS_LEVEL_1 URLS at a time.<br> If you canceled your payment and would like to upgrade, click <a href='upgrade.php' class='msg'>here</a>.</font><br></center>"; print "<center><form action='members.php' method='POST'><input disabled type='button' value='+add url' name='add' onClick=\"document.location='members.php?p=add&a=add'\">"; } else { print "<center><form action='members.php' method='POST'><input type='button' value='+add url' name='add' onClick=\"document.location='members.php?p=add&a=add'\">"; } if ($usrdata["admin"] == 1) { print "<input type='button' value='approve user area' onClick=\"document.location='members.php?p=approve'\">"; } print "<input type='button' value='reset all' onClick='javascript:resetconfirm();'><input type='button' value='-delete all' onClick='javascript:deleteconfirm()'></form><center>"; echo "<center><table class='t' width=95%> <tr> <td colspan=9 class='th' align=center><b>Manage Your Links</b></td> </tr> <tr><td class='th'>#</td><td class='th'>Options</td><td class='th'>Alias</td><td class='th'>URL</td><td class='th'>Hits</td><td class='th'>Max Hits</td><td class='th'>Hits Left</td><td class='th'>End Time</td><td class='th'>Time Left</td></tr>"; $count = 1; while ($lnkrow = mysql_fetch_array($lnksql)) { print "<tr>\n"; print "<td class='te'>$count</td>\n"; print_options($lnkrow['id']); print "<td class='te'><a class='t' href='$lnkrow[goto]'>$lnkrow[alias]</a></td>\n"; print "<td class='te'>$URL_TO_MAIN_FOLDER?" . $usrdata["id"] . ":" . $lnkrow["alias"] . "</td>"; print "<td class='te'>$lnkrow[hits]</td>\n"; if ($lnkrow["maxhits"] != -1) { print "<td class='te'>$lnkrow[maxhits]</td>\n"; print "<td class='te'>". ($lnkrow["maxhits"] - $lnkrow["hits"]) . "</td>"; } else { print "<td class='te'>N/A</td>"; print "<td class='te'>N/A</td>"; } if ($lnkrow["maxtime"] != -1) { print "<td class='te'><font size=1>" . date("r",$lnkrow["maxtime"]) . "</font></td>\n"; if (time() > $lnkrow["maxtime"]) print "<td class='te'>0</td>"; else print "<td class='te'><font size=1>" . td(time(), $lnkrow["maxtime"]) . "</font></td>\n"; } else { print "<td class='te'>N/A</td>"; print "<td class='te'>N/A</td>"; } print "</tr>"; $count++; } print "</table>"; //print time(); ?> Thanx for your time Link to comment https://forums.phpfreaks.com/topic/212720-i-looked-in-my-data-base-and-nothing-was-sent-to-write/#findComment-1108153 Share on other sites More sharing options...
Rifts Posted September 7, 2010 Share Posted September 7, 2010 ohmy Link to comment https://forums.phpfreaks.com/topic/212720-i-looked-in-my-data-base-and-nothing-was-sent-to-write/#findComment-1108158 Share on other sites More sharing options...
mertch Posted September 7, 2010 Author Share Posted September 7, 2010 Sorry Rifts but, my first language is french so, can you define : ohmy in this situation ? Link to comment https://forums.phpfreaks.com/topic/212720-i-looked-in-my-data-base-and-nothing-was-sent-to-write/#findComment-1108161 Share on other sites More sharing options...
Rifts Posted September 7, 2010 Share Posted September 7, 2010 use php tags it will help a lot Link to comment https://forums.phpfreaks.com/topic/212720-i-looked-in-my-data-base-and-nothing-was-sent-to-write/#findComment-1108166 Share on other sites More sharing options...
mertch Posted September 7, 2010 Author Share Posted September 7, 2010 Thank you Rifts. Have a nice evening Link to comment https://forums.phpfreaks.com/topic/212720-i-looked-in-my-data-base-and-nothing-was-sent-to-write/#findComment-1108455 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.